=begin #Cloudsmith API #The API to the Cloudsmith Service OpenAPI spec version: v1 Contact: support@cloudsmith.io Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3 =end require "uri" module CloudsmithApi class MetricsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # View for listing entitlement token metrics, across an account. # View for listing entitlement token metrics, across an account. # @param owner # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :tokens A comma seperated list of tokens (slug perm) to include in the results. # @return [EntitlementUsageMetrics] def metrics_entitlements_list(owner, opts = {}) data, _status_code, _headers = metrics_entitlements_list_with_http_info(owner, opts) return data end # View for listing entitlement token metrics, across an account. # View for listing entitlement token metrics, across an account. # @param owner # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :tokens A comma seperated list of tokens (slug perm) to include in the results. # @return [Array<(EntitlementUsageMetrics, Fixnum, Hash)>] EntitlementUsageMetrics data, response status code and response headers def metrics_entitlements_list_with_http_info(owner, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: MetricsApi.metrics_entitlements_list ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling MetricsApi.metrics_entitlements_list" end # resource path local_var_path = "/metrics/entitlements/{owner}/".sub('{' + 'owner' + '}', owner.to_s) # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'finish'] = opts[:'finish'] if !opts[:'finish'].nil? query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? query_params[:'tokens'] = opts[:'tokens'] if !opts[:'tokens'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey'] 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 => 'EntitlementUsageMetrics') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#metrics_entitlements_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # View for listing entitlement token metrics, for a repository. # View for listing entitlement token metrics, for a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :tokens A comma seperated list of tokens (slug perm) to include in the results. # @return [EntitlementUsageMetrics] def metrics_entitlements_list0(owner, repo, opts = {}) data, _status_code, _headers = metrics_entitlements_list0_with_http_info(owner, repo, opts) return data end # View for listing entitlement token metrics, for a repository. # View for listing entitlement token metrics, for a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :tokens A comma seperated list of tokens (slug perm) to include in the results. # @return [Array<(EntitlementUsageMetrics, Fixnum, Hash)>] EntitlementUsageMetrics data, response status code and response headers def metrics_entitlements_list0_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: MetricsApi.metrics_entitlements_list0 ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling MetricsApi.metrics_entitlements_list0" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling MetricsApi.metrics_entitlements_list0" end # resource path local_var_path = "/metrics/entitlements/{owner}/{repo}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'finish'] = opts[:'finish'] if !opts[:'finish'].nil? query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? query_params[:'tokens'] = opts[:'tokens'] if !opts[:'tokens'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey'] 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 => 'EntitlementUsageMetrics') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#metrics_entitlements_list0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # View for listing package usage metrics, for a repository. # View for listing package usage metrics, for a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :packages A comma seperated list of packages (slug perm) to include in the results. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @return [PackageUsageMetrics] def metrics_packages_list(owner, repo, opts = {}) data, _status_code, _headers = metrics_packages_list_with_http_info(owner, repo, opts) return data end # View for listing package usage metrics, for a repository. # View for listing package usage metrics, for a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @option opts [String] :finish Include metrics upto and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @option opts [String] :packages A comma seperated list of packages (slug perm) to include in the results. # @option opts [String] :start Include metrics from and including this UTC date or UTC datetime. For example '2020-12-31' or '2021-12-13T00:00:00Z'. # @return [Array<(PackageUsageMetrics, Fixnum, Hash)>] PackageUsageMetrics data, response status code and response headers def metrics_packages_list_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: MetricsApi.metrics_packages_list ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling MetricsApi.metrics_packages_list" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling MetricsApi.metrics_packages_list" end # resource path local_var_path = "/metrics/packages/{owner}/{repo}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'finish'] = opts[:'finish'] if !opts[:'finish'].nil? query_params[:'packages'] = opts[:'packages'] if !opts[:'packages'].nil? query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey'] 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 => 'PackageUsageMetrics') if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#metrics_packages_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end