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() 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 {
// XMLConsumer registers a consumer for a "application/xml" mime type
XMLConsumer httpkit.Consumer
// JSONConsumer registers a consumer for a "application/json" mime type
JSONConsumer 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) (*models.User, error)
// GetPetByIDHandler sets the operation handler for the get pet by id operation
GetPetByIDHandler pet.GetPetByIDHandler
// LogoutUserHandler sets the operation handler for the logout user operation
LogoutUserHandler user.LogoutUserHandler
// DeleteUserHandler sets the operation handler for the delete user operation
DeleteUserHandler user.DeleteUserHandler
// DeleteOrderHandler sets the operation handler for the delete order operation
DeleteOrderHandler store.DeleteOrderHandler
// UpdateUserHandler sets the operation handler for the update user operation
UpdateUserHandler user.UpdateUserHandler
// LoginUserHandler sets the operation handler for the login user operation
LoginUserHandler user.LoginUserHandler
// DeletePetHandler sets the operation handler for the delete pet operation
DeletePetHandler pet.DeletePetHandler
// UpdatePetHandler sets the operation handler for the update pet operation
UpdatePetHandler pet.UpdatePetHandler
// CreateUsersWithListInputHandler sets the operation handler for the create users with list input operation
CreateUsersWithListInputHandler user.CreateUsersWithListInputHandler
// 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
// FindPetsByStatusHandler sets the operation handler for the find pets by status operation
FindPetsByStatusHandler pet.FindPetsByStatusHandler
// GetUserByNameHandler sets the operation handler for the get user by name operation
GetUserByNameHandler user.GetUserByNameHandler
// PlaceOrderHandler sets the operation handler for the place order operation
PlaceOrderHandler store.PlaceOrderHandler
// UpdatePetWithFormHandler sets the operation handler for the update pet with form operation
UpdatePetWithFormHandler pet.UpdatePetWithFormHandler
// GetOrderByIDHandler sets the operation handler for the get order by id operation
GetOrderByIDHandler store.GetOrderByIDHandler
// FindPetsByTagsHandler sets the operation handler for the find pets by tags operation
FindPetsByTagsHandler pet.FindPetsByTagsHandler
// CreateUsersWithArrayInputHandler sets the operation handler for the create users with array input operation
CreateUsersWithArrayInputHandler user.CreateUsersWithArrayInputHandler
// 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() http.Handler
Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve())
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