Help us shape the future of Go! Take the 2026 Go Developer Survey

operations

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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)

	// PetAddPetHandler sets the operation handler for the add pet operation
	PetAddPetHandler pet.AddPetHandler
	// UserCreateUserHandler sets the operation handler for the create user operation
	UserCreateUserHandler user.CreateUserHandler
	// UserCreateUsersWithArrayInputHandler sets the operation handler for the create users with array input operation
	UserCreateUsersWithArrayInputHandler user.CreateUsersWithArrayInputHandler
	// UserCreateUsersWithListInputHandler sets the operation handler for the create users with list input operation
	UserCreateUsersWithListInputHandler user.CreateUsersWithListInputHandler
	// StoreDeleteOrderHandler sets the operation handler for the delete order operation
	StoreDeleteOrderHandler store.DeleteOrderHandler
	// PetDeletePetHandler sets the operation handler for the delete pet operation
	PetDeletePetHandler pet.DeletePetHandler
	// UserDeleteUserHandler sets the operation handler for the delete user operation
	UserDeleteUserHandler user.DeleteUserHandler
	// PetFindPetsByStatusHandler sets the operation handler for the find pets by status operation
	PetFindPetsByStatusHandler pet.FindPetsByStatusHandler
	// PetFindPetsByTagsHandler sets the operation handler for the find pets by tags operation
	PetFindPetsByTagsHandler pet.FindPetsByTagsHandler
	// StoreGetInventoryHandler sets the operation handler for the get inventory operation
	StoreGetInventoryHandler store.GetInventoryHandler
	// StoreGetOrderByIDHandler sets the operation handler for the get order by id operation
	StoreGetOrderByIDHandler store.GetOrderByIDHandler
	// PetGetPetByIDHandler sets the operation handler for the get pet by id operation
	PetGetPetByIDHandler pet.GetPetByIDHandler
	// UserGetUserByNameHandler sets the operation handler for the get user by name operation
	UserGetUserByNameHandler user.GetUserByNameHandler
	// UserLoginUserHandler sets the operation handler for the login user operation
	UserLoginUserHandler user.LoginUserHandler
	// UserLogoutUserHandler sets the operation handler for the logout user operation
	UserLogoutUserHandler user.LogoutUserHandler
	// StorePlaceOrderHandler sets the operation handler for the place order operation
	StorePlaceOrderHandler store.PlaceOrderHandler
	// PetUpdatePetHandler sets the operation handler for the update pet operation
	PetUpdatePetHandler pet.UpdatePetHandler
	// PetUpdatePetWithFormHandler sets the operation handler for the update pet with form operation
	PetUpdatePetWithFormHandler pet.UpdatePetWithFormHandler
	// UserUpdateUserHandler sets the operation handler for the update user operation
	UserUpdateUserHandler user.UpdateUserHandler
	// PetUploadFileHandler sets the operation handler for the upload file operation
	PetUploadFileHandler pet.UploadFileHandler

	// 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. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). 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(method, path string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation method and path

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

func (o *PetstoreAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL