github.com/emreu/go-swagger@v0.22.1/examples/task-tracker/restapi/operations/tasks/get_task_details.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package tasks 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the generate command 7 8 import ( 9 "net/http" 10 11 middleware "github.com/go-openapi/runtime/middleware" 12 ) 13 14 // GetTaskDetailsHandlerFunc turns a function with the right signature into a get task details handler 15 type GetTaskDetailsHandlerFunc func(GetTaskDetailsParams) middleware.Responder 16 17 // Handle executing the request and returning a response 18 func (fn GetTaskDetailsHandlerFunc) Handle(params GetTaskDetailsParams) middleware.Responder { 19 return fn(params) 20 } 21 22 // GetTaskDetailsHandler interface for that can handle valid get task details params 23 type GetTaskDetailsHandler interface { 24 Handle(GetTaskDetailsParams) middleware.Responder 25 } 26 27 // NewGetTaskDetails creates a new http.Handler for the get task details operation 28 func NewGetTaskDetails(ctx *middleware.Context, handler GetTaskDetailsHandler) *GetTaskDetails { 29 return &GetTaskDetails{Context: ctx, Handler: handler} 30 } 31 32 /*GetTaskDetails swagger:route GET /tasks/{id} tasks getTaskDetails 33 34 Gets the details for a task. 35 36 The details view has more information than the card view. 37 You can see who reported the issue and who last updated it when. 38 39 There are also comments for each issue. 40 41 42 */ 43 type GetTaskDetails struct { 44 Context *middleware.Context 45 Handler GetTaskDetailsHandler 46 } 47 48 func (o *GetTaskDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 49 route, rCtx, _ := o.Context.RouteInfo(r) 50 if rCtx != nil { 51 r = rCtx 52 } 53 var Params = NewGetTaskDetailsParams() 54 55 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 56 o.Context.Respond(rw, r, route.Produces, route, err) 57 return 58 } 59 60 res := o.Handler.Handle(Params) // actually handle the request 61 62 o.Context.Respond(rw, r, route.Produces, route, res) 63 64 }