Files
gerald/internal/interfaces/rest/restapi/operations/feedback/upvote_feedback.go
aspasskiy ed403c2c72
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing
upvotes
2024-04-23 19:13:48 +03:00

59 lines
1.7 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package feedback
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
)
// UpvoteFeedbackHandlerFunc turns a function with the right signature into a upvote feedback handler
type UpvoteFeedbackHandlerFunc func(UpvoteFeedbackParams) middleware.Responder
// Handle executing the request and returning a response
func (fn UpvoteFeedbackHandlerFunc) Handle(params UpvoteFeedbackParams) middleware.Responder {
return fn(params)
}
// UpvoteFeedbackHandler interface for that can handle valid upvote feedback params
type UpvoteFeedbackHandler interface {
Handle(UpvoteFeedbackParams) middleware.Responder
}
// NewUpvoteFeedback creates a new http.Handler for the upvote feedback operation
func NewUpvoteFeedback(ctx *middleware.Context, handler UpvoteFeedbackHandler) *UpvoteFeedback {
return &UpvoteFeedback{Context: ctx, Handler: handler}
}
/*
UpvoteFeedback swagger:route POST /feedback/{feedback_uuid}/vote feedback upvoteFeedback
# Upvote a feedback
Upvote a feedback
*/
type UpvoteFeedback struct {
Context *middleware.Context
Handler UpvoteFeedbackHandler
}
func (o *UpvoteFeedback) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewUpvoteFeedbackParams()
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(Params) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}