# README
Revenium Metering SDK for Go
Overview
Go SDK for Revenium Metering API. This SDK allows you to dispatch metering metadata for API calls to Revenium.
For more information, please visit https://revenium.io
Installation
go get -u github.com/hypercurrentio/[email protected]
Example
package main
import (
"context"
metering "github.com/hypercurrentio/revenium-metering-go"
"os"
)
func main() {
cfg := metering.NewConfiguration()
cfg.BasePath = "https://api.revenium.io/meter/v1/api"
cfg.DefaultHeader["x-api-key"] = os.Getenv("REVENIUM_API_KEY")
apiClient := metering.NewAPIClient(cfg)
request := metering.MeteringRequestDto{
Method: "GET",
Url: "https://api.weyland-yutani.io/request",
Application: "d9680f8e-1ec2-4f24-892d-99b779224604",
ResponseCode: 200,
RemoteHost: "5.103.132.56",
BackendLatency: 10,
GatewayLatency: 10,
Source: "SDK_GOLANG",
RequestHeaders: []string{},
ResponseHeaders: []string{},
Elements: []metering.ElementDto{},
}
_, _, err := apiClient.MeteringApi.Meter(context.Background(), request)
if err != nil {
panic(err)
}
println("API request successfully metered")
}
Documentation for API Endpoints
All URIs are relative to https://api.revenium.io/meter/v1/api
Class | Method | HTTP request | Description |
---|---|---|---|
EventsApi | SaveEvent | Post /event | Save can API event |
MeteringApi | Meter | Post /meter | Insert API metering data |
MeteringApi | Valid | Get /meter/product-key | Determine if a ProductKey is valid or not |
Documentation For Models
Author
# Functions
CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
# Structs
APIClient manages communication with the Revenium Metering API API v1.14.0-SNAPSHOT In most cases there should be only one, shared, APIClient.
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
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
No description provided by the author
Dynamic metering elements.
GenericSwaggerError Provides access to the body, error and model on returned errors.
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author