v1

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSignJwtRequest

func NewSignJwtRequest(server string, body SignJwtJSONRequestBody) (*http.Request, error)

NewSignJwtRequest calls the generic SignJwt builder with application/json body

func NewSignJwtRequestWithBody

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

NewSignJwtRequestWithBody generates requests for SignJwt with any type of body

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

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) SignJwt

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

func (*Client) SignJwtWithBody

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

type ClientInterface

type ClientInterface interface {
	// SignJwt request with any body
	SignJwtWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SignJwt(ctx context.Context, body SignJwtJSONRequestBody, 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 NewClientWithResponses

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

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

func (*ClientWithResponses) SignJwtWithBodyWithResponse

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

SignJwtWithBodyWithResponse request with arbitrary body returning *SignJwtResponse

func (*ClientWithResponses) SignJwtWithResponse

func (c *ClientWithResponses) SignJwtWithResponse(ctx context.Context, body SignJwtJSONRequestBody, reqEditors ...RequestEditorFn) (*SignJwtResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// SignJwt request with any body
	SignJwtWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SignJwtResponse, error)

	SignJwtWithResponse(ctx context.Context, body SignJwtJSONRequestBody, reqEditors ...RequestEditorFn) (*SignJwtResponse, error)
}

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

type EchoRouter

type EchoRouter interface {
	Add(method string, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type ErrorStatusCodeResolver

type ErrorStatusCodeResolver interface {
	ResolveStatusCode(err error) int
}

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Preprocessor

type Preprocessor interface {
	Preprocess(operationID string, context echo.Context)
}

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type ServerInterface

type ServerInterface interface {
	// sign a JWT payload with the private key of the given kid
	// (POST /internal/crypto/v1/sign_jwt)
	SignJwt(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) SignJwt

func (w *ServerInterfaceWrapper) SignJwt(ctx echo.Context) error

SignJwt converts echo context to params.

type SignJwtJSONBody

type SignJwtJSONBody SignJwtRequest

SignJwtJSONBody defines parameters for SignJwt.

type SignJwtJSONRequestBody

type SignJwtJSONRequestBody SignJwtJSONBody

SignJwtJSONRequestBody defines body for SignJwt for application/json ContentType.

type SignJwtRequest

type SignJwtRequest struct {
	Claims map[string]interface{} `json:"claims"`
	Kid    string                 `json:"kid"`
}

SignJwtRequest defines model for SignJwtRequest.

type SignJwtResponse

type SignJwtResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseSignJwtResponse

func ParseSignJwtResponse(rsp *http.Response) (*SignJwtResponse, error)

ParseSignJwtResponse parses an HTTP response from a SignJwtWithResponse call

func (SignJwtResponse) Status

func (r SignJwtResponse) Status() string

Status returns HTTPResponse.Status

func (SignJwtResponse) StatusCode

func (r SignJwtResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Wrapper

type Wrapper struct {
	C crypto.JWTSigner
}

Wrapper implements the generated interface from oapi-codegen

func (*Wrapper) Preprocess

func (w *Wrapper) Preprocess(operationID string, context echo.Context)

Preprocess is called just before the API operation itself is invoked.

func (*Wrapper) ResolveStatusCode

func (w *Wrapper) ResolveStatusCode(err error) int

ResolveStatusCode maps errors returned by this API to specific HTTP status codes.

func (*Wrapper) Routes

func (w *Wrapper) Routes(router core.EchoRouter)

func (*Wrapper) SignJwt

func (w *Wrapper) SignJwt(ctx echo.Context) error

SignJwt handles api calls for signing a Jwt

Jump to

Keyboard shortcuts

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