Documentation ¶
Index ¶
- Constants
- type CountdownAPI
- func (o *CountdownAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator
- func (o *CountdownAPI) Authorizer() runtime.Authorizer
- func (o *CountdownAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer
- func (o *CountdownAPI) Context() *middleware.Context
- func (o *CountdownAPI) DefaultConsumes() string
- func (o *CountdownAPI) DefaultProduces() string
- func (o *CountdownAPI) Formats() strfmt.Registry
- func (o *CountdownAPI) HandlerFor(method, path string) (http.Handler, bool)
- func (o *CountdownAPI) Init()
- func (o *CountdownAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer
- func (o *CountdownAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)
- func (o *CountdownAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)
- func (o *CountdownAPI) RegisterProducer(mediaType string, producer runtime.Producer)
- func (o *CountdownAPI) Serve(builder middleware.Builder) http.Handler
- func (o *CountdownAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)
- func (o *CountdownAPI) SetDefaultConsumes(mediaType string)
- func (o *CountdownAPI) SetDefaultProduces(mediaType string)
- func (o *CountdownAPI) SetSpec(spec *loads.Document)
- func (o *CountdownAPI) Validate() error
- type Elapse
- type ElapseForbidden
- type ElapseHandler
- type ElapseHandlerFunc
- type ElapseOK
- type ElapseParams
- type ElapseURL
- func (o *ElapseURL) Build() (*url.URL, error)
- func (o *ElapseURL) BuildFull(scheme, host string) (*url.URL, error)
- func (o *ElapseURL) Must(u *url.URL, err error) *url.URL
- func (o *ElapseURL) SetBasePath(bp string)
- func (o *ElapseURL) String() string
- func (o *ElapseURL) StringFull(scheme, host string) string
- func (o *ElapseURL) WithBasePath(bp string) *ElapseURL
Constants ¶
const ElapseForbiddenCode int = 403
ElapseForbiddenCode is the HTTP code returned for type ElapseForbidden
const ElapseOKCode int = 200
ElapseOKCode is the HTTP code returned for type ElapseOK
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountdownAPI ¶
type CountdownAPI struct { Middleware func(middleware.Builder) http.Handler // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. // It has a default implemention in the security package, however you can replace it for your particular usage. BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. // It has a default implemention in the security package, however you can replace it for your particular usage. APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. // It has a default implemention in the security package, however you can replace it for your particular usage. BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator // 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) Authorizer ¶
func (o *CountdownAPI) Authorizer() runtime.Authorizer
Authorizer returns the registered authorizer
func (*CountdownAPI) ConsumersFor ¶
func (o *CountdownAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer
ConsumersFor gets the consumers for the specified media types
func (*CountdownAPI) Context ¶
func (o *CountdownAPI) Context() *middleware.Context
Context returns the middleware context for the countdown API
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) Init ¶
func (o *CountdownAPI) Init()
Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
func (*CountdownAPI) ProducersFor ¶
func (o *CountdownAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer
ProducersFor gets the producers for the specified media types
func (*CountdownAPI) RegisterConsumer ¶
func (o *CountdownAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)
RegisterConsumer allows you to add (or override) a consumer for a media type.
func (*CountdownAPI) RegisterFormat ¶
func (o *CountdownAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)
RegisterFormat registers a custom format validator
func (*CountdownAPI) RegisterProducer ¶
func (o *CountdownAPI) RegisterProducer(mediaType string, producer runtime.Producer)
RegisterProducer allows you to add (or override) a producer for a media type.
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
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 ¶
func (fn ElapseHandlerFunc) Handle(params ElapseParams) middleware.Responder
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 `json:"-"` /*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 no default values defined in spec.
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.
To ensure default values, the struct must have been initialized with NewElapseParams() beforehand.
type ElapseURL ¶
type ElapseURL struct { Length int64 // contains filtered or unexported fields }
ElapseURL generates an URL for the elapse operation
func (*ElapseURL) SetBasePath ¶
SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string
func (*ElapseURL) StringFull ¶
StringFull returns the string representation of a complete url
func (*ElapseURL) WithBasePath ¶
WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string