Documentation ¶
Overview ¶
Package api provides primitives to interact the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Index ¶
- func GetSwagger() (*openapi3.Swagger, error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- type AddPetJSONBody
- type AddPetJSONRequestBody
- type Error
- type FindPetsParams
- type NewPet
- type Pet
- type PetStore
- func (p *PetStore) AddPet(w http.ResponseWriter, r *http.Request)
- func (p *PetStore) DeletePet(w http.ResponseWriter, r *http.Request, id int64)
- func (p *PetStore) FindPetById(w http.ResponseWriter, r *http.Request, id int64)
- func (p *PetStore) FindPets(w http.ResponseWriter, r *http.Request, params FindPetsParams)
- 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)
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.
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.
Types ¶
type AddPetJSONRequestBody ¶
type AddPetJSONRequestBody AddPetJSONBody
AddPetRequestBody defines body for AddPet for application/json ContentType.
type Error ¶
type Error struct { // Error code Code int32 `json:"code"` // Error message Message string `json:"message"` }
Error defines model for Error.
type FindPetsParams ¶
type FindPetsParams struct { // tags to filter by Tags *[]string `json:"tags,omitempty"` // maximum number of results to return Limit *int32 `json:"limit,omitempty"` }
FindPetsParams defines parameters for FindPets.
type NewPet ¶
type NewPet struct { // Name of the pet Name string `json:"name"` // Type of the pet Tag *string `json:"tag,omitempty"` }
NewPet defines model for NewPet.
type Pet ¶
type Pet struct { // Embedded struct due to allOf(#/components/schemas/NewPet) NewPet // Unique id of the pet Id int64 `json:"id"` }
Pet defines model for Pet.
type PetStore ¶
func NewPetStore ¶
func NewPetStore() *PetStore
func (*PetStore) FindPetById ¶
func (*PetStore) FindPets ¶
func (p *PetStore) FindPets(w http.ResponseWriter, r *http.Request, params FindPetsParams)
Here, we implement all of the handlers in the ServerInterface
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.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
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