Documentation ¶
Index ¶
- type PetstoreAPI
- func (o *PetstoreAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]httpkit.Authenticator
- func (o *PetstoreAPI) ConsumersFor(mediaTypes []string) map[string]httpkit.Consumer
- func (o *PetstoreAPI) DefaultConsumes() string
- func (o *PetstoreAPI) DefaultProduces() string
- func (o *PetstoreAPI) Formats() strfmt.Registry
- func (o *PetstoreAPI) HandlerFor(operationID string) (http.Handler, bool)
- func (o *PetstoreAPI) ProducersFor(mediaTypes []string) map[string]httpkit.Producer
- func (o *PetstoreAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)
- func (o *PetstoreAPI) Serve(builder middleware.Builder) http.Handler
- func (o *PetstoreAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
- func (o *PetstoreAPI) SetDefaultConsumes(mediaType string)
- func (o *PetstoreAPI) SetDefaultProduces(mediaType string)
- func (o *PetstoreAPI) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PetstoreAPI ¶
type PetstoreAPI struct { // JSONConsumer registers a consumer for a "application/json" mime type JSONConsumer httpkit.Consumer // XMLConsumer registers a consumer for a "application/xml" mime type XMLConsumer httpkit.Consumer // JSONProducer registers a producer for a "application/json" mime type JSONProducer httpkit.Producer // XMLProducer registers a producer for a "application/xml" mime type XMLProducer httpkit.Producer // APIKeyAuth registers a function that takes a token and returns a principal // it performs authentication based on an api key api_key provided in the header APIKeyAuth func(string) (interface{}, error) // AddPetHandler sets the operation handler for the add pet operation AddPetHandler pet.AddPetHandler // CreateUserHandler sets the operation handler for the create user operation CreateUserHandler user.CreateUserHandler // CreateUsersWithArrayInputHandler sets the operation handler for the create users with array input operation CreateUsersWithArrayInputHandler user.CreateUsersWithArrayInputHandler // CreateUsersWithListInputHandler sets the operation handler for the create users with list input operation CreateUsersWithListInputHandler user.CreateUsersWithListInputHandler // DeleteOrderHandler sets the operation handler for the delete order operation DeleteOrderHandler store.DeleteOrderHandler // DeletePetHandler sets the operation handler for the delete pet operation DeletePetHandler pet.DeletePetHandler // DeleteUserHandler sets the operation handler for the delete user operation DeleteUserHandler user.DeleteUserHandler // FindPetsByStatusHandler sets the operation handler for the find pets by status operation FindPetsByStatusHandler pet.FindPetsByStatusHandler // FindPetsByTagsHandler sets the operation handler for the find pets by tags operation FindPetsByTagsHandler pet.FindPetsByTagsHandler // GetOrderByIDHandler sets the operation handler for the get order by id operation GetOrderByIDHandler store.GetOrderByIDHandler // GetPetByIDHandler sets the operation handler for the get pet by id operation GetPetByIDHandler pet.GetPetByIDHandler // GetUserByNameHandler sets the operation handler for the get user by name operation GetUserByNameHandler user.GetUserByNameHandler // LoginUserHandler sets the operation handler for the login user operation LoginUserHandler user.LoginUserHandler // LogoutUserHandler sets the operation handler for the logout user operation LogoutUserHandler user.LogoutUserHandler // PlaceOrderHandler sets the operation handler for the place order operation PlaceOrderHandler store.PlaceOrderHandler // UpdatePetHandler sets the operation handler for the update pet operation UpdatePetHandler pet.UpdatePetHandler // UpdatePetWithFormHandler sets the operation handler for the update pet with form operation UpdatePetWithFormHandler pet.UpdatePetWithFormHandler // UpdateUserHandler sets the operation handler for the update user operation UpdateUserHandler user.UpdateUserHandler // ServeError is called when an error is received, there is a default handler // but you can set your own with this ServeError func(http.ResponseWriter, *http.Request, error) // contains filtered or unexported fields }
PetstoreAPI This is a sample server Petstore server.
[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net.
For this sample, you can use the api key `special-key` to test the authorization filters
func NewPetstoreAPI ¶
func NewPetstoreAPI(spec *spec.Document) *PetstoreAPI
NewPetstoreAPI creates a new Petstore instance
func (*PetstoreAPI) AuthenticatorsFor ¶
func (o *PetstoreAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]httpkit.Authenticator
AuthenticatorsFor gets the authenticators for the specified security schemes
func (*PetstoreAPI) ConsumersFor ¶
func (o *PetstoreAPI) ConsumersFor(mediaTypes []string) map[string]httpkit.Consumer
ConsumersFor gets the consumers for the specified media types
func (*PetstoreAPI) DefaultConsumes ¶
func (o *PetstoreAPI) DefaultConsumes() string
DefaultConsumes returns the default consumes media type
func (*PetstoreAPI) DefaultProduces ¶
func (o *PetstoreAPI) DefaultProduces() string
DefaultProduces returns the default produces media type
func (*PetstoreAPI) Formats ¶
func (o *PetstoreAPI) Formats() strfmt.Registry
Formats returns the registered string formats
func (*PetstoreAPI) HandlerFor ¶
func (o *PetstoreAPI) HandlerFor(operationID string) (http.Handler, bool)
HandlerFor gets a http.Handler for the provided operation id
func (*PetstoreAPI) ProducersFor ¶
func (o *PetstoreAPI) ProducersFor(mediaTypes []string) map[string]httpkit.Producer
ProducersFor gets the producers for the specified media types
func (*PetstoreAPI) RegisterFormat ¶
RegisterFormat registers a custom format validator
func (*PetstoreAPI) Serve ¶
func (o *PetstoreAPI) Serve(builder middleware.Builder) http.Handler
Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
func (*PetstoreAPI) ServeErrorFor ¶
func (o *PetstoreAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
ServeErrorFor gets a error handler for a given operation id
func (*PetstoreAPI) SetDefaultConsumes ¶
func (o *PetstoreAPI) SetDefaultConsumes(mediaType string)
SetDefaultConsumes returns the default consumes media type
func (*PetstoreAPI) SetDefaultProduces ¶
func (o *PetstoreAPI) SetDefaultProduces(mediaType string)
SetDefaultProduces sets the default produces media type
func (*PetstoreAPI) Validate ¶
func (o *PetstoreAPI) Validate() error
Validate validates the registrations in the PetstoreAPI