v1

package
v0.0.0-...-1328ba8 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: MIT Imports: 14 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.4-0.20211007223312-7ee55a9ca6fb 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 NewBicsRequest

func NewBicsRequest(server string, params *BicsParams) (*http.Request, error)

NewBicsRequest generates requests for Bics

func NewCountryCodesRequest

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

NewCountryCodesRequest generates requests for CountryCodes

func NewRandomRequest

func NewRandomRequest(server string, params *RandomParams) (*http.Request, error)

NewRandomRequest generates requests for Random

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 BIC

type BIC struct {
	Bank        string `json:"bank"`
	Bic         string `json:"bic"`
	CountryCode string `json:"countryCode"`
}

The details BIC.

type BicsParams

type BicsParams struct {
	// Return only BICs for the country code.
	CountryCode *string `json:"countryCode,omitempty"`

	// Return only BICs that match the bank name and sort them with levenshtein distance.
	Bank *string `json:"bank,omitempty"`
}

BicsParams defines parameters for Bics.

type BicsResponse

type BicsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]BIC
	JSONDefault  *Error
}

func ParseBicsResponse

func ParseBicsResponse(rsp *http.Response) (*BicsResponse, error)

ParseBicsResponse parses an HTTP response from a BicsWithResponse call

func (BicsResponse) Status

func (r BicsResponse) Status() string

Status returns HTTPResponse.Status

func (BicsResponse) StatusCode

func (r BicsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ChiServerOptions

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

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

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

func (*Client) CountryCodes

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

func (*Client) Random

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

type ClientInterface

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

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

	// Random request
	Random(ctx context.Context, params *RandomParams, 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) BicsWithResponse

func (c *ClientWithResponses) BicsWithResponse(ctx context.Context, params *BicsParams, reqEditors ...RequestEditorFn) (*BicsResponse, error)

BicsWithResponse request returning *BicsResponse

func (*ClientWithResponses) CountryCodesWithResponse

func (c *ClientWithResponses) CountryCodesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CountryCodesResponse, error)

CountryCodesWithResponse request returning *CountryCodesResponse

func (*ClientWithResponses) RandomWithResponse

func (c *ClientWithResponses) RandomWithResponse(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*RandomResponse, error)

RandomWithResponse request returning *RandomResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// Bics request
	BicsWithResponse(ctx context.Context, params *BicsParams, reqEditors ...RequestEditorFn) (*BicsResponse, error)

	// CountryCodes request
	CountryCodesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CountryCodesResponse, error)

	// Random request
	RandomWithResponse(ctx context.Context, params *RandomParams, reqEditors ...RequestEditorFn) (*RandomResponse, error)
}

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

type CountryCodesResponse

type CountryCodesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]string
	JSONDefault  *Error
}

func ParseCountryCodesResponse

func ParseCountryCodesResponse(rsp *http.Response) (*CountryCodesResponse, error)

ParseCountryCodesResponse parses an HTTP response from a CountryCodesWithResponse call

func (CountryCodesResponse) Status

func (r CountryCodesResponse) Status() string

Status returns HTTPResponse.Status

func (CountryCodesResponse) StatusCode

func (r CountryCodesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error

type Error struct {
	Error string `json:"error"`
}

An error response.

type ErrorResponse

type ErrorResponse Error

An error response.

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type IBANGeneration

type IBANGeneration struct {
	Bankcode string  `json:"bankcode"`
	Bic      *string `json:"bic,omitempty"`
	Iban     string  `json:"iban"`
}

The details of a generated iban.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	// contains filtered or unexported fields
}

type MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

type RandomParams

type RandomParams struct {
	// The BIC to use for generation.
	Bic *string `json:"bic,omitempty"`

	// The bank code to use for generation.
	BankCode *string `json:"bankCode,omitempty"`

	// The country code to use.
	CountryCode *string `json:"countryCode,omitempty"`
}

RandomParams defines parameters for Random.

type RandomResponse

type RandomResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *IBANGeneration
	JSONDefault  *Error
}

func ParseRandomResponse

func ParseRandomResponse(rsp *http.Response) (*RandomResponse, error)

ParseRandomResponse parses an HTTP response from a RandomWithResponse call

func (RandomResponse) Status

func (r RandomResponse) Status() string

Status returns HTTPResponse.Status

func (RandomResponse) StatusCode

func (r RandomResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type RequiredHeaderError

type RequiredHeaderError struct {
	// contains filtered or unexported fields
}

type RequiredParamError

type RequiredParamError struct {
	// contains filtered or unexported fields
}

type ServerInterface

type ServerInterface interface {
	// The by the generator supported BICs.
	// (GET /v1/bics)
	Bics(w http.ResponseWriter, r *http.Request, params BicsParams)
	// The by the generator country codes.
	// (GET /v1/countryCodes)
	CountryCodes(w http.ResponseWriter, r *http.Request)
	// Generate an iban.
	// (GET /v1/random)
	Random(w http.ResponseWriter, r *http.Request, params RandomParams)
}

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

Bics operation middleware

func (*ServerInterfaceWrapper) CountryCodes

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

CountryCodes operation middleware

func (*ServerInterfaceWrapper) Random

Random operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	// contains filtered or unexported fields
}

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	// contains filtered or unexported fields
}

type UnmarshalingParamError

type UnmarshalingParamError struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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