Skip to content

Latest commit

 

History

History
266 lines (188 loc) · 7.42 KB

File metadata and controls

266 lines (188 loc) · 7.42 KB

BillaBear.UsageApi

All URIs are relative to https://{customerId}.billabear.cloud/api/v1

Method HTTP request Description
createCustomerUsageLimit POST /customer/{customerId}/uasge-limit Create Usage Limit
createEvent POST /events Create Event
customerCustomerIdUasgeLimitLimitIdDelete DELETE /customer/{customerId}/uasge-limit/{limitId} Delete Usage Limit
getCustomerCosts GET /customer/{customerId}/costs Usage Cost Estimate
getCustomerUsageLimitsById GET /customer/{customerId}/uasge-limit Fetch Customer Usage Limits

createCustomerUsageLimit

UsageLimit createCustomerUsageLimit(body, customerId)

Create Usage Limit

Create Usage Limit for the custoemr

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.UsageApi();
let body = new BillaBear.CustomerIdUasgelimitBody(); // CustomerIdUasgelimitBody | 
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.createCustomerUsageLimit(body, customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body CustomerIdUasgelimitBody
customerId String The id of the customer to retrieve

Return type

UsageLimit

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createEvent

createEvent(body)

Create Event

Creates an event that is used for usage billing

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.UsageApi();
let body = new BillaBear.Event(); // Event | 

apiInstance.createEvent(body, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
body Event

Return type

null (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customerCustomerIdUasgeLimitLimitIdDelete

customerCustomerIdUasgeLimitLimitIdDelete(customerId, usageLimitId)

Delete Usage Limit

Delete Usage Limit for the custoemr

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.UsageApi();
let customerId = "customerId_example"; // String | The id of the customer to retrieve
let usageLimitId = "usageLimitId_example"; // String | The id of the usage limit

apiInstance.customerCustomerIdUasgeLimitLimitIdDelete(customerId, usageLimitId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve
usageLimitId String The id of the usage limit

Return type

null (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getCustomerCosts

InlineResponse2001 getCustomerCosts(customerId)

Usage Cost Estimate

The estimated costs from usage based billing for a customer

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.UsageApi();
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.getCustomerCosts(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2001

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getCustomerUsageLimitsById

InlineResponse2005 getCustomerUsageLimitsById(customerId)

Fetch Customer Usage Limits

Usage Limits for a specific customer

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.UsageApi();
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.getCustomerUsageLimitsById(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2005

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json