operations

package
v0.0.0-...-a73732d Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountdownAPI

type CountdownAPI struct {

	// JSONConsumer registers a consumer for a "application/json" mime type
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for a "application/json" mime type
	JSONProducer runtime.Producer

	// ElapseHandler sets the operation handler for the elapse operation
	ElapseHandler ElapseHandler

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

	// ServerShutdown is called when the HTTP(S) server is shut down and done
	// handling all active connections and does not accept connections any more
	ServerShutdown func()

	// Custom command line argument groups with their descriptions
	CommandLineOptionsGroups []swag.CommandLineOptionsGroup

	// User defined logger function.
	Logger func(string, ...interface{})
	// contains filtered or unexported fields
}

CountdownAPI Example server for emitting newline delimited JSON

func NewCountdownAPI

func NewCountdownAPI(spec *loads.Document) *CountdownAPI

NewCountdownAPI creates a new Countdown instance

func (*CountdownAPI) AuthenticatorsFor

func (o *CountdownAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*CountdownAPI) ConsumersFor

func (o *CountdownAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer

ConsumersFor gets the consumers for the specified media types

func (*CountdownAPI) DefaultConsumes

func (o *CountdownAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*CountdownAPI) DefaultProduces

func (o *CountdownAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*CountdownAPI) Formats

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

Formats returns the registered string formats

func (*CountdownAPI) HandlerFor

func (o *CountdownAPI) HandlerFor(method, path string) (http.Handler, bool)

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

func (*CountdownAPI) ProducersFor

func (o *CountdownAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer

ProducersFor gets the producers for the specified media types

func (*CountdownAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*CountdownAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*CountdownAPI) SetDefaultConsumes

func (o *CountdownAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*CountdownAPI) SetDefaultProduces

func (o *CountdownAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*CountdownAPI) SetSpec

func (o *CountdownAPI) SetSpec(spec *loads.Document)

SetSpec sets a spec that will be served for the clients.

func (*CountdownAPI) Validate

func (o *CountdownAPI) Validate() error

Validate validates the registrations in the CountdownAPI

type Elapse

type Elapse struct {
	Context *middleware.Context
	Handler ElapseHandler
}

Elapse swagger:route GET /elapse/{length} elapse

Count down the number of seconds

Count down the seconds remaining

func NewElapse

func NewElapse(ctx *middleware.Context, handler ElapseHandler) *Elapse

NewElapse creates a new http.Handler for the elapse operation

func (*Elapse) ServeHTTP

func (o *Elapse) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type ElapseForbidden

type ElapseForbidden struct {
}

ElapseForbidden Contrived - thrown when length of 11 is chosen

swagger:response elapseForbidden

func NewElapseForbidden

func NewElapseForbidden() *ElapseForbidden

NewElapseForbidden creates ElapseForbidden with default headers values

func (*ElapseForbidden) WriteResponse

func (o *ElapseForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type ElapseHandler

type ElapseHandler interface {
	Handle(ElapseParams) middleware.Responder
}

ElapseHandler interface for that can handle valid elapse params

type ElapseHandlerFunc

type ElapseHandlerFunc func(ElapseParams) middleware.Responder

ElapseHandlerFunc turns a function with the right signature into a elapse handler

func (ElapseHandlerFunc) Handle

Handle executing the request and returning a response

type ElapseOK

type ElapseOK struct {

	// In: body
	Payload io.ReadCloser `json:"body,omitempty"`
}

ElapseOK Secondly update on remaining time

swagger:response elapseOK

func NewElapseOK

func NewElapseOK() *ElapseOK

NewElapseOK creates ElapseOK with default headers values

func (*ElapseOK) SetPayload

func (o *ElapseOK) SetPayload(payload io.ReadCloser)

SetPayload sets the payload to the elapse o k response

func (*ElapseOK) WithPayload

func (o *ElapseOK) WithPayload(payload io.ReadCloser) *ElapseOK

WithPayload adds the payload to the elapse o k response

func (*ElapseOK) WriteResponse

func (o *ElapseOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type ElapseParams

type ElapseParams struct {

	// HTTP Request Object
	HTTPRequest *http.Request

	/*How many seconds to count down
	  Required: true
	  Maximum: 30
	  Minimum: 2
	  In: path
	*/
	Length int64
}

ElapseParams contains all the bound params for the elapse operation typically these are obtained from a http.Request

swagger:parameters elapse

func NewElapseParams

func NewElapseParams() ElapseParams

NewElapseParams creates a new ElapseParams object with the default values initialized.

func (*ElapseParams) BindRequest

func (o *ElapseParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls

Jump to

Keyboard shortcuts

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