Skip to content

zuora/togai-java-client

Repository files navigation

togai-java-client

Togai Apis

  • API version: 1.0

APIs for Togai App

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.togai</groupId>
  <artifactId>togai-java-client</artifactId>
  <version>1.0.2</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'togai-java-client' jar has been published to maven central.
    mavenLocal()       // Needed if the 'togai-java-client' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.togai:togai-java-client:1.0.2"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/togai-java-client-1.0.2.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.togai.client.ApiClient;
import com.togai.client.ApiException;
import com.togai.client.Configuration;
import com.togai.client.auth.*;
import com.togai.client.models.*;
import com.togai.client.api.AccountsApi;

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

    AccountsApi apiInstance = new AccountsApi(defaultClient);
    String customerId = "customerId_example"; // String | 
    String accountId = "accountId_example"; // String | account_id corresponding to an account
    AddAccountAliasesRequest addAccountAliasesRequest = new AddAccountAliasesRequest(); // AddAccountAliasesRequest | Payload to add aliases to account
    try {
      Account result = apiInstance.addAliases(customerId, accountId, addAccountAliasesRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccountsApi#addAliases");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to https://api.togai.com

Class Method HTTP request Description
AccountsApi addAliases POST /customers/{customer_id}/accounts/{account_id}/add_aliases Add Aliases to account
AccountsApi createAccount POST /customers/{customer_id}/accounts Create an account
AccountsApi deleteAccount DELETE /customers/{customer_id}/accounts/{account_id} Delete an account
AccountsApi getAccount GET /customers/{customer_id}/accounts/{account_id} Get an account
AccountsApi getAccounts GET /customers/{customer_id}/accounts List accounts of customer
AccountsApi removeAliases POST /customers/{customer_id}/accounts/{account_id}/remove_aliases Remove Aliases to account
AccountsApi updateAccount PATCH /customers/{customer_id}/accounts/{account_id} Update an account
AccountsApi updatePricingSchedule POST /customers/{customer_id}/accounts/{account_id}/price_plans Dis/associate a plan from/to an account
AddOnsApi createAddOn POST /addons Create an AddOn
AddOnsApi deleteAddOn DELETE /addons/{addon_id} Delete an addon
AddOnsApi getAddOn GET /addons/{addon_id} Get an addon
AddOnsApi getAddOns GET /addons List addOns
AddOnsApi updateAddOn PATCH /addons/{addon_id} Update an addon
CreditsApi createCredit POST /credits Grant credit
CreditsApi creditBalanceForAccount GET /accounts/{account_id}/credit_balance Credit balance for Account
CreditsApi getCreditDetails GET /credits/{credit_id} Get credit details
CreditsApi listCredits GET /credits List credits
CreditsApi voidCredit POST /credits/{credit_id}/void Void credit
CustomersApi createCustomer POST /customers Create a customer
CustomersApi deleteCustomer DELETE /customers/{customer_id} Delete a customer
CustomersApi getCustomer GET /customers/{customer_id} Get a customer
CustomersApi getCustomers GET /customers List customers
CustomersApi updateCustomer PATCH /customers/{customer_id} Update a customer
EventIngestionApi ingest POST /ingest Ingest events to Togai
EventIngestionApi ingestBatch POST /ingestBatch Ingest events to Togai in batch
EventManagementApi getEvents GET /events Get a list of usage events with multiple query options
EventManagementApi getSingleEvent GET /events/{event_id} Get an usage event using event id
EventSchemasApi activateEventSchema POST /event_schema/{event_schema_name}/activate Activate an event schema
EventSchemasApi createEventSchema POST /event_schema Create an event schema
EventSchemasApi deactivateEventSchema POST /event_schema/{event_schema_name}/deactivate Deactivate an event schema
EventSchemasApi deleteEventSchema DELETE /event_schema/{event_schema_name} Delete an event schema
EventSchemasApi eventSchemaEventSchemaNamePatch PATCH /event_schema/{event_schema_name} Update an event schema
EventSchemasApi getEventSchema GET /event_schema/{event_schema_name} Get an event schema
EventSchemasApi listEventSchemaVersions GET /event_schema/{event_schema_name}/versions List all event schema versions
EventSchemasApi listEventSchemas GET /event_schema List event schemas
InvoicesApi getInvoice GET /invoices/{invoice_id} Get an invoice
InvoicesApi listInvoices GET /invoices List invoices
MetricsApi getMetrics POST /metrics Get Togai Metrics
MiscellaneousApi calculateRevenue POST /revenue_calculator Calculate and return the revenue for a existing or new price plan
PricePlansApi activatePricePlan POST /price_plans/{price_plan_id}/activate Activate a price plan
PricePlansApi addCurrencyToPricePlan POST /price_plans/{price_plan_id}/currencies Add currencies to a price plan
PricePlansApi createPricePlan POST /price_plans Create a price plan
PricePlansApi getPricePlan GET /price_plans/{price_plan_id} Get a price plan
PricePlansApi getPricePlans GET /price_plans List price plans
PricePlansApi removeCurrencyFromPricePlan DELETE /price_plans/{price_plan_id}/currencies/{currency_id} Remove a draft currency from a price plan
PricePlansApi updatePricePlan PATCH /price_plans/{price_plan_id} Update a price plan
SettingsApi getSetting GET /settings/{setting_id_str} Get a setting
SettingsApi insertSetting POST /settings Create a setting
SettingsApi listSetting GET /settings Lists settings
SettingsApi updateSetting PATCH /settings/{setting_id_str} Update a setting
UsageMetersApi activateUsageMeter POST /event_schema/{event_schema_name}/usage_meters/{usage_meter_id}/activate Activate usage meter
UsageMetersApi createUsageMeter POST /event_schema/{event_schema_name}/usage_meters Create an usage meter
UsageMetersApi deactivateUsageMeter POST /event_schema/{event_schema_name}/usage_meters/{usage_meter_id}/deactivate Deactivate usage meter
UsageMetersApi getUsageMeter GET /event_schema/{event_schema_name}/usage_meters/{usage_meter_id} Get usage meter
UsageMetersApi getUsageMetersForEventSchema GET /event_schema/{event_schema_name}/usage_meters List usage meters for event schema
UsageMetersApi updateUsageMeter PATCH /event_schema/{event_schema_name}/usage_meters/{usage_meter_id} Update an usage meter

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: HTTP basic authentication

apiKeyAuth

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

[email protected]