functionbuilder

This commit is contained in:
Nathan Coad
2023-02-10 15:15:53 +11:00
parent 7504ea61e8
commit 329f1e518c
27 changed files with 3343 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
// Code generated by go-swagger; DO NOT EDIT.
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"
"github.com/go-openapi/runtime/middleware"
)
// DeleteHandlerFunc turns a function with the right signature into a delete handler
type DeleteHandlerFunc func(DeleteParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteHandlerFunc) Handle(params DeleteParams) middleware.Responder {
return fn(params)
}
// DeleteHandler interface for that can handle valid delete params
type DeleteHandler interface {
Handle(DeleteParams) middleware.Responder
}
// NewDelete creates a new http.Handler for the delete operation
func NewDelete(ctx *middleware.Context, handler DeleteHandler) *Delete {
return &Delete{Context: ctx, Handler: handler}
}
/* Delete swagger:route DELETE / delete
Delete delete API
*/
type Delete struct {
Context *middleware.Context
Handler DeleteHandler
}
func (o *Delete) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDeleteParams()
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)
}