swagger

package
v0.1.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerToJSONEndpoint

func HandlerToJSONEndpoint(h Handler) server.JSONEndpoint

HandlerToJSONEndpoint converts a handler to a proper Gizmo JSONEndpoint.

Types

type ErrorResponse

type ErrorResponse struct {
	// the error message
	//
	// in: body
	Message string `json:"error"`
	// contains filtered or unexported fields
}

ErrorResponse represents the basic error returned by the API on operation failures.

swagger:response genericError

func NewErrorResponse

func NewErrorResponse(err error) *ErrorResponse

NewErrorResponse creates a new ErrorResponse with the given error. The default status code for error responses is 500 (InternalServerError). Use the method WithError to customize it.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error returns the underlying error message.

func (*ErrorResponse) Result

func (r *ErrorResponse) Result() (int, interface{}, error)

Result ensures that ErrorResponse implements the interface Handler.

func (*ErrorResponse) WithStatus

func (r *ErrorResponse) WithStatus(status int) *ErrorResponse

WithStatus creates a new copy of ErrorResponse using the given status.

type GizmoJSONResponse

type GizmoJSONResponse interface {
	Result() (int, interface{}, error)
}

GizmoJSONResponse represents a response type that can be converted to Gizmo's JSONEndpoint result format.

type Handler

type Handler func(*http.Request) GizmoJSONResponse

Handler represents a function that receives an HTTP request and returns a GizmoJSONResponse. It's a Gizmo JSONEndpoint structured for goswagger's annotation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL