package
2.0.1
Repository: https://github.com/kable-io/kable-go.git
Documentation: pkg.go.dev

# README

Go API client for openapi

The Kable API allows developers to manage customers and API keys and record events about their API.

API Host and Environments

Kable is accessible in Live and Test environments for authentication and metering of client API requests. You will have separate API keys to access each environment.

You should only use Kable's Live environment for your own production data. All other configured environments should use Kable's Test environment.

API Protocols and Headers

All requests to the Kable API are made over HTTPS TLS v1.2+ to ensure security. Calls made over HTTP will fail. Any requests without proper authentication will also fail.

The Kable API uses standard JSON for requests and responses. Be sure to set both the Content-Type and Accept headers on each request to application/json.

Each Kable API response includes a requestId as the X-REQUEST-ID response header. The requestId is included regardless whether the API request succeeded or failed. You can use this requestId to help with debugging or when contacting support regarding a specific API call.

API Keys

There are two types of API keys on Kable.

Kable Keys

Kable Keys are the keys you, the Kable customer, use to interact with Kable. These keys help us ensure that only you are interacting with Kable on your behalf. You can find your keys on the Company page of the dashboard after you sign up.

Kable Keys should be included in every request to the Kable API. You must provide your client ID as the KABLE-CLIENT-ID header and your secret key as the KABLE-CLIENT-SECRET header on each request to Kable. If you are using a language-specific Kable library, you will initialize the SDK using these keys.

Customer Keys

Customer Keys are the keys your customers use to interact with your API. Customer Keys are authenticated by Kable when a customer makes a request to your API if you use Kable's authentication services. Customers must provide their client ID (defined as clientId when you create the customer) as the X-CLIENT-ID header and their secret key as the X-API-KEY header on each request to your API that Kable is to authenticate.

API Versioning

All Kable endpoints are versioned. After the host, each API can be found at /api/vX/... where X is the API version.

We strive to ensure that changes to the Kable API are backward compatible. Sometimes, though, we must break from older design paradigms to make the product better. When this happens, a new version of the API is released.

The current version of Kable is v1.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.2.1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/GIT_USER_ID/GIT_REPO_ID/openapi"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://live.kable.io/api/v1

ClassMethodHTTP requestDescription
CreditGrantsApiCreateCreditGrantPost /customers/{customerId}/credits/createcreate a new credit grant for a customer
CreditGrantsApiGetCustomerCreditBalanceGet /customers/{customerId}/credits/balanceget a customer's credit balance
CustomersApiAddCustomerPaymentMethodPost /customers/{customerId}/payment_methods/addadd a customer payment method
CustomersApiAddCustomerPlansPost /customers/{customerId}/plans/addadd a plan(s) to a customer
CustomersApiCancelCustomerPost /customers/{customerId}/cancelcancel a customer
CustomersApiCreateCustomerPost /customers/createcreate a customer
CustomersApiDeleteCustomerPost /customers/{customerId}/deletedelete a customer
CustomersApiGetAllCustomersGet /customersget all customers
CustomersApiGetCustomerGet /customers/{customerId}get customer
CustomersApiRemoveCustomerPlansPost /customers/{customerId}/plans/removeremove a plan(s) from a customer
CustomersApiUpdateCustomerPost /customers/{customerId}/updateupdate a customer
DimensionsApiCreateDimensionPost /dimensions/createcreate a dimension
DimensionsApiDeleteDimensionPost /dimensions/{dimensionId}/deletedelete a dimension
DimensionsApiGetAllDimensionsGet /dimensionsget all dimensions
DimensionsApiGetDimensionGet /dimensions/{dimensionId}get dimension
DimensionsApiUpdateDimensionPost /dimensions/{dimensionId}/updateupdate a dimension
EventsApiCreateEventsPost /events/createrecord events
PlansApiCreatePlanPost /plans/createcreate a plan
PlansApiDeletePlanPost /plans/{planId}/deletedelete a plan
PlansApiGetAllPlansGet /plansget all plans
PlansApiGetPlanGet /plans/{planId}get plan
PlansApiUpdatePlanPost /plans/{planId}/updateupdate a plan
TokensApiCreateTokenPost /tokens/createcreate a token
UsageApiGetUsagePost /usage/getget usage metrics

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAddCustomerPaymentMethod200Response instantiates a new AddCustomerPaymentMethod200Response object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewAddCustomerPaymentMethod200ResponseWithDefaults instantiates a new AddCustomerPaymentMethod200Response object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewAddCustomerPaymentMethodRequest instantiates a new AddCustomerPaymentMethodRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewAddCustomerPaymentMethodRequestWithDefaults instantiates a new AddCustomerPaymentMethodRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewAddCustomerPlansRequest instantiates a new AddCustomerPlansRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewAddCustomerPlansRequestWithDefaults instantiates a new AddCustomerPlansRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResponse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.
NewCreateCreditGrantRequest instantiates a new CreateCreditGrantRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateCreditGrantRequestWithDefaults instantiates a new CreateCreditGrantRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateCustomer200Response instantiates a new CreateCustomer200Response object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateCustomer200ResponseWithDefaults instantiates a new CreateCustomer200Response object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateCustomerRequest instantiates a new CreateCustomerRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateCustomerRequestWithDefaults instantiates a new CreateCustomerRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateDimensionRequest instantiates a new CreateDimensionRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateDimensionRequestWithDefaults instantiates a new CreateDimensionRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateKey200Response instantiates a new CreateKey200Response object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateKey200ResponseWithDefaults instantiates a new CreateKey200Response object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateKeyRequest instantiates a new CreateKeyRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateKeyRequestWithDefaults instantiates a new CreateKeyRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreatePlanRequest instantiates a new CreatePlanRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreatePlanRequestWithDefaults instantiates a new CreatePlanRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateToken200Response instantiates a new CreateToken200Response object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateToken200ResponseWithDefaults instantiates a new CreateToken200Response object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateTokenRequest instantiates a new CreateTokenRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateTokenRequestWithDefaults instantiates a new CreateTokenRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreditGrant instantiates a new CreditGrant object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreditGrantWithDefaults instantiates a new CreditGrant object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCustomer instantiates a new Customer object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCustomerPlan instantiates a new CustomerPlan object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCustomerPlanWithDefaults instantiates a new CustomerPlan object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCustomerWithDefaults instantiates a new Customer object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewDimension instantiates a new Dimension object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewDimensionWithDefaults instantiates a new Dimension object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewEvent instantiates a new Event object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewEventWithDefaults instantiates a new Event object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetCustomerCreditBalance200Response instantiates a new GetCustomerCreditBalance200Response object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetCustomerCreditBalance200ResponseWithDefaults instantiates a new GetCustomerCreditBalance200Response object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetUsageRequest instantiates a new GetUsageRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetUsageRequestWithDefaults instantiates a new GetUsageRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewKey instantiates a new Key object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewKeyWithDefaults instantiates a new Key object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewPlan instantiates a new Plan object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPlanWithDefaults instantiates a new Plan object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewPrice instantiates a new Price object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPriceTier instantiates a new PriceTier object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPriceTierWithDefaults instantiates a new PriceTier object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewPriceWithDefaults instantiates a new Price object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewRevokeKeyRequest instantiates a new RevokeKeyRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewRevokeKeyRequestWithDefaults instantiates a new RevokeKeyRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUpdateCustomerRequest instantiates a new UpdateCustomerRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUpdateCustomerRequestWithDefaults instantiates a new UpdateCustomerRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUpdateDimensionRequest instantiates a new UpdateDimensionRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUpdateDimensionRequestWithDefaults instantiates a new UpdateDimensionRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUpdatePlanRequest instantiates a new UpdatePlanRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUpdatePlanRequestWithDefaults instantiates a new UpdatePlanRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUsageMetricInterval instantiates a new UsageMetricInterval object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUsageMetricIntervalWithDefaults instantiates a new UsageMetricInterval object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUsageMetricResponse instantiates a new UsageMetricResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUsageMetricResponseWithDefaults instantiates a new UsageMetricResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
PtrBool is a helper routine that returns a pointer to given boolean value.
PtrFloat32 is a helper routine that returns a pointer to given float value.
PtrFloat64 is a helper routine that returns a pointer to given float value.
PtrInt is a helper routine that returns a pointer to given integer value.
PtrInt32 is a helper routine that returns a pointer to given integer value.
PtrInt64 is a helper routine that returns a pointer to given integer value.
PtrString is a helper routine that returns a pointer to given string value.
PtrTime is helper routine that returns a pointer to given Time value.

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKeys takes a string apikey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextServerIndex uses a server configuration from the index.
ContextServerVariables overrides a server configuration variables.

# Structs

AddCustomerPaymentMethod200Response struct for AddCustomerPaymentMethod200Response.
AddCustomerPaymentMethodRequest struct for AddCustomerPaymentMethodRequest.
AddCustomerPlansRequest struct for AddCustomerPlansRequest.
No description provided by the author
No description provided by the author
No description provided by the author
APIClient manages communication with the Kable API API v1.2.1 In most cases there should be only one, shared, APIClient.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
APIResponse stores the API response returned by the server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
Configuration stores the configuration of the API client.
CreateCreditGrantRequest struct for CreateCreditGrantRequest.
CreateCustomer200Response struct for CreateCustomer200Response.
CreateCustomerRequest struct for CreateCustomerRequest.
CreateDimensionRequest struct for CreateDimensionRequest.
CreateKey200Response struct for CreateKey200Response.
CreateKeyRequest struct for CreateKeyRequest.
CreatePlanRequest struct for CreatePlanRequest.
CreateToken200Response struct for CreateToken200Response.
CreateTokenRequest struct for CreateTokenRequest.
CreditGrant struct for CreditGrant.
Customer struct for Customer.
CustomerPlan struct for CustomerPlan.
Dimension struct for Dimension.
Event struct for Event.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
GetCustomerCreditBalance200Response struct for GetCustomerCreditBalance200Response.
GetUsageRequest struct for GetUsageRequest.
Key struct for Key.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Plan struct for Plan.
Price struct for Price.
PriceTier struct for PriceTier.
RevokeKeyRequest struct for RevokeKeyRequest.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
UpdateCustomerRequest struct for UpdateCustomerRequest.
UpdateDimensionRequest struct for UpdateDimensionRequest.
UpdatePlanRequest struct for UpdatePlanRequest.
UsageMetricInterval struct for UsageMetricInterval.
UsageMetricResponse struct for UsageMetricResponse.

# Type aliases

CreditGrantsApiService CreditGrantsApi service.
CustomersApiService CustomersApi service.
DimensionsApiService DimensionsApi service.
EventsApiService EventsApi service.
KeysApiService KeysApi service.
PlansApiService PlansApi service.
ServerConfigurations stores multiple ServerConfiguration items.
TokensApiService TokensApi service.
UsageApiService UsageApi service.