api

package
v0.0.0-...-7124079 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 14 Imported by: 0

README

oapi-codegen -config cfg.yaml ../circular.yaml

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 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 *mux.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) 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 CustomServer

type CustomServer struct {
	Lock sync.Mutex
}

func NewCustomServer

func NewCustomServer() *CustomServer

func (*CustomServer) GetAnything

GET /anything

type ErrorMessage

type ErrorMessage struct {
	CanBeRetried      *ErrorMessageCanBeRetried `json:"canBeRetried,omitempty"`
	DetailedErrorCode *int32                    `json:"detailedErrorCode,omitempty"`
	Error             *string                   `json:"error"`

	// Inner Detailed error message
	Inner      *ErrorMessage `json:"inner,omitempty"`
	StatusCode *int32        `json:"statusCode,omitempty"`
}

ErrorMessage Detailed error message

type ErrorMessageCanBeRetried

type ErrorMessageCanBeRetried string

ErrorMessageCanBeRetried defines model for ErrorMessage.CanBeRetried.

const (
	No      ErrorMessageCanBeRetried = "No"
	Unknown ErrorMessageCanBeRetried = "Unknown"
	Yes     ErrorMessageCanBeRetried = "Yes"
)

Defines values for ErrorMessageCanBeRetried.

type GetAnything200JSONResponse

type GetAnything200JSONResponse ErrorMessage

func (GetAnything200JSONResponse) VisitGetAnythingResponse

func (response GetAnything200JSONResponse) VisitGetAnythingResponse(w http.ResponseWriter) error

type GetAnything404JSONResponse

type GetAnything404JSONResponse ErrorMessage

func (GetAnything404JSONResponse) VisitGetAnythingResponse

func (response GetAnything404JSONResponse) VisitGetAnythingResponse(w http.ResponseWriter) error

type GetAnythingRequestObject

type GetAnythingRequestObject struct {
}

type GetAnythingResponseObject

type GetAnythingResponseObject interface {
	VisitGetAnythingResponse(w http.ResponseWriter) error
}

type GorillaServerOptions

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

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 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 {
	// Get anything
	// (GET /anything)
	GetAnything(w http.ResponseWriter, r *http.Request)
}

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

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

GetAnything 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 StrictServerInterface

type StrictServerInterface interface {
	// Get anything
	// (GET /anything)
	GetAnything(ctx context.Context, request GetAnythingRequestObject) (GetAnythingResponseObject, error)
}

StrictServerInterface represents all server handlers.

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 UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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