Class: Mudbase::UsageApi
- Inherits:
-
Object
- Object
- Mudbase::UsageApi
- Defined in:
- lib/mudbase/api/usage_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_overage(opts = {}) ⇒ GetOverage200Response
Get current overage line items Returns overage line items for the authenticated organization's current billing period (current month).
-
#get_overage_with_http_info(opts = {}) ⇒ Array<(GetOverage200Response, Integer, Hash)>
Get current overage line items Returns overage line items for the authenticated organization's current billing period (current month).
-
#get_project_usage_stats(project_id, opts = {}) ⇒ ProjectUsageStatsResponse
Get project usage Get usage statistics for a project (API calls, storage, bandwidth, database operations).
-
#get_project_usage_stats_with_http_info(project_id, opts = {}) ⇒ Array<(ProjectUsageStatsResponse, Integer, Hash)>
Get project usage Get usage statistics for a project (API calls, storage, bandwidth, database operations).
-
#get_project_usage_summary(project_id, opts = {}) ⇒ ProjectUsageSummaryResponse
Project dashboard usage summary Lightweight dashboard metrics for a project: requests today vs yesterday with % change, active users (24h/7d/30d), 7d active-user trend, 14-day request volume series, per-project openapi-docs latency (today/7d), and uptime (30d) from org HTTP non-5xx when enough samples else DB heartbeats.
-
#get_project_usage_summary_with_http_info(project_id, opts = {}) ⇒ Array<(ProjectUsageSummaryResponse, Integer, Hash)>
Project dashboard usage summary Lightweight dashboard metrics for a project: requests today vs yesterday with % change, active users (24h/7d/30d), 7d active-user trend, 14-day request volume series, per-project openapi-docs latency (today/7d), and uptime (30d) from org HTTP non-5xx when enough samples else DB heartbeats.
-
#get_usage(opts = {}) ⇒ UsageStatsResponse
Get organization usage.
-
#get_usage_trends(opts = {}) ⇒ UsageTrendsResponse
Get usage trends Get usage trends over time for the authenticated organization or project.
-
#get_usage_trends_with_http_info(opts = {}) ⇒ Array<(UsageTrendsResponse, Integer, Hash)>
Get usage trends Get usage trends over time for the authenticated organization or project.
-
#get_usage_warnings(opts = {}) ⇒ GetUsageWarnings200Response
Get usage warnings Returns usage warnings for the authenticated org (e.g. at 80% and 95% of plan limits).
-
#get_usage_warnings_with_http_info(opts = {}) ⇒ Array<(GetUsageWarnings200Response, Integer, Hash)>
Get usage warnings Returns usage warnings for the authenticated org (e.g. at 80% and 95% of plan limits).
-
#get_usage_with_http_info(opts = {}) ⇒ Array<(UsageStatsResponse, Integer, Hash)>
Get organization usage.
-
#initialize(api_client = ApiClient.default) ⇒ UsageApi
constructor
A new instance of UsageApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/mudbase/api/usage_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_overage(opts = {}) ⇒ GetOverage200Response
Get current overage line items Returns overage line items for the authenticated organization's current billing period (current month). Used by dashboards and billing UIs. Requires org-level JWT (authRequired).
26 27 28 29 |
# File 'lib/mudbase/api/usage_api.rb', line 26 def get_overage(opts = {}) data, _status_code, _headers = get_overage_with_http_info(opts) data end |
#get_overage_with_http_info(opts = {}) ⇒ Array<(GetOverage200Response, Integer, Hash)>
Get current overage line items Returns overage line items for the authenticated organization's current billing period (current month). Used by dashboards and billing UIs. Requires org-level JWT (authRequired).
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 |
# File 'lib/mudbase/api/usage_api.rb', line 35 def get_overage_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_overage ...' end # resource path local_var_path = '/api/usage/overage' # 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']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetOverage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth'] = opts.merge( :operation => :"UsageApi.get_overage", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_overage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_project_usage_stats(project_id, opts = {}) ⇒ ProjectUsageStatsResponse
Get project usage Get usage statistics for a project (API calls, storage, bandwidth, database operations). Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
85 86 87 88 |
# File 'lib/mudbase/api/usage_api.rb', line 85 def get_project_usage_stats(project_id, opts = {}) data, _status_code, _headers = get_project_usage_stats_with_http_info(project_id, opts) data end |
#get_project_usage_stats_with_http_info(project_id, opts = {}) ⇒ Array<(ProjectUsageStatsResponse, Integer, Hash)>
Get project usage Get usage statistics for a project (API calls, storage, bandwidth, database operations). Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 |
# File 'lib/mudbase/api/usage_api.rb', line 96 def get_project_usage_stats_with_http_info(project_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_project_usage_stats ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UsageApi.get_project_usage_stats" end allowable_values = ["day", "week", "month"] if @api_client.config.client_side_validation && opts[:'period'] && !allowable_values.include?(opts[:'period']) fail ArgumentError, "invalid value for \"period\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/usage/projects/{projectId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ProjectUsageStatsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"UsageApi.get_project_usage_stats", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_project_usage_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_project_usage_summary(project_id, opts = {}) ⇒ ProjectUsageSummaryResponse
Project dashboard usage summary Lightweight dashboard metrics for a project: requests today vs yesterday with % change, active users (24h/7d/30d), 7d active-user trend, 14-day request volume series, per-project openapi-docs latency (today/7d), and uptime (30d) from org HTTP non-5xx when enough samples else DB heartbeats. Same auth as GET /api/usage/projects/projectId (org JWT, project JWT, or API key scoped to the project).
154 155 156 157 |
# File 'lib/mudbase/api/usage_api.rb', line 154 def get_project_usage_summary(project_id, opts = {}) data, _status_code, _headers = get_project_usage_summary_with_http_info(project_id, opts) data end |
#get_project_usage_summary_with_http_info(project_id, opts = {}) ⇒ Array<(ProjectUsageSummaryResponse, Integer, Hash)>
Project dashboard usage summary Lightweight dashboard metrics for a project: requests today vs yesterday with % change, active users (24h/7d/30d), 7d active-user trend, 14-day request volume series, per-project openapi-docs latency (today/7d), and uptime (30d) from org HTTP non-5xx when enough samples else DB heartbeats. Same auth as GET /api/usage/projects/projectId (org JWT, project JWT, or API key scoped to the project).
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/mudbase/api/usage_api.rb', line 164 def get_project_usage_summary_with_http_info(project_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_project_usage_summary ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UsageApi.get_project_usage_summary" end # resource path local_var_path = '/api/usage/projects/{projectId}/summary'.sub('{' + 'projectId' + '}', CGI.escape(project_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']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ProjectUsageSummaryResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"UsageApi.get_project_usage_summary", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_project_usage_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage(opts = {}) ⇒ UsageStatsResponse
Get organization usage
218 219 220 221 |
# File 'lib/mudbase/api/usage_api.rb', line 218 def get_usage(opts = {}) data, _status_code, _headers = get_usage_with_http_info(opts) data end |
#get_usage_trends(opts = {}) ⇒ UsageTrendsResponse
Get usage trends Get usage trends over time for the authenticated organization or project. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
285 286 287 288 |
# File 'lib/mudbase/api/usage_api.rb', line 285 def get_usage_trends(opts = {}) data, _status_code, _headers = get_usage_trends_with_http_info(opts) data end |
#get_usage_trends_with_http_info(opts = {}) ⇒ Array<(UsageTrendsResponse, Integer, Hash)>
Get usage trends Get usage trends over time for the authenticated organization or project. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/mudbase/api/usage_api.rb', line 295 def get_usage_trends_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_usage_trends ...' end # resource path local_var_path = '/api/usage/trends' # query parameters query_params = opts[:query_params] || {} query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UsageTrendsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"UsageApi.get_usage_trends", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_usage_trends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage_warnings(opts = {}) ⇒ GetUsageWarnings200Response
Get usage warnings Returns usage warnings for the authenticated org (e.g. at 80% and 95% of plan limits). Requires org-level JWT.
344 345 346 347 |
# File 'lib/mudbase/api/usage_api.rb', line 344 def get_usage_warnings(opts = {}) data, _status_code, _headers = get_usage_warnings_with_http_info(opts) data end |
#get_usage_warnings_with_http_info(opts = {}) ⇒ Array<(GetUsageWarnings200Response, Integer, Hash)>
Get usage warnings Returns usage warnings for the authenticated org (e.g. at 80% and 95% of plan limits). Requires org-level JWT.
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/mudbase/api/usage_api.rb', line 353 def get_usage_warnings_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_usage_warnings ...' end # resource path local_var_path = '/api/usage/warnings' # 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']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetUsageWarnings200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth'] = opts.merge( :operation => :"UsageApi.get_usage_warnings", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_usage_warnings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage_with_http_info(opts = {}) ⇒ Array<(UsageStatsResponse, Integer, Hash)>
Get organization usage
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/mudbase/api/usage_api.rb', line 229 def get_usage_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsageApi.get_usage ...' end allowable_values = ["day", "week", "month", "year"] if @api_client.config.client_side_validation && opts[:'period'] && !allowable_values.include?(opts[:'period']) fail ArgumentError, "invalid value for \"period\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/usage' # query parameters query_params = opts[:query_params] || {} query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UsageStatsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"UsageApi.get_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#get_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |