Documentation ¶
Overview ¶
Package openmeter provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version (devel) DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewGetMetersByIdRequest(server string, meterId string) (*http.Request, error)
- func NewGetMetersRequest(server string) (*http.Request, error)
- func NewGetValuesByMeterIdRequest(server string, meterId string, params *GetValuesByMeterIdParams) (*http.Request, error)
- func NewIngestEventsRequest(server string, body IngestEventsJSONRequestBody) (*http.Request, error)
- func NewIngestEventsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type Client
- func (c *Client) GetMeters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMetersById(ctx context.Context, meterId string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetValuesByMeterId(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, ...) (*http.Response, error)
- func (c *Client) IngestEvents(ctx context.Context, body IngestEventsJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) IngestEventsWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetMetersByIdWithResponse(ctx context.Context, meterId string, reqEditors ...RequestEditorFn) (*GetMetersByIdResponse, error)
- func (c *ClientWithResponses) GetMetersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetMetersResponse, error)
- func (c *ClientWithResponses) GetValuesByMeterIdWithResponse(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, ...) (*GetValuesByMeterIdResponse, error)
- func (c *ClientWithResponses) IngestEventsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*IngestEventsResponse, error)
- func (c *ClientWithResponses) IngestEventsWithResponse(ctx context.Context, body IngestEventsJSONRequestBody, ...) (*IngestEventsResponse, error)
- type ClientWithResponsesInterface
- type ErrResponse
- type Error
- type Event
- type GetMetersByIdResponse
- type GetMetersResponse
- type GetValuesByMeterIdParams
- type GetValuesByMeterIdResponse
- type HttpRequestDoer
- type IngestEventsJSONRequestBody
- type IngestEventsResponse
- type Meter
- type MeterValue
- type RequestEditorFn
- type WindowSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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 NewGetMetersByIdRequest ¶
NewGetMetersByIdRequest generates requests for GetMetersById
func NewGetMetersRequest ¶
NewGetMetersRequest generates requests for GetMeters
func NewGetValuesByMeterIdRequest ¶
func NewGetValuesByMeterIdRequest(server string, meterId string, params *GetValuesByMeterIdParams) (*http.Request, error)
NewGetValuesByMeterIdRequest generates requests for GetValuesByMeterId
func NewIngestEventsRequest ¶
func NewIngestEventsRequest(server string, body IngestEventsJSONRequestBody) (*http.Request, error)
NewIngestEventsRequest calls the generic IngestEvents builder with application/cloudevents+json body
Types ¶
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 NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) GetMetersById ¶
func (*Client) GetValuesByMeterId ¶
func (c *Client) GetValuesByMeterId(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) IngestEvents ¶
func (c *Client) IngestEvents(ctx context.Context, body IngestEventsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // IngestEvents request with any body IngestEventsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) IngestEvents(ctx context.Context, body IngestEventsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetMeters request GetMeters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // GetMetersById request GetMetersById(ctx context.Context, meterId string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetValuesByMeterId request GetValuesByMeterId(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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 NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetMetersByIdWithResponse ¶
func (c *ClientWithResponses) GetMetersByIdWithResponse(ctx context.Context, meterId string, reqEditors ...RequestEditorFn) (*GetMetersByIdResponse, error)
GetMetersByIdWithResponse request returning *GetMetersByIdResponse
func (*ClientWithResponses) GetMetersWithResponse ¶
func (c *ClientWithResponses) GetMetersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetMetersResponse, error)
GetMetersWithResponse request returning *GetMetersResponse
func (*ClientWithResponses) GetValuesByMeterIdWithResponse ¶
func (c *ClientWithResponses) GetValuesByMeterIdWithResponse(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, reqEditors ...RequestEditorFn) (*GetValuesByMeterIdResponse, error)
GetValuesByMeterIdWithResponse request returning *GetValuesByMeterIdResponse
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) IngestEventsWithResponse ¶
func (c *ClientWithResponses) IngestEventsWithResponse(ctx context.Context, body IngestEventsJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // IngestEvents request with any body IngestEventsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error) IngestEventsWithResponse(ctx context.Context, body IngestEventsJSONRequestBody, reqEditors ...RequestEditorFn) (*IngestEventsResponse, error) // GetMeters request GetMetersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetMetersResponse, error) // GetMetersById request GetMetersByIdWithResponse(ctx context.Context, meterId string, reqEditors ...RequestEditorFn) (*GetMetersByIdResponse, error) // GetValuesByMeterId request GetValuesByMeterIdWithResponse(ctx context.Context, meterId string, params *GetValuesByMeterIdParams, reqEditors ...RequestEditorFn) (*GetValuesByMeterIdResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
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 GetMetersByIdResponse ¶
type GetMetersByIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Meter JSON404 *Error JSONDefault *Error }
func ParseGetMetersByIdResponse ¶
func ParseGetMetersByIdResponse(rsp *http.Response) (*GetMetersByIdResponse, error)
ParseGetMetersByIdResponse parses an HTTP response from a GetMetersByIdWithResponse call
func (GetMetersByIdResponse) Status ¶
func (r GetMetersByIdResponse) Status() string
Status returns HTTPResponse.Status
func (GetMetersByIdResponse) StatusCode ¶
func (r GetMetersByIdResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetMetersResponse ¶
type GetMetersResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Meter JSONDefault *Error }
func ParseGetMetersResponse ¶
func ParseGetMetersResponse(rsp *http.Response) (*GetMetersResponse, error)
ParseGetMetersResponse parses an HTTP response from a GetMetersWithResponse call
func (GetMetersResponse) Status ¶
func (r GetMetersResponse) Status() string
Status returns HTTPResponse.Status
func (GetMetersResponse) StatusCode ¶
func (r GetMetersResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetValuesByMeterIdParams ¶
type GetValuesByMeterIdParams 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"` }
GetValuesByMeterIdParams defines parameters for GetValuesByMeterId.
type GetValuesByMeterIdResponse ¶
type GetValuesByMeterIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { Data []MeterValue `json:"data"` WindowSize *WindowSize `json:"windowSize,omitempty"` } JSONDefault *Error }
func ParseGetValuesByMeterIdResponse ¶
func ParseGetValuesByMeterIdResponse(rsp *http.Response) (*GetValuesByMeterIdResponse, error)
ParseGetValuesByMeterIdResponse parses an HTTP response from a GetValuesByMeterIdWithResponse call
func (GetValuesByMeterIdResponse) Status ¶
func (r GetValuesByMeterIdResponse) Status() string
Status returns HTTPResponse.Status
func (GetValuesByMeterIdResponse) StatusCode ¶
func (r GetValuesByMeterIdResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type IngestEventsJSONRequestBody ¶
type IngestEventsJSONRequestBody = Event
IngestEventsJSONRequestBody defines body for IngestEvents for application/cloudevents+json ContentType.
type IngestEventsResponse ¶
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 RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function