operations

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2015 License: Apache-2.0 Imports: 9 Imported by: 104

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ToDoListAPI

type ToDoListAPI struct {

	// JSONConsumer registers a consumer for a "application/io.swagger.examples.todo-list.v1+json" mime type
	JSONConsumer httpkit.Consumer

	// JSONProducer registers a producer for a "application/io.swagger.examples.todo-list.v1+json" mime type
	JSONProducer httpkit.Producer

	// KeyAuth registers a function that takes a token and returns a principal
	// it performs authentication based on an api key x-petstore-token provided in the header
	KeyAuth func(string) (interface{}, error)

	// AddOneHandler sets the operation handler for the add one operation
	AddOneHandler todos.AddOneHandler
	// DestroyOneHandler sets the operation handler for the destroy one operation
	DestroyOneHandler todos.DestroyOneHandler
	// FindHandler sets the operation handler for the find operation
	FindHandler todos.FindHandler
	// UpdateOneHandler sets the operation handler for the update one operation
	UpdateOneHandler todos.UpdateOneHandler

	// 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
}

ToDoListAPI the to do list API

func NewToDoListAPI

func NewToDoListAPI(spec *spec.Document) *ToDoListAPI

NewToDoListAPI creates a new ToDoList instance

func (*ToDoListAPI) AuthenticatorsFor

func (o *ToDoListAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]httpkit.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*ToDoListAPI) ConsumersFor

func (o *ToDoListAPI) ConsumersFor(mediaTypes []string) map[string]httpkit.Consumer

ConsumersFor gets the consumers for the specified media types

func (*ToDoListAPI) DefaultConsumes

func (o *ToDoListAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*ToDoListAPI) DefaultProduces

func (o *ToDoListAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*ToDoListAPI) Formats

func (o *ToDoListAPI) Formats() strfmt.Registry

Formats returns the registered string formats

func (*ToDoListAPI) HandlerFor

func (o *ToDoListAPI) HandlerFor(operationID string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation id

func (*ToDoListAPI) ProducersFor

func (o *ToDoListAPI) ProducersFor(mediaTypes []string) map[string]httpkit.Producer

ProducersFor gets the producers for the specified media types

func (*ToDoListAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*ToDoListAPI) Serve

func (o *ToDoListAPI) 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 (*ToDoListAPI) ServeErrorFor

func (o *ToDoListAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)

ServeErrorFor gets a error handler for a given operation id

func (*ToDoListAPI) SetDefaultConsumes

func (o *ToDoListAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*ToDoListAPI) SetDefaultProduces

func (o *ToDoListAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*ToDoListAPI) Validate

func (o *ToDoListAPI) Validate() error

Validate validates the registrations in the ToDoListAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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