58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package operations
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the generate command
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
context "golang.org/x/net/context"
|
|
|
|
middleware "github.com/go-openapi/runtime/middleware"
|
|
)
|
|
|
|
// GetHandlerFunc turns a function with the right signature into a get handler
|
|
type GetHandlerFunc func(context.Context, GetParams) middleware.Responder
|
|
|
|
// Handle executing the request and returning a response
|
|
func (fn GetHandlerFunc) Handle(ctx context.Context, params GetParams) middleware.Responder {
|
|
return fn(ctx, params)
|
|
}
|
|
|
|
// GetHandler interface for that can handle valid get params
|
|
type GetHandler interface {
|
|
Handle(context.Context, GetParams) middleware.Responder
|
|
}
|
|
|
|
// NewGet creates a new http.Handler for the get operation
|
|
func NewGet(ctx *middleware.Context, handler GetHandler) *Get {
|
|
return &Get{Context: ctx, Handler: handler}
|
|
}
|
|
|
|
/*Get swagger:route GET / get
|
|
|
|
Lists all the endpoints
|
|
|
|
List of the endpoints.
|
|
|
|
*/
|
|
type Get struct {
|
|
Context *middleware.Context
|
|
Handler GetHandler
|
|
}
|
|
|
|
func (o *Get) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|
route, _ := o.Context.RouteInfo(r)
|
|
var Params = NewGetParams()
|
|
|
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
|
return
|
|
}
|
|
|
|
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
|
|
|
o.Context.Respond(rw, r, route.Produces, route, res)
|
|
|
|
}
|