=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 Contact: devex@mux.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.0.1 =end require 'cgi' module MuxRuby class DeliveryUsageApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # List Usage # Returns a list of delivery usage records and their associated Asset IDs or Live Stream IDs. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1) # @option opts [Integer] :limit Number of items to include in the response (default to 100) # @option opts [String] :asset_id Filter response to return delivery usage for this asset only. You cannot specify both the `asset_id` and `live_stream_id` parameters together. # @option opts [String] :live_stream_id Filter response to return delivery usage for assets for this live stream. You cannot specify both the `asset_id` and `live_stream_id` parameters together. # @option opts [Array] :timeframe Time window to get delivery usage information. timeframe[0] indicates the start time, timeframe[1] indicates the end time in seconds since the Unix epoch. Default time window is 1 hour representing usage from 13th to 12th hour from when the request is made. # @return [ListDeliveryUsageResponse] def list_delivery_usage(opts = {}) data, _status_code, _headers = list_delivery_usage_with_http_info(opts) data end # List Usage # Returns a list of delivery usage records and their associated Asset IDs or Live Stream IDs. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Offset by this many pages, of the size of `limit` # @option opts [Integer] :limit Number of items to include in the response # @option opts [String] :asset_id Filter response to return delivery usage for this asset only. You cannot specify both the `asset_id` and `live_stream_id` parameters together. # @option opts [String] :live_stream_id Filter response to return delivery usage for assets for this live stream. You cannot specify both the `asset_id` and `live_stream_id` parameters together. # @option opts [Array] :timeframe Time window to get delivery usage information. timeframe[0] indicates the start time, timeframe[1] indicates the end time in seconds since the Unix epoch. Default time window is 1 hour representing usage from 13th to 12th hour from when the request is made. # @return [Array<(ListDeliveryUsageResponse, Integer, Hash)>] ListDeliveryUsageResponse data, response status code and response headers def list_delivery_usage_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DeliveryUsageApi.list_delivery_usage ...' end # resource path local_var_path = '/video/v1/delivery-usage' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'asset_id'] = opts[:'asset_id'] if !opts[:'asset_id'].nil? query_params[:'live_stream_id'] = opts[:'live_stream_id'] if !opts[:'live_stream_id'].nil? query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].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] || 'ListDeliveryUsageResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"DeliveryUsageApi.list_delivery_usage", :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: DeliveryUsageApi#list_delivery_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end