api

package
v0.0.0-...-dc5073b Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 16 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.

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 BadrequestResponse

type BadrequestResponse struct {
}

type ChiServerOptions

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

type Example

type Example struct {
	Value *string `json:"value,omitempty"`
}

Example defines model for example.

type HeadersExample200JSONResponse

type HeadersExample200JSONResponse struct {
	Body    Example
	Headers HeadersExample200ResponseHeaders
}

func (HeadersExample200JSONResponse) MarshalJSON

func (t HeadersExample200JSONResponse) MarshalJSON() ([]byte, error)

type HeadersExample200ResponseHeaders

type HeadersExample200ResponseHeaders struct {
	Header1 string
	Header2 int
}

type HeadersExample400Response

type HeadersExample400Response = BadrequestResponse

type HeadersExampleJSONRequestBody

type HeadersExampleJSONRequestBody = Example

HeadersExampleJSONRequestBody defines body for HeadersExample for application/json ContentType.

type HeadersExampleParams

type HeadersExampleParams struct {
	Header1 string `json:"header1"`
	Header2 *int   `json:"header2,omitempty"`
}

HeadersExampleParams defines parameters for HeadersExample.

type HeadersExampleRequestObject

type HeadersExampleRequestObject struct {
	Params HeadersExampleParams
	Body   *HeadersExampleJSONRequestBody
}

type HeadersExampledefaultResponse

type HeadersExampledefaultResponse struct {
	StatusCode int
}

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 JSONExample200JSONResponse

type JSONExample200JSONResponse Example

func (JSONExample200JSONResponse) MarshalJSON

func (t JSONExample200JSONResponse) MarshalJSON() ([]byte, error)

type JSONExample400Response

type JSONExample400Response = BadrequestResponse

type JSONExampleJSONRequestBody

type JSONExampleJSONRequestBody = Example

JSONExampleJSONRequestBody defines body for JSONExample for application/json ContentType.

type JSONExampleRequestObject

type JSONExampleRequestObject struct {
	Body *JSONExampleJSONRequestBody
}

type JSONExampledefaultResponse

type JSONExampledefaultResponse struct {
	StatusCode int
}

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type MultipartExample200MultipartResponse

type MultipartExample200MultipartResponse func(writer *multipart.Writer) error

type MultipartExample400Response

type MultipartExample400Response = BadrequestResponse

type MultipartExampleMultipartRequestBody

type MultipartExampleMultipartRequestBody = Example

MultipartExampleMultipartRequestBody defines body for MultipartExample for multipart/form-data ContentType.

type MultipartExampleRequestObject

type MultipartExampleRequestObject struct {
	Body *multipart.Reader
}

type MultipartExampledefaultResponse

type MultipartExampledefaultResponse struct {
	StatusCode int
}

type MultipleRequestAndResponseTypes200FormdataResponse

type MultipleRequestAndResponseTypes200FormdataResponse Example

type MultipleRequestAndResponseTypes200ImagepngResponse

type MultipleRequestAndResponseTypes200ImagepngResponse struct {
	Body          io.Reader
	ContentLength int64
}

type MultipleRequestAndResponseTypes200JSONResponse

type MultipleRequestAndResponseTypes200JSONResponse Example

func (MultipleRequestAndResponseTypes200JSONResponse) MarshalJSON

type MultipleRequestAndResponseTypes200MultipartResponse

type MultipleRequestAndResponseTypes200MultipartResponse func(writer *multipart.Writer) error

type MultipleRequestAndResponseTypes200TextResponse

type MultipleRequestAndResponseTypes200TextResponse string

type MultipleRequestAndResponseTypes400Response

type MultipleRequestAndResponseTypes400Response = BadrequestResponse

type MultipleRequestAndResponseTypesFormdataRequestBody

type MultipleRequestAndResponseTypesFormdataRequestBody = Example

MultipleRequestAndResponseTypesFormdataRequestBody defines body for MultipleRequestAndResponseTypes for application/x-www-form-urlencoded ContentType.

type MultipleRequestAndResponseTypesJSONRequestBody

type MultipleRequestAndResponseTypesJSONRequestBody = Example

MultipleRequestAndResponseTypesJSONRequestBody defines body for MultipleRequestAndResponseTypes for application/json ContentType.

type MultipleRequestAndResponseTypesMultipartRequestBody

type MultipleRequestAndResponseTypesMultipartRequestBody = Example

MultipleRequestAndResponseTypesMultipartRequestBody defines body for MultipleRequestAndResponseTypes for multipart/form-data ContentType.

type MultipleRequestAndResponseTypesTextBody

type MultipleRequestAndResponseTypesTextBody = string

MultipleRequestAndResponseTypesTextBody defines parameters for MultipleRequestAndResponseTypes.

type MultipleRequestAndResponseTypesTextRequestBody

type MultipleRequestAndResponseTypesTextRequestBody = MultipleRequestAndResponseTypesTextBody

MultipleRequestAndResponseTypesTextRequestBody defines body for MultipleRequestAndResponseTypes for text/plain ContentType.

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 ReusableResponses200JSONResponse

type ReusableResponses200JSONResponse = ReusableresponseJSONResponse

type ReusableResponses400Response

type ReusableResponses400Response = BadrequestResponse

type ReusableResponsesJSONRequestBody

type ReusableResponsesJSONRequestBody = Example

ReusableResponsesJSONRequestBody defines body for ReusableResponses for application/json ContentType.

type ReusableResponsesRequestObject

type ReusableResponsesRequestObject struct {
	Body *ReusableResponsesJSONRequestBody
}

type ReusableResponsesdefaultResponse

type ReusableResponsesdefaultResponse struct {
	StatusCode int
}

type Reusableresponse

type Reusableresponse = Example

Reusableresponse defines model for reusableresponse.

type ReusableresponseJSONResponse

type ReusableresponseJSONResponse struct {
	Body Example

	Headers ReusableresponseResponseHeaders
}

func (ReusableresponseJSONResponse) MarshalJSON

func (t ReusableresponseJSONResponse) MarshalJSON() ([]byte, error)

type ReusableresponseResponseHeaders

type ReusableresponseResponseHeaders struct {
	Header1 string
	Header2 int
}

type ServerInterface

type ServerInterface interface {

	// (POST /json)
	JSONExample(w http.ResponseWriter, r *http.Request)

	// (POST /multipart)
	MultipartExample(w http.ResponseWriter, r *http.Request)

	// (POST /multiple)
	MultipleRequestAndResponseTypes(w http.ResponseWriter, r *http.Request)

	// (POST /reusable-responses)
	ReusableResponses(w http.ResponseWriter, r *http.Request)

	// (POST /text)
	TextExample(w http.ResponseWriter, r *http.Request)

	// (POST /unknown)
	UnknownExample(w http.ResponseWriter, r *http.Request)

	// (POST /unspecified-content-type)
	UnspecifiedContentType(w http.ResponseWriter, r *http.Request)

	// (POST /urlencoded)
	URLEncodedExample(w http.ResponseWriter, r *http.Request)

	// (POST /with-headers)
	HeadersExample(w http.ResponseWriter, r *http.Request, params HeadersExampleParams)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

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

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

HeadersExample operation middleware

func (*ServerInterfaceWrapper) JSONExample

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

JSONExample operation middleware

func (*ServerInterfaceWrapper) MultipartExample

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

MultipartExample operation middleware

func (*ServerInterfaceWrapper) MultipleRequestAndResponseTypes

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

MultipleRequestAndResponseTypes operation middleware

func (*ServerInterfaceWrapper) ReusableResponses

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

ReusableResponses operation middleware

func (*ServerInterfaceWrapper) TextExample

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

TextExample operation middleware

func (*ServerInterfaceWrapper) URLEncodedExample

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

URLEncodedExample operation middleware

func (*ServerInterfaceWrapper) UnknownExample

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

UnknownExample operation middleware

func (*ServerInterfaceWrapper) UnspecifiedContentType

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

UnspecifiedContentType operation middleware

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHandlerFunc

type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, args interface{}) interface{}

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServer

type StrictServer struct {
}

func (StrictServer) HeadersExample

func (s StrictServer) HeadersExample(ctx context.Context, request HeadersExampleRequestObject) interface{}

func (StrictServer) JSONExample

func (s StrictServer) JSONExample(ctx context.Context, request JSONExampleRequestObject) interface{}

func (StrictServer) MultipartExample

func (s StrictServer) MultipartExample(ctx context.Context, request MultipartExampleRequestObject) interface{}

func (StrictServer) MultipleRequestAndResponseTypes

func (s StrictServer) MultipleRequestAndResponseTypes(ctx context.Context, request MultipleRequestAndResponseTypesRequestObject) interface{}

func (StrictServer) ReusableResponses

func (s StrictServer) ReusableResponses(ctx context.Context, request ReusableResponsesRequestObject) interface{}

func (StrictServer) TextExample

func (s StrictServer) TextExample(ctx context.Context, request TextExampleRequestObject) interface{}

func (StrictServer) URLEncodedExample

func (s StrictServer) URLEncodedExample(ctx context.Context, request URLEncodedExampleRequestObject) interface{}

func (StrictServer) UnknownExample

func (s StrictServer) UnknownExample(ctx context.Context, request UnknownExampleRequestObject) interface{}

func (StrictServer) UnspecifiedContentType

func (s StrictServer) UnspecifiedContentType(ctx context.Context, request UnspecifiedContentTypeRequestObject) interface{}

type StrictServerInterface

type StrictServerInterface interface {

	// (POST /json)
	JSONExample(ctx context.Context, request JSONExampleRequestObject) interface{}

	// (POST /multipart)
	MultipartExample(ctx context.Context, request MultipartExampleRequestObject) interface{}

	// (POST /multiple)
	MultipleRequestAndResponseTypes(ctx context.Context, request MultipleRequestAndResponseTypesRequestObject) interface{}

	// (POST /reusable-responses)
	ReusableResponses(ctx context.Context, request ReusableResponsesRequestObject) interface{}

	// (POST /text)
	TextExample(ctx context.Context, request TextExampleRequestObject) interface{}

	// (POST /unknown)
	UnknownExample(ctx context.Context, request UnknownExampleRequestObject) interface{}

	// (POST /unspecified-content-type)
	UnspecifiedContentType(ctx context.Context, request UnspecifiedContentTypeRequestObject) interface{}

	// (POST /urlencoded)
	URLEncodedExample(ctx context.Context, request URLEncodedExampleRequestObject) interface{}

	// (POST /with-headers)
	HeadersExample(ctx context.Context, request HeadersExampleRequestObject) interface{}
}

StrictServerInterface represents all server handlers.

type TextExample200TextResponse

type TextExample200TextResponse string

type TextExample400Response

type TextExample400Response = BadrequestResponse

type TextExampleRequestObject

type TextExampleRequestObject struct {
	Body *TextExampleTextRequestBody
}

type TextExampleTextBody

type TextExampleTextBody = string

TextExampleTextBody defines parameters for TextExample.

type TextExampleTextRequestBody

type TextExampleTextRequestBody = TextExampleTextBody

TextExampleTextRequestBody defines body for TextExample for text/plain ContentType.

type TextExampledefaultResponse

type TextExampledefaultResponse struct {
	StatusCode int
}

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type URLEncodedExample200FormdataResponse

type URLEncodedExample200FormdataResponse Example

type URLEncodedExample400Response

type URLEncodedExample400Response = BadrequestResponse

type URLEncodedExampleFormdataRequestBody

type URLEncodedExampleFormdataRequestBody = Example

URLEncodedExampleFormdataRequestBody defines body for URLEncodedExample for application/x-www-form-urlencoded ContentType.

type URLEncodedExampleRequestObject

type URLEncodedExampleRequestObject struct {
	Body *URLEncodedExampleFormdataRequestBody
}

type URLEncodedExampledefaultResponse

type URLEncodedExampledefaultResponse struct {
	StatusCode int
}

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 UnknownExample200Videomp4Response

type UnknownExample200Videomp4Response struct {
	Body          io.Reader
	ContentLength int64
}

type UnknownExample400Response

type UnknownExample400Response = BadrequestResponse

type UnknownExampleRequestObject

type UnknownExampleRequestObject struct {
	Body io.Reader
}

type UnknownExampledefaultResponse

type UnknownExampledefaultResponse struct {
	StatusCode int
}

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UnspecifiedContentType200VideoResponse

type UnspecifiedContentType200VideoResponse struct {
	Body          io.Reader
	ContentType   string
	ContentLength int64
}

type UnspecifiedContentType400Response

type UnspecifiedContentType400Response = BadrequestResponse

type UnspecifiedContentType401Response

type UnspecifiedContentType401Response struct {
}

type UnspecifiedContentType403Response

type UnspecifiedContentType403Response struct {
}

type UnspecifiedContentTypeRequestObject

type UnspecifiedContentTypeRequestObject struct {
	ContentType string
	Body        io.Reader
}

type UnspecifiedContentTypedefaultResponse

type UnspecifiedContentTypedefaultResponse struct {
	StatusCode int
}

Jump to

Keyboard shortcuts

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