responses

package
v0.0.0-...-b7aaf62 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ForbiddenResponse           = ResponseType{false, nil, &ErrorWrap{"Forbidden", http.StatusForbidden, nil}}
	UnauthorizedResponse        = ResponseType{false, nil, &ErrorWrap{"Unauthorized", http.StatusUnauthorized, nil}}
	InternalServerErrorResponse = ResponseType{false, nil, &ErrorWrap{"Internal Server Error", http.StatusInternalServerError, nil}}
	BadRequestResponse          = ResponseType{false, nil, &ErrorWrap{"Bad Request", http.StatusBadRequest, nil}}
)

Functions

This section is empty.

Types

type ErrorWrap

type ErrorWrap struct {
	Message string      `json:"message"`
	Code    int         `json:"code"`
	Data    interface{} `json:"data"`
}

type ResponseType

type ResponseType struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
	Error   *ErrorWrap  `json:"error"`
}

func ErrorResponse

func ErrorResponse(code int, message string) ResponseType

Jump to

Keyboard shortcuts

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