api

package
v0.3.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version (devel) DO NOT EDIT.

Index

Constants

This section is empty.

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 Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

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 ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CreateMeterJSONRequestBody

type CreateMeterJSONRequestBody = Meter

CreateMeterJSONRequestBody defines body for CreateMeter for application/json ContentType.

type CreateMeterParams

type CreateMeterParams struct {
	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

CreateMeterParams defines parameters for CreateMeter.

type CreateNamespaceJSONRequestBody

type CreateNamespaceJSONRequestBody = Namespace

CreateNamespaceJSONRequestBody defines body for CreateNamespace for application/json ContentType.

type DeleteMeterParams

type DeleteMeterParams struct {
	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

DeleteMeterParams defines parameters for DeleteMeter.

type Event

type Event = event.Event

Event CloudEvents Specification JSON Schema

type GetMeterParams

type GetMeterParams struct {
	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

GetMeterParams defines parameters for GetMeter.

type GetMeterValuesParams

type GetMeterValuesParams struct {
	Subject *string `form:"subject,omitempty" json:"subject,omitempty"`

	// From Start date-time in RFC 3339 format.
	// Must be aligned with the window size.
	// Inclusive.
	From *time.Time `form:"from,omitempty" json:"from,omitempty"`

	// To End date-time in RFC 3339 format.
	// Must be aligned with the window size.
	// Inclusive.
	To *time.Time `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 *WindowSize `form:"windowSize,omitempty" json:"windowSize,omitempty"`

	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

GetMeterValuesParams defines parameters for GetMeterValues.

type IdOrSlug

type IdOrSlug = string

IdOrSlug defines model for IdOrSlug.

type IngestEventsJSONRequestBody

type IngestEventsJSONRequestBody = Event

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

type IngestEventsParams

type IngestEventsParams struct {
	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

IngestEventsParams defines parameters for IngestEvents.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type ListMetersParams

type ListMetersParams struct {
	// OMNamespace Optional namespace
	NamespaceInput *NamespaceInput `json:"OM-Namespace,omitempty"`
}

ListMetersParams defines parameters for ListMeters.

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 MeterValue

type MeterValue = models.MeterValue

MeterValue defines model for MeterValue.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Namespace

type Namespace = models.Namespace

Namespace defines model for Namespace.

type NamespaceInput

type NamespaceInput = string

NamespaceInput defines model for namespaceParam.

type Problem

type Problem = models.Problem

Problem A Problem Details object (RFC 7807)

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {

	// (POST /api/v1/events)
	IngestEvents(w http.ResponseWriter, r *http.Request, params IngestEventsParams)

	// (GET /api/v1/meters)
	ListMeters(w http.ResponseWriter, r *http.Request, params ListMetersParams)

	// (POST /api/v1/meters)
	CreateMeter(w http.ResponseWriter, r *http.Request, params CreateMeterParams)

	// (DELETE /api/v1/meters/{meterIdOrSlug})
	DeleteMeter(w http.ResponseWriter, r *http.Request, meterIdOrSlug MeterIdOrSlug, params DeleteMeterParams)

	// (GET /api/v1/meters/{meterIdOrSlug})
	GetMeter(w http.ResponseWriter, r *http.Request, meterIdOrSlug MeterIdOrSlug, params GetMeterParams)

	// (GET /api/v1/meters/{meterIdOrSlug}/values)
	GetMeterValues(w http.ResponseWriter, r *http.Request, meterIdOrSlug MeterIdOrSlug, params GetMeterValuesParams)

	// (POST /api/v1/namespaces)
	CreateNamespace(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateMeter

func (siw *ServerInterfaceWrapper) CreateMeter(w http.ResponseWriter, r *http.Request)

CreateMeter operation middleware

func (*ServerInterfaceWrapper) CreateNamespace

func (siw *ServerInterfaceWrapper) CreateNamespace(w http.ResponseWriter, r *http.Request)

CreateNamespace operation middleware

func (*ServerInterfaceWrapper) DeleteMeter

func (siw *ServerInterfaceWrapper) DeleteMeter(w http.ResponseWriter, r *http.Request)

DeleteMeter operation middleware

func (*ServerInterfaceWrapper) GetMeter

func (siw *ServerInterfaceWrapper) GetMeter(w http.ResponseWriter, r *http.Request)

GetMeter operation middleware

func (*ServerInterfaceWrapper) GetMeterValues

func (siw *ServerInterfaceWrapper) GetMeterValues(w http.ResponseWriter, r *http.Request)

GetMeterValues operation middleware

func (*ServerInterfaceWrapper) IngestEvents

func (siw *ServerInterfaceWrapper) IngestEvents(w http.ResponseWriter, r *http.Request)

IngestEvents operation middleware

func (*ServerInterfaceWrapper) ListMeters

func (siw *ServerInterfaceWrapper) ListMeters(w http.ResponseWriter, r *http.Request)

ListMeters operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

type WindowSize

type WindowSize = models.WindowSize

WindowSize defines model for WindowSize.

Directories

Path Synopsis
client
go
Package openmeter provides primitives to interact with the openapi HTTP API.
Package openmeter provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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