Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/nazirok/oapi-codegen version (devel) DO NOT EDIT.
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/nazirok/oapi-codegen version (devel) DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type AddPet200JSONResponse
- type AddPetJSONRequestBody
- type AddPetRequestObject
- type AddPetResponseObject
- type AddPetdefaultJSONResponse
- type ChiServerOptions
- type DeletePet204Response
- type DeletePetRequestObject
- type DeletePetResponseObject
- type DeletePetdefaultJSONResponse
- type Error
- type FindPetByID200JSONResponse
- type FindPetByIDRequestObject
- type FindPetByIDResponseObject
- type FindPetByIDdefaultJSONResponse
- type FindPets200JSONResponse
- type FindPetsParams
- type FindPetsRequestObject
- type FindPetsResponseObject
- type FindPetsdefaultJSONResponse
- type InvalidParamFormatError
- type MiddlewareFunc
- type NewPet
- type Pet
- type PetStore
- func (p *PetStore) AddPet(ctx context.Context, request AddPetRequestObject) (AddPetResponseObject, error)
- func (p *PetStore) DeletePet(ctx context.Context, request DeletePetRequestObject) (DeletePetResponseObject, error)
- func (p *PetStore) FindPetByID(ctx context.Context, request FindPetByIDRequestObject) (FindPetByIDResponseObject, error)
- func (p *PetStore) FindPets(ctx context.Context, request FindPetsRequestObject) (FindPetsResponseObject, error)
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) AddPet(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeletePet(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) FindPetByID(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) FindPets(w http.ResponseWriter, r *http.Request)
- type StrictHTTPServerOptions
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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
Types ¶
type AddPet200JSONResponse ¶
type AddPet200JSONResponse Pet
func (AddPet200JSONResponse) VisitAddPetResponse ¶
func (response AddPet200JSONResponse) VisitAddPetResponse(w http.ResponseWriter) error
type AddPetJSONRequestBody ¶
type AddPetJSONRequestBody = NewPet
AddPetJSONRequestBody defines body for AddPet for application/json ContentType.
type AddPetRequestObject ¶
type AddPetRequestObject struct {
Body *AddPetJSONRequestBody
}
type AddPetResponseObject ¶
type AddPetResponseObject interface {
VisitAddPetResponse(w http.ResponseWriter) error
}
type AddPetdefaultJSONResponse ¶
func (AddPetdefaultJSONResponse) VisitAddPetResponse ¶
func (response AddPetdefaultJSONResponse) VisitAddPetResponse(w http.ResponseWriter) error
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type DeletePet204Response ¶
type DeletePet204Response struct { }
func (DeletePet204Response) VisitDeletePetResponse ¶
func (response DeletePet204Response) VisitDeletePetResponse(w http.ResponseWriter) error
type DeletePetRequestObject ¶
type DeletePetRequestObject struct {
Id int64 `json:"id"`
}
type DeletePetResponseObject ¶
type DeletePetResponseObject interface {
VisitDeletePetResponse(w http.ResponseWriter) error
}
type DeletePetdefaultJSONResponse ¶
func (DeletePetdefaultJSONResponse) VisitDeletePetResponse ¶
func (response DeletePetdefaultJSONResponse) VisitDeletePetResponse(w http.ResponseWriter) error
type Error ¶
type Error struct { // Code Error code Code int32 `json:"code"` // Message Error message Message string `json:"message"` }
Error defines model for Error.
type FindPetByID200JSONResponse ¶
type FindPetByID200JSONResponse Pet
func (FindPetByID200JSONResponse) VisitFindPetByIDResponse ¶
func (response FindPetByID200JSONResponse) VisitFindPetByIDResponse(w http.ResponseWriter) error
type FindPetByIDRequestObject ¶
type FindPetByIDRequestObject struct {
Id int64 `json:"id"`
}
type FindPetByIDResponseObject ¶
type FindPetByIDResponseObject interface {
VisitFindPetByIDResponse(w http.ResponseWriter) error
}
type FindPetByIDdefaultJSONResponse ¶
func (FindPetByIDdefaultJSONResponse) VisitFindPetByIDResponse ¶
func (response FindPetByIDdefaultJSONResponse) VisitFindPetByIDResponse(w http.ResponseWriter) error
type FindPets200JSONResponse ¶
type FindPets200JSONResponse []Pet
func (FindPets200JSONResponse) VisitFindPetsResponse ¶
func (response FindPets200JSONResponse) VisitFindPetsResponse(w http.ResponseWriter) error
type FindPetsParams ¶
type FindPetsParams struct { // Tags tags to filter by Tags *[]string `form:"tags,omitempty" json:"tags,omitempty"` // Limit maximum number of results to return Limit *int32 `form:"limit,omitempty" json:"limit,omitempty"` }
FindPetsParams defines parameters for FindPets.
type FindPetsRequestObject ¶
type FindPetsRequestObject struct {
Params FindPetsParams
}
type FindPetsResponseObject ¶
type FindPetsResponseObject interface {
VisitFindPetsResponse(w http.ResponseWriter) error
}
type FindPetsdefaultJSONResponse ¶
func (FindPetsdefaultJSONResponse) VisitFindPetsResponse ¶
func (response FindPetsdefaultJSONResponse) VisitFindPetsResponse(w http.ResponseWriter) error
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type NewPet ¶
type NewPet struct { // Name Name of the pet Name string `json:"name"` // Tag Type of the pet Tag *string `json:"tag,omitempty"` }
NewPet defines model for NewPet.
type Pet ¶
type Pet struct { // Id Unique id of the pet Id int64 `json:"id"` // Name Name of the pet Name string `json:"name"` // Tag Type of the pet Tag *string `json:"tag,omitempty"` }
Pet defines model for Pet.
type PetStore ¶
func NewPetStore ¶
func NewPetStore() *PetStore
func (*PetStore) AddPet ¶
func (p *PetStore) AddPet(ctx context.Context, request AddPetRequestObject) (AddPetResponseObject, error)
func (*PetStore) DeletePet ¶
func (p *PetStore) DeletePet(ctx context.Context, request DeletePetRequestObject) (DeletePetResponseObject, error)
func (*PetStore) FindPetByID ¶
func (p *PetStore) FindPetByID(ctx context.Context, request FindPetByIDRequestObject) (FindPetByIDResponseObject, error)
func (*PetStore) FindPets ¶
func (p *PetStore) FindPets(ctx context.Context, request FindPetsRequestObject) (FindPetsResponseObject, error)
FindPets implements all the handlers in the ServerInterface
type RequiredHeaderError ¶
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 { // Returns all pets // (GET /pets) FindPets(w http.ResponseWriter, r *http.Request, params FindPetsParams) // Creates a new pet // (POST /pets) AddPet(w http.ResponseWriter, r *http.Request) // Deletes a pet by ID // (DELETE /pets/{id}) DeletePet(w http.ResponseWriter, r *http.Request, id int64) // Returns a pet by ID // (GET /pets/{id}) FindPetByID(w http.ResponseWriter, r *http.Request, id int64) }
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) AddPet ¶
func (siw *ServerInterfaceWrapper) AddPet(w http.ResponseWriter, r *http.Request)
AddPet operation middleware
func (*ServerInterfaceWrapper) DeletePet ¶
func (siw *ServerInterfaceWrapper) DeletePet(w http.ResponseWriter, r *http.Request)
DeletePet operation middleware
func (*ServerInterfaceWrapper) FindPetByID ¶
func (siw *ServerInterfaceWrapper) FindPetByID(w http.ResponseWriter, r *http.Request)
FindPetByID operation middleware
func (*ServerInterfaceWrapper) FindPets ¶
func (siw *ServerInterfaceWrapper) FindPets(w http.ResponseWriter, r *http.Request)
FindPets 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 { // Returns all pets // (GET /pets) FindPets(ctx context.Context, request FindPetsRequestObject) (FindPetsResponseObject, error) // Creates a new pet // (POST /pets) AddPet(ctx context.Context, request AddPetRequestObject) (AddPetResponseObject, error) // Deletes a pet by ID // (DELETE /pets/{id}) DeletePet(ctx context.Context, request DeletePetRequestObject) (DeletePetResponseObject, error) // Returns a pet by ID // (GET /pets/{id}) FindPetByID(ctx context.Context, request FindPetByIDRequestObject) (FindPetByIDResponseObject, error) }
StrictServerInterface represents all server handlers.
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error