=begin # Mux Ruby - Copyright 2019 Mux Inc. # NOTE: This file is auto generated. Do not edit this file manually. =end require 'uri' module MuxRuby class MetricsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get metric timeseries data # Returns timeseries data for a specific metric # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [String] :order_direction Sort order. # @option opts [String] :group_by Time granularity to group results by. If this value is omitted, a default granularity is chosen based on the supplied timeframe. # @return [GetMetricTimeseriesDataResponse] def get_metric_timeseries_data(metric_id, opts = {}) data, _status_code, _headers = get_metric_timeseries_data_with_http_info(metric_id, opts) data end # Get metric timeseries data # Returns timeseries data for a specific metric # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [String] :order_direction Sort order. # @option opts [String] :group_by Time granularity to group results by. If this value is omitted, a default granularity is chosen based on the supplied timeframe. # @return [Array<(GetMetricTimeseriesDataResponse, Fixnum, Hash)>] GetMetricTimeseriesDataResponse data, response status code and response headers def get_metric_timeseries_data_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.get_metric_timeseries_data ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric_id.nil? fail ArgumentError, "Missing the required parameter 'metric_id' when calling MetricsApi.get_metric_timeseries_data" end # verify enum value if @api_client.config.client_side_validation && !['aggregate_startup_time', 'downscale_percentage', 'exits_before_video_start', 'max_downscale_percentage', 'max_upscale_percentage', 'page_load_time', 'playback_failure_percentage', 'playback_failure_score', 'player_startup_time', 'rebuffer_count', 'rebuffer_duration', 'rebuffer_frequency', 'rebuffer_percentage', 'rebuffer_score', 'requests_for_first_preroll', 'seek_latency', 'startup_time_score', 'upscale_percentage', 'video_quality_score', 'video_startup_preroll_load_time', 'video_startup_preroll_request_time', 'video_startup_time', 'viewer_experience_score'].include?(metric_id) fail ArgumentError, "invalid value for 'metric_id', must be one of aggregate_startup_time, downscale_percentage, exits_before_video_start, max_downscale_percentage, max_upscale_percentage, page_load_time, playback_failure_percentage, playback_failure_score, player_startup_time, rebuffer_count, rebuffer_duration, rebuffer_frequency, rebuffer_percentage, rebuffer_score, requests_for_first_preroll, seek_latency, startup_time_score, upscale_percentage, video_quality_score, video_startup_preroll_load_time, video_startup_preroll_request_time, video_startup_time, viewer_experience_score" end if @api_client.config.client_side_validation && opts[:'measurement'] && !['95th', 'median', 'avg'].include?(opts[:'measurement']) fail ArgumentError, 'invalid value for "measurement", must be one of 95th, median, avg' end if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction']) fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc' end if @api_client.config.client_side_validation && opts[:'group_by'] && !['hour', 'day'].include?(opts[:'group_by']) fail ArgumentError, 'invalid value for "group_by", must be one of hour, day' end # resource path local_var_path = '/data/v1/metrics/{METRIC_ID}/timeseries'.sub('{' + 'METRIC_ID' + '}', metric_id.to_s) # query parameters query_params = {} query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil? query_params[:'filters[]'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil? query_params[:'measurement'] = opts[:'measurement'] if !opts[:'measurement'].nil? query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil? query_params[:'group_by'] = opts[:'group_by'] if !opts[:'group_by'].nil? # 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 = ['accessToken'] 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 => 'GetMetricTimeseriesDataResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#get_metric_timeseries_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Overall values # Returns the overall value for a specific metric, as well as the total view count, watch time, and the Mux Global metric value for the metric. # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @return [GetOverallValuesResponse] def get_overall_values(metric_id, opts = {}) data, _status_code, _headers = get_overall_values_with_http_info(metric_id, opts) data end # Get Overall values # Returns the overall value for a specific metric, as well as the total view count, watch time, and the Mux Global metric value for the metric. # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @return [Array<(GetOverallValuesResponse, Fixnum, Hash)>] GetOverallValuesResponse data, response status code and response headers def get_overall_values_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.get_overall_values ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric_id.nil? fail ArgumentError, "Missing the required parameter 'metric_id' when calling MetricsApi.get_overall_values" end # verify enum value if @api_client.config.client_side_validation && !['aggregate_startup_time', 'downscale_percentage', 'exits_before_video_start', 'max_downscale_percentage', 'max_upscale_percentage', 'page_load_time', 'playback_failure_percentage', 'playback_failure_score', 'player_startup_time', 'rebuffer_count', 'rebuffer_duration', 'rebuffer_frequency', 'rebuffer_percentage', 'rebuffer_score', 'requests_for_first_preroll', 'seek_latency', 'startup_time_score', 'upscale_percentage', 'video_quality_score', 'video_startup_preroll_load_time', 'video_startup_preroll_request_time', 'video_startup_time', 'viewer_experience_score'].include?(metric_id) fail ArgumentError, "invalid value for 'metric_id', must be one of aggregate_startup_time, downscale_percentage, exits_before_video_start, max_downscale_percentage, max_upscale_percentage, page_load_time, playback_failure_percentage, playback_failure_score, player_startup_time, rebuffer_count, rebuffer_duration, rebuffer_frequency, rebuffer_percentage, rebuffer_score, requests_for_first_preroll, seek_latency, startup_time_score, upscale_percentage, video_quality_score, video_startup_preroll_load_time, video_startup_preroll_request_time, video_startup_time, viewer_experience_score" end if @api_client.config.client_side_validation && opts[:'measurement'] && !['95th', 'median', 'avg'].include?(opts[:'measurement']) fail ArgumentError, 'invalid value for "measurement", must be one of 95th, median, avg' end # resource path local_var_path = '/data/v1/metrics/{METRIC_ID}/overall'.sub('{' + 'METRIC_ID' + '}', metric_id.to_s) # query parameters query_params = {} query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil? query_params[:'filters[]'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil? query_params[:'measurement'] = opts[:'measurement'] if !opts[:'measurement'].nil? # 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 = ['accessToken'] 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 => 'GetOverallValuesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#get_overall_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List all metric values # List all of the values across every breakdown for a specific metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :dimension Dimension the specified value belongs to # @option opts [String] :value Value to show all available metrics for # @return [ListAllMetricValuesResponse] def list_all_metric_values(opts = {}) data, _status_code, _headers = list_all_metric_values_with_http_info(opts) data end # List all metric values # List all of the values across every breakdown for a specific metric # @param [Hash] opts the optional parameters # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @option opts [String] :dimension Dimension the specified value belongs to # @option opts [String] :value Value to show all available metrics for # @return [Array<(ListAllMetricValuesResponse, Fixnum, Hash)>] ListAllMetricValuesResponse data, response status code and response headers def list_all_metric_values_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_all_metric_values ...' end if @api_client.config.client_side_validation && opts[:'dimension'] && !['asn', 'browser', 'browser_version', 'cdn', 'country', 'experiment_name', 'operating_system', 'operating_system_version', 'player_name', 'player_software', 'player_software_version', 'player_version', 'preroll_ad_asset_hostname', 'preroll_ad_tag_hostname', 'preroll_played', 'preroll_requested', 'source_hostname', 'source_type', 'stream_type', 'sub_property_id', 'video_series', 'video_title'].include?(opts[:'dimension']) fail ArgumentError, 'invalid value for "dimension", must be one of asn, browser, browser_version, cdn, country, experiment_name, operating_system, operating_system_version, player_name, player_software, player_software_version, player_version, preroll_ad_asset_hostname, preroll_ad_tag_hostname, preroll_played, preroll_requested, source_hostname, source_type, stream_type, sub_property_id, video_series, video_title' end # resource path local_var_path = '/data/v1/metrics/comparison' # query parameters query_params = {} query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil? query_params[:'filters[]'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil? query_params[:'dimension'] = opts[:'dimension'] if !opts[:'dimension'].nil? query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil? # 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 = ['accessToken'] 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 => 'ListAllMetricValuesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#list_all_metric_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List breakdown values # List the breakdown values for a specific metric # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [String] :group_by Breakdown value to group the results by # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @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 [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @return [ListBreakdownValuesResponse] def list_breakdown_values(metric_id, opts = {}) data, _status_code, _headers = list_breakdown_values_with_http_info(metric_id, opts) data end # List breakdown values # List the breakdown values for a specific metric # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [String] :group_by Breakdown value to group the results by # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [Array] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]=operating_system:windows&filters[]=country:US). Possible filter names are the same as returned by the List Filters endpoint. # @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 [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @return [Array<(ListBreakdownValuesResponse, Fixnum, Hash)>] ListBreakdownValuesResponse data, response status code and response headers def list_breakdown_values_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_breakdown_values ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric_id.nil? fail ArgumentError, "Missing the required parameter 'metric_id' when calling MetricsApi.list_breakdown_values" end # verify enum value if @api_client.config.client_side_validation && !['aggregate_startup_time', 'downscale_percentage', 'exits_before_video_start', 'max_downscale_percentage', 'max_upscale_percentage', 'page_load_time', 'playback_failure_percentage', 'playback_failure_score', 'player_startup_time', 'rebuffer_count', 'rebuffer_duration', 'rebuffer_frequency', 'rebuffer_percentage', 'rebuffer_score', 'requests_for_first_preroll', 'seek_latency', 'startup_time_score', 'upscale_percentage', 'video_quality_score', 'video_startup_preroll_load_time', 'video_startup_preroll_request_time', 'video_startup_time', 'viewer_experience_score'].include?(metric_id) fail ArgumentError, "invalid value for 'metric_id', must be one of aggregate_startup_time, downscale_percentage, exits_before_video_start, max_downscale_percentage, max_upscale_percentage, page_load_time, playback_failure_percentage, playback_failure_score, player_startup_time, rebuffer_count, rebuffer_duration, rebuffer_frequency, rebuffer_percentage, rebuffer_score, requests_for_first_preroll, seek_latency, startup_time_score, upscale_percentage, video_quality_score, video_startup_preroll_load_time, video_startup_preroll_request_time, video_startup_time, viewer_experience_score" end if @api_client.config.client_side_validation && opts[:'group_by'] && !['asn', 'browser', 'browser_version', 'cdn', 'country', 'experiment_name', 'operating_system', 'operating_system_version', 'player_name', 'player_software', 'player_software_version', 'player_version', 'preroll_ad_asset_hostname', 'preroll_ad_tag_hostname', 'preroll_played', 'preroll_requested', 'source_hostname', 'source_type', 'stream_type', 'sub_property_id', 'video_series', 'video_title'].include?(opts[:'group_by']) fail ArgumentError, 'invalid value for "group_by", must be one of asn, browser, browser_version, cdn, country, experiment_name, operating_system, operating_system_version, player_name, player_software, player_software_version, player_version, preroll_ad_asset_hostname, preroll_ad_tag_hostname, preroll_played, preroll_requested, source_hostname, source_type, stream_type, sub_property_id, video_series, video_title' end if @api_client.config.client_side_validation && opts[:'measurement'] && !['95th', 'median', 'avg'].include?(opts[:'measurement']) fail ArgumentError, 'invalid value for "measurement", must be one of 95th, median, avg' end if @api_client.config.client_side_validation && opts[:'order_by'] && !['negative_impact', 'value', 'views', 'field'].include?(opts[:'order_by']) fail ArgumentError, 'invalid value for "order_by", must be one of negative_impact, value, views, field' end if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction']) fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc' end # resource path local_var_path = '/data/v1/metrics/{METRIC_ID}/breakdown'.sub('{' + 'METRIC_ID' + '}', metric_id.to_s) # query parameters query_params = {} query_params[:'group_by'] = opts[:'group_by'] if !opts[:'group_by'].nil? query_params[:'measurement'] = opts[:'measurement'] if !opts[:'measurement'].nil? query_params[:'filters[]'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil? 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[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil? # 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 = ['accessToken'] 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 => 'ListBreakdownValuesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#list_breakdown_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Insights # Returns a list of insights for a metric. These are the worst performing values across all breakdowns sorted by how much they negatively impact a specific metric. # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [String] :order_direction Sort order. # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @return [ListInsightsResponse] def list_insights(metric_id, opts = {}) data, _status_code, _headers = list_insights_with_http_info(metric_id, opts) data end # List Insights # Returns a list of insights for a metric. These are the worst performing values across all breakdowns sorted by how much they negatively impact a specific metric. # @param metric_id ID of the Metric # @param [Hash] opts the optional parameters # @option opts [String] :measurement Measurement for the provided metric. If omitted, the deafult for the metric will be used. # @option opts [String] :order_direction Sort order. # @option opts [Array] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]=). Accepted formats are... * array of epoch timestamps e.g. timeframe[]=1498867200&timeframe[]=1498953600 * duration string e.g. timeframe[]=24:hours or timeframe[]=7:days. # @return [Array<(ListInsightsResponse, Fixnum, Hash)>] ListInsightsResponse data, response status code and response headers def list_insights_with_http_info(metric_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.list_insights ...' end # verify the required parameter 'metric_id' is set if @api_client.config.client_side_validation && metric_id.nil? fail ArgumentError, "Missing the required parameter 'metric_id' when calling MetricsApi.list_insights" end # verify enum value if @api_client.config.client_side_validation && !['aggregate_startup_time', 'downscale_percentage', 'exits_before_video_start', 'max_downscale_percentage', 'max_upscale_percentage', 'page_load_time', 'playback_failure_percentage', 'playback_failure_score', 'player_startup_time', 'rebuffer_count', 'rebuffer_duration', 'rebuffer_frequency', 'rebuffer_percentage', 'rebuffer_score', 'requests_for_first_preroll', 'seek_latency', 'startup_time_score', 'upscale_percentage', 'video_quality_score', 'video_startup_preroll_load_time', 'video_startup_preroll_request_time', 'video_startup_time', 'viewer_experience_score'].include?(metric_id) fail ArgumentError, "invalid value for 'metric_id', must be one of aggregate_startup_time, downscale_percentage, exits_before_video_start, max_downscale_percentage, max_upscale_percentage, page_load_time, playback_failure_percentage, playback_failure_score, player_startup_time, rebuffer_count, rebuffer_duration, rebuffer_frequency, rebuffer_percentage, rebuffer_score, requests_for_first_preroll, seek_latency, startup_time_score, upscale_percentage, video_quality_score, video_startup_preroll_load_time, video_startup_preroll_request_time, video_startup_time, viewer_experience_score" end if @api_client.config.client_side_validation && opts[:'measurement'] && !['95th', 'median', 'avg'].include?(opts[:'measurement']) fail ArgumentError, 'invalid value for "measurement", must be one of 95th, median, avg' end if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction']) fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc' end # resource path local_var_path = '/data/v1/metrics/{METRIC_ID}/insights'.sub('{' + 'METRIC_ID' + '}', metric_id.to_s) # query parameters query_params = {} query_params[:'measurement'] = opts[:'measurement'] if !opts[:'measurement'].nil? query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil? query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil? # 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 = ['accessToken'] 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 => 'ListInsightsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#list_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end