gen

package
v0.0.0-...-453b34a Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

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

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

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

Code generated by github.com/deepmap/oapi-codegen version v1.13.3 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 ChiServerOptions

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

type GetTweets200JSONResponse

type GetTweets200JSONResponse []Tweet

func (GetTweets200JSONResponse) VisitGetTweetsResponse

func (response GetTweets200JSONResponse) VisitGetTweetsResponse(w http.ResponseWriter) error

type GetTweets400JSONResponse

type GetTweets400JSONResponse struct {
	Message *string `json:"message,omitempty"`
}

func (GetTweets400JSONResponse) VisitGetTweetsResponse

func (response GetTweets400JSONResponse) VisitGetTweetsResponse(w http.ResponseWriter) error

type GetTweets500JSONResponse

type GetTweets500JSONResponse struct {
	Message *string `json:"message,omitempty"`
}

func (GetTweets500JSONResponse) VisitGetTweetsResponse

func (response GetTweets500JSONResponse) VisitGetTweetsResponse(w http.ResponseWriter) error

type GetTweetsParams

type GetTweetsParams struct {
	Category GetTweetsParamsCategory `form:"category" json:"category"`
}

GetTweetsParams defines parameters for GetTweets.

type GetTweetsParamsCategory

type GetTweetsParamsCategory string

GetTweetsParamsCategory defines parameters for GetTweets.

const (
	Like GetTweetsParamsCategory = "like"
	Own  GetTweetsParamsCategory = "own"
)

Defines values for GetTweetsParamsCategory.

type GetTweetsRequestObject

type GetTweetsRequestObject struct {
	Params GetTweetsParams
}

type GetTweetsResponseObject

type GetTweetsResponseObject interface {
	VisitGetTweetsResponse(w http.ResponseWriter) 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 /tweets)
	GetTweets(w http.ResponseWriter, r *http.Request, params GetTweetsParams)
}

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

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

GetTweets 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 = runtime.StrictHttpHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = runtime.StrictHttpMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {

	// (GET /tweets)
	GetTweets(ctx context.Context, request GetTweetsRequestObject) (GetTweetsResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type Tweet

type Tweet struct {
	AddDate string    `json:"addDate"`
	Id      int64     `json:"id"`
	Tags    *[]string `json:"tags,omitempty"`
	Url     string    `json:"url"`
}

Tweet defines model for Tweet.

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 Unimplemented

type Unimplemented struct{}

func (Unimplemented) GetTweets

func (_ Unimplemented) GetTweets(w http.ResponseWriter, r *http.Request, params GetTweetsParams)

(GET /tweets)

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