openmeter

package
v1.0.0-beta.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 2

README

OpenMeter Go SDK

Install

go get github.com/openmeterio/openmeter/api/client/go

Usage

Initialize client.

import (
  cloudevents "github.com/cloudevents/sdk-go/v2/event"
  om "github.com/openmeterio/openmeter/api/client/go"
)

func main() {
  // Initialize OpenMeter client
  om, err := openmeter.NewClientWithResponses("http://localhost:8888")
  if err != nil {
      panic(err.Error())
  }

  // Use OpenMeter client
  // ...
}
Ingest Event

Report usage to OpenMeter.

e := cloudevents.New()
e.SetID("00001")
e.SetSource("my-app")
e.SetType("tokens")
e.SetSubject("user-id")
e.SetTime(time.Now())
e.SetData("application/json", map[string]string{
  "tokens": "15",
  "model": "gpt-4",
})

_, err := client.IngestEventWithResponse(ctx, e)
Query Meter

Retreive usage from OpenMeter.

slug := "token-usage"
subject := []string{"user-id"}
from, _ := time.Parse(time.RFC3339, "2023-01-01T00:00:00Z")
to, _ := time.Parse(time.RFC3339, "2023-01-02T00:00:00Z")
resp, _ := client.QueryMeterWithResponse(ctx, slug, &om.QueryMeterParams{
    Subject: &subject,
    From:    &from,
    To:      &to,
})
// resp.JSON200.Data

Documentation

Overview

Package openmeter provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

View Source
const (
	PortalTokenScopes = "portalToken.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func NewCreateMeterRequest

func NewCreateMeterRequest(server string, body CreateMeterJSONRequestBody) (*http.Request, error)

NewCreateMeterRequest calls the generic CreateMeter builder with application/json body

func NewCreateMeterRequestWithBody

func NewCreateMeterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateMeterRequestWithBody generates requests for CreateMeter with any type of body

func NewCreatePortalTokenRequest

func NewCreatePortalTokenRequest(server string, body CreatePortalTokenJSONRequestBody) (*http.Request, error)

NewCreatePortalTokenRequest calls the generic CreatePortalToken builder with application/json body

func NewCreatePortalTokenRequestWithBody

func NewCreatePortalTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreatePortalTokenRequestWithBody generates requests for CreatePortalToken with any type of body

func NewDeleteMeterRequest

func NewDeleteMeterRequest(server string, meterIdOrSlug MeterIdOrSlug) (*http.Request, error)

NewDeleteMeterRequest generates requests for DeleteMeter

func NewGetMeterRequest

func NewGetMeterRequest(server string, meterIdOrSlug MeterIdOrSlug) (*http.Request, error)

NewGetMeterRequest generates requests for GetMeter

func NewIngestEventsRequestWithApplicationCloudeventsBatchPlusJSONBody

func NewIngestEventsRequestWithApplicationCloudeventsBatchPlusJSONBody(server string, body IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody) (*http.Request, error)

NewIngestEventsRequestWithApplicationCloudeventsBatchPlusJSONBody calls the generic IngestEvents builder with application/cloudevents-batch+json body

func NewIngestEventsRequestWithApplicationCloudeventsPlusJSONBody

func NewIngestEventsRequestWithApplicationCloudeventsPlusJSONBody(server string, body IngestEventsApplicationCloudeventsPlusJSONRequestBody) (*http.Request, error)

NewIngestEventsRequestWithApplicationCloudeventsPlusJSONBody calls the generic IngestEvents builder with application/cloudevents+json body

func NewIngestEventsRequestWithBody

func NewIngestEventsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewIngestEventsRequestWithBody generates requests for IngestEvents with any type of body

func NewInvalidatePortalTokensRequest

func NewInvalidatePortalTokensRequest(server string, body InvalidatePortalTokensJSONRequestBody) (*http.Request, error)

NewInvalidatePortalTokensRequest calls the generic InvalidatePortalTokens builder with application/json body

func NewInvalidatePortalTokensRequestWithBody

func NewInvalidatePortalTokensRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewInvalidatePortalTokensRequestWithBody generates requests for InvalidatePortalTokens with any type of body

func NewListEventsRequest

func NewListEventsRequest(server string, params *ListEventsParams) (*http.Request, error)

NewListEventsRequest generates requests for ListEvents

func NewListMeterSubjectsRequest

func NewListMeterSubjectsRequest(server string, meterIdOrSlug MeterIdOrSlug) (*http.Request, error)

NewListMeterSubjectsRequest generates requests for ListMeterSubjects

func NewListMetersRequest

func NewListMetersRequest(server string) (*http.Request, error)

NewListMetersRequest generates requests for ListMeters

func NewQueryMeterRequest

func NewQueryMeterRequest(server string, meterIdOrSlug MeterIdOrSlug, params *QueryMeterParams) (*http.Request, error)

NewQueryMeterRequest generates requests for QueryMeter

func NewQueryPortalMeterRequest

func NewQueryPortalMeterRequest(server string, meterSlug string, params *QueryPortalMeterParams) (*http.Request, error)

NewQueryPortalMeterRequest generates requests for QueryPortalMeter

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type BadRequestProblemResponse

type BadRequestProblemResponse = Problem

BadRequestProblemResponse A Problem Details object (RFC 7807)

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewAuthClient

func NewAuthClient(server string, apiSecret string, opts ...ClientOption) (*Client, error)

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateMeter

func (c *Client) CreateMeter(ctx context.Context, body CreateMeterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateMeterWithBody

func (c *Client) CreateMeterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreatePortalToken

func (c *Client) CreatePortalToken(ctx context.Context, body CreatePortalTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreatePortalTokenWithBody

func (c *Client) CreatePortalTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) DeleteMeter

func (c *Client) DeleteMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetMeter

func (c *Client) GetMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) IngestEvent

func (c *Client) IngestEvent(ctx context.Context, event Event, reqEditors ...RequestEditorFn) (*http.Response, error)

IngestEvents is a wrapper around generated client's IngestEventsWithApplicationCloudeventsPlusJSONBody

func (*Client) IngestEventBatch

func (c *Client) IngestEventBatch(ctx context.Context, events []Event, reqEditors ...RequestEditorFn) (*http.Response, error)

IngestEvents is a wrapper around generated client's IngestEventsWithApplicationCloudeventsBatchPlusJSONBody

func (*Client) IngestEventsWithApplicationCloudeventsBatchPlusJSONBody

func (c *Client) IngestEventsWithApplicationCloudeventsBatchPlusJSONBody(ctx context.Context, body IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) IngestEventsWithApplicationCloudeventsPlusJSONBody

func (c *Client) IngestEventsWithApplicationCloudeventsPlusJSONBody(ctx context.Context, body IngestEventsApplicationCloudeventsPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) IngestEventsWithBody

func (c *Client) IngestEventsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) InvalidatePortalTokens

func (c *Client) InvalidatePortalTokens(ctx context.Context, body InvalidatePortalTokensJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) InvalidatePortalTokensWithBody

func (c *Client) InvalidatePortalTokensWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListEvents

func (c *Client) ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListMeterSubjects

func (c *Client) ListMeterSubjects(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListMeters

func (c *Client) ListMeters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) QueryMeter

func (c *Client) QueryMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, params *QueryMeterParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) QueryPortalMeter

func (c *Client) QueryPortalMeter(ctx context.Context, meterSlug string, params *QueryPortalMeterParams, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// ListEvents request
	ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// IngestEventsWithBody request with any body
	IngestEventsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	IngestEventsWithApplicationCloudeventsPlusJSONBody(ctx context.Context, body IngestEventsApplicationCloudeventsPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	IngestEventsWithApplicationCloudeventsBatchPlusJSONBody(ctx context.Context, body IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListMeters request
	ListMeters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateMeterWithBody request with any body
	CreateMeterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateMeter(ctx context.Context, body CreateMeterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteMeter request
	DeleteMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetMeter request
	GetMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

	// QueryMeter request
	QueryMeter(ctx context.Context, meterIdOrSlug MeterIdOrSlug, params *QueryMeterParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListMeterSubjects request
	ListMeterSubjects(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*http.Response, error)

	// QueryPortalMeter request
	QueryPortalMeter(ctx context.Context, meterSlug string, params *QueryPortalMeterParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreatePortalTokenWithBody request with any body
	CreatePortalTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreatePortalToken(ctx context.Context, body CreatePortalTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// InvalidatePortalTokensWithBody request with any body
	InvalidatePortalTokensWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	InvalidatePortalTokens(ctx context.Context, body InvalidatePortalTokensJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewAuthClientWithResponses

func NewAuthClientWithResponses(server string, apiSecret string, opts ...ClientOption) (*ClientWithResponses, error)

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CreateMeterWithBodyWithResponse

func (c *ClientWithResponses) CreateMeterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMeterResponse, error)

CreateMeterWithBodyWithResponse request with arbitrary body returning *CreateMeterResponse

func (*ClientWithResponses) CreateMeterWithResponse

func (c *ClientWithResponses) CreateMeterWithResponse(ctx context.Context, body CreateMeterJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMeterResponse, error)

func (*ClientWithResponses) CreatePortalTokenWithBodyWithResponse

func (c *ClientWithResponses) CreatePortalTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePortalTokenResponse, error)

CreatePortalTokenWithBodyWithResponse request with arbitrary body returning *CreatePortalTokenResponse

func (*ClientWithResponses) CreatePortalTokenWithResponse

func (c *ClientWithResponses) CreatePortalTokenWithResponse(ctx context.Context, body CreatePortalTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePortalTokenResponse, error)

func (*ClientWithResponses) DeleteMeterWithResponse

func (c *ClientWithResponses) DeleteMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*DeleteMeterResponse, error)

DeleteMeterWithResponse request returning *DeleteMeterResponse

func (*ClientWithResponses) GetMeterWithResponse

func (c *ClientWithResponses) GetMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*GetMeterResponse, error)

GetMeterWithResponse request returning *GetMeterResponse

func (*ClientWithResponses) IngestEventBatchWithResponse

func (c *ClientWithResponses) IngestEventBatchWithResponse(ctx context.Context, events []Event, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

IngestEventsWithResponse is a wrapper around generated client's IngestEventsWithApplicationCloudeventsBatchPlusJSONBodyWithResponse

func (*ClientWithResponses) IngestEventWithResponse

func (c *ClientWithResponses) IngestEventWithResponse(ctx context.Context, event Event, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

IngestEventsWithResponse is a wrapper around generated client's IngestEventsWithApplicationCloudeventsPlusJSONBodyWithResponse

func (*ClientWithResponses) IngestEventsWithApplicationCloudeventsBatchPlusJSONBodyWithResponse

func (c *ClientWithResponses) IngestEventsWithApplicationCloudeventsBatchPlusJSONBodyWithResponse(ctx context.Context, body IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

func (*ClientWithResponses) IngestEventsWithApplicationCloudeventsPlusJSONBodyWithResponse

func (c *ClientWithResponses) IngestEventsWithApplicationCloudeventsPlusJSONBodyWithResponse(ctx context.Context, body IngestEventsApplicationCloudeventsPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

func (*ClientWithResponses) IngestEventsWithBodyWithResponse

func (c *ClientWithResponses) IngestEventsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

IngestEventsWithBodyWithResponse request with arbitrary body returning *IngestEventsResponse

func (*ClientWithResponses) InvalidatePortalTokensWithBodyWithResponse

func (c *ClientWithResponses) InvalidatePortalTokensWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InvalidatePortalTokensResponse, error)

InvalidatePortalTokensWithBodyWithResponse request with arbitrary body returning *InvalidatePortalTokensResponse

func (*ClientWithResponses) InvalidatePortalTokensWithResponse

func (c *ClientWithResponses) InvalidatePortalTokensWithResponse(ctx context.Context, body InvalidatePortalTokensJSONRequestBody, reqEditors ...RequestEditorFn) (*InvalidatePortalTokensResponse, error)

func (*ClientWithResponses) ListEventsWithResponse

func (c *ClientWithResponses) ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)

ListEventsWithResponse request returning *ListEventsResponse

func (*ClientWithResponses) ListMeterSubjectsWithResponse

func (c *ClientWithResponses) ListMeterSubjectsWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*ListMeterSubjectsResponse, error)

ListMeterSubjectsWithResponse request returning *ListMeterSubjectsResponse

func (*ClientWithResponses) ListMetersWithResponse

func (c *ClientWithResponses) ListMetersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListMetersResponse, error)

ListMetersWithResponse request returning *ListMetersResponse

func (*ClientWithResponses) QueryMeterWithResponse

func (c *ClientWithResponses) QueryMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, params *QueryMeterParams, reqEditors ...RequestEditorFn) (*QueryMeterResponse, error)

QueryMeterWithResponse request returning *QueryMeterResponse

func (*ClientWithResponses) QueryPortalMeterWithResponse

func (c *ClientWithResponses) QueryPortalMeterWithResponse(ctx context.Context, meterSlug string, params *QueryPortalMeterParams, reqEditors ...RequestEditorFn) (*QueryPortalMeterResponse, error)

QueryPortalMeterWithResponse request returning *QueryPortalMeterResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListEventsWithResponse request
	ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)

	// IngestEventsWithBodyWithResponse request with any body
	IngestEventsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

	IngestEventsWithApplicationCloudeventsPlusJSONBodyWithResponse(ctx context.Context, body IngestEventsApplicationCloudeventsPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

	IngestEventsWithApplicationCloudeventsBatchPlusJSONBodyWithResponse(ctx context.Context, body IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)

	// ListMetersWithResponse request
	ListMetersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListMetersResponse, error)

	// CreateMeterWithBodyWithResponse request with any body
	CreateMeterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMeterResponse, error)

	CreateMeterWithResponse(ctx context.Context, body CreateMeterJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMeterResponse, error)

	// DeleteMeterWithResponse request
	DeleteMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*DeleteMeterResponse, error)

	// GetMeterWithResponse request
	GetMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*GetMeterResponse, error)

	// QueryMeterWithResponse request
	QueryMeterWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, params *QueryMeterParams, reqEditors ...RequestEditorFn) (*QueryMeterResponse, error)

	// ListMeterSubjectsWithResponse request
	ListMeterSubjectsWithResponse(ctx context.Context, meterIdOrSlug MeterIdOrSlug, reqEditors ...RequestEditorFn) (*ListMeterSubjectsResponse, error)

	// QueryPortalMeterWithResponse request
	QueryPortalMeterWithResponse(ctx context.Context, meterSlug string, params *QueryPortalMeterParams, reqEditors ...RequestEditorFn) (*QueryPortalMeterResponse, error)

	// CreatePortalTokenWithBodyWithResponse request with any body
	CreatePortalTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePortalTokenResponse, error)

	CreatePortalTokenWithResponse(ctx context.Context, body CreatePortalTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePortalTokenResponse, error)

	// InvalidatePortalTokensWithBodyWithResponse request with any body
	InvalidatePortalTokensWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InvalidatePortalTokensResponse, error)

	InvalidatePortalTokensWithResponse(ctx context.Context, body InvalidatePortalTokensJSONRequestBody, reqEditors ...RequestEditorFn) (*InvalidatePortalTokensResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateMeterJSONRequestBody

type CreateMeterJSONRequestBody = Meter

CreateMeterJSONRequestBody defines body for CreateMeter for application/json ContentType.

type CreateMeterResponse

type CreateMeterResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON201                       *Meter
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSON501     *NotImplementedProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseCreateMeterResponse

func ParseCreateMeterResponse(rsp *http.Response) (*CreateMeterResponse, error)

ParseCreateMeterResponse parses an HTTP response from a CreateMeterWithResponse call

func (CreateMeterResponse) Status

func (r CreateMeterResponse) Status() string

Status returns HTTPResponse.Status

func (CreateMeterResponse) StatusCode

func (r CreateMeterResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type CreatePortalTokenJSONRequestBody

type CreatePortalTokenJSONRequestBody = PortalToken

CreatePortalTokenJSONRequestBody defines body for CreatePortalToken for application/json ContentType.

type CreatePortalTokenResponse

type CreatePortalTokenResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *PortalToken
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseCreatePortalTokenResponse

func ParseCreatePortalTokenResponse(rsp *http.Response) (*CreatePortalTokenResponse, error)

ParseCreatePortalTokenResponse parses an HTTP response from a CreatePortalTokenWithResponse call

func (CreatePortalTokenResponse) Status

func (r CreatePortalTokenResponse) Status() string

Status returns HTTPResponse.Status

func (CreatePortalTokenResponse) StatusCode

func (r CreatePortalTokenResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeleteMeterResponse

type DeleteMeterResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	ApplicationproblemJSON404     *NotFoundProblemResponse
	ApplicationproblemJSON501     *NotImplementedProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseDeleteMeterResponse

func ParseDeleteMeterResponse(rsp *http.Response) (*DeleteMeterResponse, error)

ParseDeleteMeterResponse parses an HTTP response from a DeleteMeterWithResponse call

func (DeleteMeterResponse) Status

func (r DeleteMeterResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteMeterResponse) StatusCode

func (r DeleteMeterResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ErrResponse

type ErrResponse struct {
	Err error `json:"-"` // low-level runtime error

	StatusCode int    `json:"statusCode"`        // http response status code
	StatusText string `json:"status"`            // user-level status message
	AppCode    int64  `json:"code,omitempty"`    // application-specific error code
	Message    string `json:"message,omitempty"` // application-level error message, for debugging
}

ErrResponse renderer type for handling all sorts of errors. In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.

type Event

type Event = event.Event

Event CloudEvents Specification JSON Schema

type GetMeterResponse

type GetMeterResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *Meter
	ApplicationproblemJSON404     *NotFoundProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseGetMeterResponse

func ParseGetMeterResponse(rsp *http.Response) (*GetMeterResponse, error)

ParseGetMeterResponse parses an HTTP response from a GetMeterWithResponse call

func (GetMeterResponse) Status

func (r GetMeterResponse) Status() string

Status returns HTTPResponse.Status

func (GetMeterResponse) StatusCode

func (r GetMeterResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type IdOrSlug

type IdOrSlug = string

IdOrSlug defines model for IdOrSlug.

type IngestEventsApplicationCloudeventsBatchPlusJSONBody

type IngestEventsApplicationCloudeventsBatchPlusJSONBody = []Event

IngestEventsApplicationCloudeventsBatchPlusJSONBody defines parameters for IngestEvents.

type IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody

type IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody = IngestEventsApplicationCloudeventsBatchPlusJSONBody

IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody defines body for IngestEvents for application/cloudevents-batch+json ContentType.

type IngestEventsApplicationCloudeventsPlusJSONRequestBody

type IngestEventsApplicationCloudeventsPlusJSONRequestBody = Event

IngestEventsApplicationCloudeventsPlusJSONRequestBody defines body for IngestEvents for application/cloudevents+json ContentType.

type IngestEventsResponse

type IngestEventsResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseIngestEventsResponse

func ParseIngestEventsResponse(rsp *http.Response) (*IngestEventsResponse, error)

ParseIngestEventsResponse parses an HTTP response from a IngestEventsWithResponse call

func (IngestEventsResponse) Status

func (r IngestEventsResponse) Status() string

Status returns HTTPResponse.Status

func (IngestEventsResponse) StatusCode

func (r IngestEventsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type IngestedEvent

type IngestedEvent struct {
	// Event CloudEvents Specification JSON Schema
	Event           Event   `json:"event"`
	ValidationError *string `json:"validationError,omitempty"`
}

IngestedEvent defines model for IngestedEvent.

type InvalidatePortalTokensJSONBody

type InvalidatePortalTokensJSONBody struct {
	Subject *string `json:"subject,omitempty"`
}

InvalidatePortalTokensJSONBody defines parameters for InvalidatePortalTokens.

type InvalidatePortalTokensJSONRequestBody

type InvalidatePortalTokensJSONRequestBody InvalidatePortalTokensJSONBody

InvalidatePortalTokensJSONRequestBody defines body for InvalidatePortalTokens for application/json ContentType.

type InvalidatePortalTokensResponse

type InvalidatePortalTokensResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseInvalidatePortalTokensResponse

func ParseInvalidatePortalTokensResponse(rsp *http.Response) (*InvalidatePortalTokensResponse, error)

ParseInvalidatePortalTokensResponse parses an HTTP response from a InvalidatePortalTokensWithResponse call

func (InvalidatePortalTokensResponse) Status

Status returns HTTPResponse.Status

func (InvalidatePortalTokensResponse) StatusCode

func (r InvalidatePortalTokensResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListEventsParams

type ListEventsParams struct {
	// From Start date-time in RFC 3339 format.
	// Inclusive.
	From *QueryFrom `form:"from,omitempty" json:"from,omitempty"`

	// To End date-time in RFC 3339 format.
	// Inclusive.
	To *QueryTo `form:"to,omitempty" json:"to,omitempty"`

	// Limit Number of events to return.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

ListEventsParams defines parameters for ListEvents.

type ListEventsResponse

type ListEventsResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *[]IngestedEvent
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseListEventsResponse

func ParseListEventsResponse(rsp *http.Response) (*ListEventsResponse, error)

ParseListEventsResponse parses an HTTP response from a ListEventsWithResponse call

func (ListEventsResponse) Status

func (r ListEventsResponse) Status() string

Status returns HTTPResponse.Status

func (ListEventsResponse) StatusCode

func (r ListEventsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListMeterSubjectsResponse

type ListMeterSubjectsResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *[]string
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseListMeterSubjectsResponse

func ParseListMeterSubjectsResponse(rsp *http.Response) (*ListMeterSubjectsResponse, error)

ParseListMeterSubjectsResponse parses an HTTP response from a ListMeterSubjectsWithResponse call

func (ListMeterSubjectsResponse) Status

func (r ListMeterSubjectsResponse) Status() string

Status returns HTTPResponse.Status

func (ListMeterSubjectsResponse) StatusCode

func (r ListMeterSubjectsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListMetersResponse

type ListMetersResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *[]Meter
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseListMetersResponse

func ParseListMetersResponse(rsp *http.Response) (*ListMetersResponse, error)

ParseListMetersResponse parses an HTTP response from a ListMetersWithResponse call

func (ListMetersResponse) Status

func (r ListMetersResponse) Status() string

Status returns HTTPResponse.Status

func (ListMetersResponse) StatusCode

func (r ListMetersResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Meter

type Meter = models.Meter

Meter defines model for Meter.

type MeterAggregation

type MeterAggregation = models.MeterAggregation

MeterAggregation The aggregation type to use for the meter.

type MeterIdOrSlug

type MeterIdOrSlug = IdOrSlug

MeterIdOrSlug defines model for meterIdOrSlug.

type MeterQueryResult

type MeterQueryResult struct {
	Data []MeterQueryRow `json:"data"`
	From *time.Time      `json:"from,omitempty"`
	To   *time.Time      `json:"to,omitempty"`

	// WindowSize Aggregation window size.
	WindowSize *WindowSize `json:"windowSize,omitempty"`
}

MeterQueryResult defines model for MeterQueryResult.

type MeterQueryRow

type MeterQueryRow = models.MeterQueryRow

MeterQueryRow defines model for MeterQueryRow.

type NotFoundProblemResponse

type NotFoundProblemResponse = Problem

NotFoundProblemResponse A Problem Details object (RFC 7807)

type NotImplementedProblemResponse

type NotImplementedProblemResponse = Problem

NotImplementedProblemResponse A Problem Details object (RFC 7807)

type PortalToken

type PortalToken struct {
	AllowedMeterSlugs *[]string  `json:"allowedMeterSlugs,omitempty"`
	ExpiresAt         *time.Time `json:"expiresAt,omitempty"`
	Subject           string     `json:"subject"`
	Token             *string    `json:"token,omitempty"`
}

PortalToken defines model for PortalToken.

type Problem

type Problem = models.StatusProblem

Problem A Problem Details object (RFC 7807)

type QueryFrom

type QueryFrom = time.Time

QueryFrom defines model for queryFrom.

type QueryGroupBy

type QueryGroupBy = []string

QueryGroupBy defines model for queryGroupBy.

type QueryMeterParams

type QueryMeterParams struct {
	// From Start date-time in RFC 3339 format.
	// Inclusive.
	From *QueryFrom `form:"from,omitempty" json:"from,omitempty"`

	// To End date-time in RFC 3339 format.
	// Inclusive.
	To *QueryTo `form:"to,omitempty" json:"to,omitempty"`

	// WindowSize If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.
	WindowSize *QueryWindowSize `form:"windowSize,omitempty" json:"windowSize,omitempty"`

	// WindowTimeZone The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
	// If not specified, the UTC timezone will be used.
	WindowTimeZone *QueryWindowTimeZone `form:"windowTimeZone,omitempty" json:"windowTimeZone,omitempty"`
	Subject        *QuerySubject        `form:"subject,omitempty" json:"subject,omitempty"`

	// GroupBy If not specified a single aggregate will be returned for each subject and time window.
	// `subject` is a reserved group by value.
	GroupBy *QueryGroupBy `form:"groupBy,omitempty" json:"groupBy,omitempty"`
}

QueryMeterParams defines parameters for QueryMeter.

type QueryMeterResponse

type QueryMeterResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *MeterQueryResult
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseQueryMeterResponse

func ParseQueryMeterResponse(rsp *http.Response) (*QueryMeterResponse, error)

ParseQueryMeterResponse parses an HTTP response from a QueryMeterWithResponse call

func (QueryMeterResponse) Status

func (r QueryMeterResponse) Status() string

Status returns HTTPResponse.Status

func (QueryMeterResponse) StatusCode

func (r QueryMeterResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type QueryPortalMeterParams

type QueryPortalMeterParams struct {
	// From Start date-time in RFC 3339 format.
	// Inclusive.
	From *QueryFrom `form:"from,omitempty" json:"from,omitempty"`

	// To End date-time in RFC 3339 format.
	// Inclusive.
	To *QueryTo `form:"to,omitempty" json:"to,omitempty"`

	// WindowSize If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.
	WindowSize *QueryWindowSize `form:"windowSize,omitempty" json:"windowSize,omitempty"`

	// WindowTimeZone The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
	// If not specified, the UTC timezone will be used.
	WindowTimeZone *QueryWindowTimeZone `form:"windowTimeZone,omitempty" json:"windowTimeZone,omitempty"`

	// GroupBy If not specified a single aggregate will be returned for each subject and time window.
	// `subject` is a reserved group by value.
	GroupBy *QueryGroupBy `form:"groupBy,omitempty" json:"groupBy,omitempty"`
}

QueryPortalMeterParams defines parameters for QueryPortalMeter.

type QueryPortalMeterResponse

type QueryPortalMeterResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *MeterQueryResult
	ApplicationproblemJSON400     *BadRequestProblemResponse
	ApplicationproblemJSON401     *UnauthorizedProblemResponse
	ApplicationproblemJSONDefault *UnexpectedProblemResponse
}

func ParseQueryPortalMeterResponse

func ParseQueryPortalMeterResponse(rsp *http.Response) (*QueryPortalMeterResponse, error)

ParseQueryPortalMeterResponse parses an HTTP response from a QueryPortalMeterWithResponse call

func (QueryPortalMeterResponse) Status

func (r QueryPortalMeterResponse) Status() string

Status returns HTTPResponse.Status

func (QueryPortalMeterResponse) StatusCode

func (r QueryPortalMeterResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type QuerySubject

type QuerySubject = []string

QuerySubject defines model for querySubject.

type QueryTo

type QueryTo = time.Time

QueryTo defines model for queryTo.

type QueryWindowSize

type QueryWindowSize = WindowSize

QueryWindowSize Aggregation window size.

type QueryWindowTimeZone

type QueryWindowTimeZone = string

QueryWindowTimeZone defines model for queryWindowTimeZone.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type UnauthorizedProblemResponse

type UnauthorizedProblemResponse = Problem

UnauthorizedProblemResponse A Problem Details object (RFC 7807)

type UnexpectedProblemResponse

type UnexpectedProblemResponse = Problem

UnexpectedProblemResponse A Problem Details object (RFC 7807)

type WindowSize

type WindowSize = models.WindowSize

WindowSize Aggregation window size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL