swagger

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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