openapi

package
v0.0.0-...-9d822dc Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

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

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

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

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

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

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

Index

Constants

View Source
const (
	ApiKeyScopes = "apiKey.Scopes"
)

Variables

This section is empty.

Functions

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 NewV1HealthAPIRequest

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

NewV1HealthAPIRequest generates requests for V1HealthAPI

func NewV1HealthCacheRequest

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

NewV1HealthCacheRequest generates requests for V1HealthCache

func NewV1HealthDBRequest

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

NewV1HealthDBRequest generates requests for V1HealthDB

func NewV1HelloRequest

func NewV1HelloRequest(server string, body V1HelloJSONRequestBody) (*http.Request, error)

NewV1HelloRequest calls the generic V1Hello builder with application/json body

func NewV1HelloRequestWithBody

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

NewV1HelloRequestWithBody generates requests for V1Hello with any type of body

Types

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

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

func (*Client) V1HealthCache

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

func (*Client) V1HealthDB

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

func (*Client) V1Hello

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

func (*Client) V1HelloWithBody

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

type ClientInterface

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

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

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

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

	V1Hello(ctx context.Context, body V1HelloJSONRequestBody, 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) V1HealthAPIWithResponse

func (c *ClientWithResponses) V1HealthAPIWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthAPIResponse, error)

V1HealthAPIWithResponse request returning *V1HealthAPIResponse

func (*ClientWithResponses) V1HealthCacheWithResponse

func (c *ClientWithResponses) V1HealthCacheWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthCacheResponse, error)

V1HealthCacheWithResponse request returning *V1HealthCacheResponse

func (*ClientWithResponses) V1HealthDBWithResponse

func (c *ClientWithResponses) V1HealthDBWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthDBResponse, error)

V1HealthDBWithResponse request returning *V1HealthDBResponse

func (*ClientWithResponses) V1HelloWithBodyWithResponse

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

V1HelloWithBodyWithResponse request with arbitrary body returning *V1HelloResponse

func (*ClientWithResponses) V1HelloWithResponse

func (c *ClientWithResponses) V1HelloWithResponse(ctx context.Context, body V1HelloJSONRequestBody, reqEditors ...RequestEditorFn) (*V1HelloResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// V1HealthAPI request
	V1HealthAPIWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthAPIResponse, error)

	// V1HealthCache request
	V1HealthCacheWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthCacheResponse, error)

	// V1HealthDB request
	V1HealthDBWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*V1HealthDBResponse, error)

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

	V1HelloWithResponse(ctx context.Context, body V1HelloJSONRequestBody, reqEditors ...RequestEditorFn) (*V1HelloResponse, error)
}

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

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

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 MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

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 {
	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 {
	// APIのヘルスチェック
	// (GET /v1/health/api)
	V1HealthAPI(w http.ResponseWriter, r *http.Request)
	// キャッシュのヘルスチェック
	// (GET /v1/health/cache)
	V1HealthCache(w http.ResponseWriter, r *http.Request)
	// データベースのヘルスチェック
	// (GET /v1/health/db)
	V1HealthDB(w http.ResponseWriter, r *http.Request)
	// Hello
	// (POST /v1/hello)
	V1Hello(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) V1HealthAPI

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

V1HealthAPI operation middleware

func (*ServerInterfaceWrapper) V1HealthCache

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

V1HealthCache operation middleware

func (*ServerInterfaceWrapper) V1HealthDB

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

V1HealthDB operation middleware

func (*ServerInterfaceWrapper) V1Hello

V1Hello 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 V1HealthAPIResponse

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

func ParseV1HealthAPIResponse

func ParseV1HealthAPIResponse(rsp *http.Response) (*V1HealthAPIResponse, error)

ParseV1HealthAPIResponse parses an HTTP response from a V1HealthAPIWithResponse call

func (V1HealthAPIResponse) Status

func (r V1HealthAPIResponse) Status() string

Status returns HTTPResponse.Status

func (V1HealthAPIResponse) StatusCode

func (r V1HealthAPIResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type V1HealthCacheResponse

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

func ParseV1HealthCacheResponse

func ParseV1HealthCacheResponse(rsp *http.Response) (*V1HealthCacheResponse, error)

ParseV1HealthCacheResponse parses an HTTP response from a V1HealthCacheWithResponse call

func (V1HealthCacheResponse) Status

func (r V1HealthCacheResponse) Status() string

Status returns HTTPResponse.Status

func (V1HealthCacheResponse) StatusCode

func (r V1HealthCacheResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type V1HealthDBResponse

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

func ParseV1HealthDBResponse

func ParseV1HealthDBResponse(rsp *http.Response) (*V1HealthDBResponse, error)

ParseV1HealthDBResponse parses an HTTP response from a V1HealthDBWithResponse call

func (V1HealthDBResponse) Status

func (r V1HealthDBResponse) Status() string

Status returns HTTPResponse.Status

func (V1HealthDBResponse) StatusCode

func (r V1HealthDBResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type V1HelloJSONRequestBody

type V1HelloJSONRequestBody = V1HelloRequestSchema

V1HelloJSONRequestBody defines body for V1Hello for application/json ContentType.

type V1HelloRequestSchema

type V1HelloRequestSchema struct {
	// Name name
	Name string `json:"name"`
}

V1HelloRequestSchema defines model for V1HelloRequestSchema.

type V1HelloResponse

type V1HelloResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *V1HelloResponseSchema
}

func ParseV1HelloResponse

func ParseV1HelloResponse(rsp *http.Response) (*V1HelloResponse, error)

ParseV1HelloResponse parses an HTTP response from a V1HelloWithResponse call

func (V1HelloResponse) Status

func (r V1HelloResponse) Status() string

Status returns HTTPResponse.Status

func (V1HelloResponse) StatusCode

func (r V1HelloResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type V1HelloResponseSchema

type V1HelloResponseSchema struct {
	// Greet 挨拶
	Greet string `json:"greet"`
}

V1HelloResponseSchema defines model for V1HelloResponseSchema.

Jump to

Keyboard shortcuts

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