Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Latest commit

 

History

History
461 lines (331 loc) · 15.2 KB

BillableMetricsApi.md

File metadata and controls

461 lines (331 loc) · 15.2 KB

BillableMetricsApi

All URIs are relative to https://api.getlago.com/api/v1

Method HTTP request Description
createBillableMetric POST /billable_metrics Create a billable metric
destroyBillableMetric DELETE /billable_metrics/{code} Delete a billable metric
findAllBillableMetricGroups GET /billable_metrics/{code}/groups Find a billable metric's groups
findAllBillableMetrics GET /billable_metrics List all billable metrics
findBillableMetric GET /billable_metrics/{code} Retrieve a billable metric
updateBillableMetric PUT /billable_metrics/{code} Update a billable metric

createBillableMetric

BillableMetric createBillableMetric(billableMetricCreateInput)

Create a billable metric

This endpoint creates a new billable metric representing a pricing component of your application.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        BillableMetricCreateInput billableMetricCreateInput = new BillableMetricCreateInput(); // BillableMetricCreateInput | Billable metric payload
        try {
            BillableMetric result = apiInstance.createBillableMetric(billableMetricCreateInput);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#createBillableMetric");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
billableMetricCreateInput BillableMetricCreateInput Billable metric payload

Return type

BillableMetric

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Billable metric created -
400 Bad Request error -
401 Unauthorized error -
422 Unprocessable entity error -

destroyBillableMetric

BillableMetric destroyBillableMetric(code)

Delete a billable metric

This endpoint deletes an existing billable metric representing a pricing component of your application.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        String code = "storage"; // String | Code of the existing billable metric.
        try {
            BillableMetric result = apiInstance.destroyBillableMetric(code);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#destroyBillableMetric");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
code String Code of the existing billable metric.

Return type

BillableMetric

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Billable metric deleted -
401 Unauthorized error -
404 Not Found error -

findAllBillableMetricGroups

GroupsPaginated findAllBillableMetricGroups(code, page, perPage)

Find a billable metric's groups

This endpoint retrieves all groups for a billable metric.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        String code = "example_code"; // String | Code of the existing billable metric.
        Integer page = 1; // Integer | Page number.
        Integer perPage = 20; // Integer | Number of records per page.
        try {
            GroupsPaginated result = apiInstance.findAllBillableMetricGroups(code, page, perPage);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#findAllBillableMetricGroups");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
code String Code of the existing billable metric.
page Integer Page number. [optional]
perPage Integer Number of records per page. [optional]

Return type

GroupsPaginated

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List of billable metric's groups -
401 Unauthorized error -

findAllBillableMetrics

BillableMetricsPaginated findAllBillableMetrics(page, perPage)

List all billable metrics

This endpoint retrieves all existing billable metrics that represent pricing components of your application.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        Integer page = 1; // Integer | Page number.
        Integer perPage = 20; // Integer | Number of records per page.
        try {
            BillableMetricsPaginated result = apiInstance.findAllBillableMetrics(page, perPage);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#findAllBillableMetrics");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
page Integer Page number. [optional]
perPage Integer Number of records per page. [optional]

Return type

BillableMetricsPaginated

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List of billable metrics -
401 Unauthorized error -

findBillableMetric

BillableMetric findBillableMetric(code)

Retrieve a billable metric

This endpoint retrieves an existing billable metric that represents a pricing component of your application. The billable metric is identified by its unique code.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        String code = "storage"; // String | Code of the existing billable metric.
        try {
            BillableMetric result = apiInstance.findBillableMetric(code);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#findBillableMetric");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
code String Code of the existing billable metric.

Return type

BillableMetric

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Billable metric -
401 Unauthorized error -
404 Not Found error -

updateBillableMetric

BillableMetric updateBillableMetric(code, billableMetricUpdateInput)

Update a billable metric

This endpoint updates an existing billable metric representing a pricing component of your application.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.BillableMetricsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        BillableMetricsApi apiInstance = new BillableMetricsApi(defaultClient);
        String code = "storage"; // String | Code of the existing billable metric.
        BillableMetricUpdateInput billableMetricUpdateInput = new BillableMetricUpdateInput(); // BillableMetricUpdateInput | Billable metric payload
        try {
            BillableMetric result = apiInstance.updateBillableMetric(code, billableMetricUpdateInput);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BillableMetricsApi#updateBillableMetric");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
code String Code of the existing billable metric.
billableMetricUpdateInput BillableMetricUpdateInput Billable metric payload

Return type

BillableMetric

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Billable metric updated -
400 Bad Request error -
401 Unauthorized error -
404 Not Found error -
422 Unprocessable entity error -