Class: CloudsmithApi::MetricsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsmith-api/api/metrics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MetricsApi



19
20
21
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#metrics_entitlements_usage_list(owner, repo, opts = {}) ⇒ Array<EntitlementTokenMetric>

View for listing entitlement token usage as a metric. View for listing entitlement token usage as a metric.

Options Hash (opts):

  • :page (Integer)

    A page number within the paginated result set.

  • :page_size (Integer)

    Number of results to return per page.

  • :finish (Integer)

    Filter token usage ending before this datetime (UTC by default unless otherwise specified). Defaults to now if not supplied.

  • :start (Integer)

    Filter token usage starting from this datetime (UTC by default unless otherwise specified)).

  • :tokens (String)

    A comma seperated list of tokens (slug perm) to include in the results.



34
35
36
37
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 34

def metrics_entitlements_usage_list(owner, repo, opts = {})
  data, _status_code, _headers = metrics_entitlements_usage_list_with_http_info(owner, repo, opts)
  return data
end

#metrics_entitlements_usage_list_with_http_info(owner, repo, opts = {}) ⇒ Array<(Array<EntitlementTokenMetric>, Fixnum, Hash)>

View for listing entitlement token usage as a metric. View for listing entitlement token usage as a metric.

Options Hash (opts):

  • :page (Integer)

    A page number within the paginated result set.

  • :page_size (Integer)

    Number of results to return per page.

  • :finish (Integer)

    Filter token usage ending before this datetime (UTC by default unless otherwise specified). Defaults to now if not supplied.

  • :start (Integer)

    Filter token usage starting from this datetime (UTC by default unless otherwise specified)).

  • :tokens (String)

    A comma seperated list of tokens (slug perm) to include in the results.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 50

def metrics_entitlements_usage_list_with_http_info(owner, repo, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MetricsApi.metrics_entitlements_usage_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_usage_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_entitlements_usage_list"
  end
  # resource path
  local_var_path = "/metrics/{owner}/{repo}/entitlements/usage/".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', 'csrf_token']
  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 => 'Array<EntitlementTokenMetric>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MetricsApi#metrics_entitlements_usage_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#metrics_packages_usage_list(owner, repo, opts = {}) ⇒ Array<PackageUsageMetric>

View for listing package usage metrics by user. View for listing package usage metrics by user.

Options Hash (opts):

  • :page (Integer)

    A page number within the paginated result set.

  • :page_size (Integer)

    Number of results to return per page.

  • :finish (Integer)

    Filter token usage ending before this datetime (UTC). Defaults to now if not supplied.

  • :packages (String)

    A comma seperated list of packages (slug perm) to include in the results.

  • :start (Integer)

    Filter token usage starting from this datetime (UTC)).



106
107
108
109
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 106

def metrics_packages_usage_list(owner, repo, opts = {})
  data, _status_code, _headers = metrics_packages_usage_list_with_http_info(owner, repo, opts)
  return data
end

#metrics_packages_usage_list_with_http_info(owner, repo, opts = {}) ⇒ Array<(Array<PackageUsageMetric>, Fixnum, Hash)>

View for listing package usage metrics by user. View for listing package usage metrics by user.

Options Hash (opts):

  • :page (Integer)

    A page number within the paginated result set.

  • :page_size (Integer)

    Number of results to return per page.

  • :finish (Integer)

    Filter token usage ending before this datetime (UTC). Defaults to now if not supplied.

  • :packages (String)

    A comma seperated list of packages (slug perm) to include in the results.

  • :start (Integer)

    Filter token usage starting from this datetime (UTC)).



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/cloudsmith-api/api/metrics_api.rb', line 122

def metrics_packages_usage_list_with_http_info(owner, repo, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MetricsApi.metrics_packages_usage_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_usage_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_usage_list"
  end
  # resource path
  local_var_path = "/metrics/{owner}/{repo}/packages/usage/".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', 'csrf_token']
  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 => 'Array<PackageUsageMetric>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MetricsApi#metrics_packages_usage_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end