Skip to content

Latest commit

 

History

History
284 lines (206 loc) · 9.57 KB

UsageApi.md

File metadata and controls

284 lines (206 loc) · 9.57 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

\BillaBear\Model\UsageLimit createCustomerUsageLimit($body, $customer_id)

Create Usage Limit

Create Usage Limit for the custoemr

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = BillaBear\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BillaBear\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

$apiInstance = new BillaBear\Api\UsageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \BillaBear\Model\CustomerIdUasgelimitBody(); // \BillaBear\Model\CustomerIdUasgelimitBody | 
$customer_id = "customer_id_example"; // string | The id of the customer to retrieve

try {
    $result = $apiInstance->createCustomerUsageLimit($body, $customer_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UsageApi->createCustomerUsageLimit: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
body \BillaBear\Model\CustomerIdUasgelimitBody
customer_id string The id of the customer to retrieve

Return type

\BillaBear\Model\UsageLimit

Authorization

ApiKeyAuth

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createEvent

createEvent($body)

Create Event

Creates an event that is used for usage billing

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = BillaBear\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BillaBear\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

$apiInstance = new BillaBear\Api\UsageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \BillaBear\Model\Event(); // \BillaBear\Model\Event | 

try {
    $apiInstance->createEvent($body);
} catch (Exception $e) {
    echo 'Exception when calling UsageApi->createEvent: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
body \BillaBear\Model\Event

Return type

void (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

customerCustomerIdUasgeLimitLimitIdDelete

customerCustomerIdUasgeLimitLimitIdDelete($customer_id, $usage_limit_id)

Delete Usage Limit

Delete Usage Limit for the custoemr

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = BillaBear\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BillaBear\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

$apiInstance = new BillaBear\Api\UsageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$customer_id = "customer_id_example"; // string | The id of the customer to retrieve
$usage_limit_id = "usage_limit_id_example"; // string | The id of the usage limit

try {
    $apiInstance->customerCustomerIdUasgeLimitLimitIdDelete($customer_id, $usage_limit_id);
} catch (Exception $e) {
    echo 'Exception when calling UsageApi->customerCustomerIdUasgeLimitLimitIdDelete: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
customer_id string The id of the customer to retrieve
usage_limit_id string The id of the usage limit

Return type

void (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getCustomerCosts

\BillaBear\Model\InlineResponse2001 getCustomerCosts($customer_id)

Usage Cost Estimate

The estimated costs from usage based billing for a customer

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = BillaBear\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BillaBear\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

$apiInstance = new BillaBear\Api\UsageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$customer_id = "customer_id_example"; // string | The id of the customer to retrieve

try {
    $result = $apiInstance->getCustomerCosts($customer_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UsageApi->getCustomerCosts: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
customer_id string The id of the customer to retrieve

Return type

\BillaBear\Model\InlineResponse2001

Authorization

ApiKeyAuth

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getCustomerUsageLimitsById

\BillaBear\Model\InlineResponse2005 getCustomerUsageLimitsById($customer_id)

Fetch Customer Usage Limits

Usage Limits for a specific customer

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = BillaBear\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = BillaBear\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

$apiInstance = new BillaBear\Api\UsageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$customer_id = "customer_id_example"; // string | The id of the customer to retrieve

try {
    $result = $apiInstance->getCustomerUsageLimitsById($customer_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UsageApi->getCustomerUsageLimitsById: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
customer_id string The id of the customer to retrieve

Return type

\BillaBear\Model\InlineResponse2005

Authorization

ApiKeyAuth

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]