response

package
v0.5.32 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilResponse = errors.New("response cannot be nil")
)

Functions

func NewRequestErrorBodyData added in v0.5.28

func NewRequestErrorBodyData(
	requestError RequestError,
) *map[string]*[]string

NewRequestErrorBodyData creates a new request errors body data

Types

type FieldError added in v0.5.22

type FieldError struct {
	// contains filtered or unexported fields
}

FieldError struct

func NewFieldError added in v0.5.22

func NewFieldError(
	field, err string, httpStatus int, errorCode ...string,
) *FieldError

NewFieldError creates a new field error

func (*FieldError) Error added in v0.5.24

func (f *FieldError) Error() string

Error returns the field error as a string

func (*FieldError) ErrorCode added in v0.5.28

func (f *FieldError) ErrorCode() *string

ErrorCode returns the error code

func (*FieldError) HTTPStatus added in v0.5.28

func (f *FieldError) HTTPStatus() int

HTTPStatus returns the HTTP status

func (*FieldError) Key added in v0.5.26

func (f *FieldError) Key() string

Key returns the field name

type HeaderError added in v0.5.26

type HeaderError struct {
	// contains filtered or unexported fields
}

HeaderError struct

func NewHeaderError added in v0.5.26

func NewHeaderError(
	header, err string, httpStatus int, errorCode ...string,
) *HeaderError

NewHeaderError creates a new header error

func (*HeaderError) Error added in v0.5.26

func (h *HeaderError) Error() string

Error returns the header error as a string

func (*HeaderError) ErrorCode added in v0.5.28

func (h *HeaderError) ErrorCode() *string

ErrorCode returns the error code

func (*HeaderError) HTTPStatus added in v0.5.28

func (h *HeaderError) HTTPStatus() int

HTTPStatus returns the HTTP status

func (*HeaderError) Key added in v0.5.26

func (h *HeaderError) Key() string

Key returns the header name

type JSendBody added in v0.5.17

type JSendBody struct {
	Status  string      `json:"status"`
	Data    interface{} `json:"data"`
	Message *string     `json:"message,omitempty"`
	Code    *string     `json:"code,omitempty"`
}

JSendBody struct

func NewJSendErrorBody added in v0.5.17

func NewJSendErrorBody(
	message string,
	data interface{},
	code *string,
) *JSendBody

NewJSendErrorBody creates a new error response body

func NewJSendFailBody added in v0.5.17

func NewJSendFailBody(
	data interface{},
	code *string,
) *JSendBody

NewJSendFailBody creates a new fail response body

func NewJSendSuccessBody added in v0.5.17

func NewJSendSuccessBody(
	data interface{},
) *JSendBody

NewJSendSuccessBody creates a new success response body

type ParameterError added in v0.5.26

type ParameterError struct {
	// contains filtered or unexported fields
}

ParameterError struct

func NewParameterError added in v0.5.26

func NewParameterError(
	parameter, err string, httpStatus int, errorCode ...string,
) *ParameterError

NewParameterError creates a new parameter error

func (*ParameterError) Error added in v0.5.26

func (p *ParameterError) Error() string

Error returns the parameter error as a string

func (*ParameterError) ErrorCode added in v0.5.28

func (p *ParameterError) ErrorCode() *string

ErrorCode returns the error code

func (*ParameterError) HTTPStatus added in v0.5.28

func (p *ParameterError) HTTPStatus() int

HTTPStatus returns the HTTP status

func (*ParameterError) Key added in v0.5.26

func (p *ParameterError) Key() string

Key returns the parameter name

type RequestError added in v0.5.26

type RequestError interface {
	Key() string
	Error() string
	HTTPStatus() int
	ErrorCode() *string
}

RequestError struct

type Response added in v0.3.0

type Response struct {
	// contains filtered or unexported fields
}

Response struct

func NewDebugErrorResponse added in v0.4.6

func NewDebugErrorResponse(
	err error,
	debugErr error,
	data interface{},
	errorCode *string,
	httpStatus int,
) *Response

NewDebugErrorResponse creates a new error response

func NewDebugFailResponse added in v0.5.0

func NewDebugFailResponse(
	data interface{},
	debugData interface{},
	errorCode *string,
	httpStatus int,
) *Response

NewDebugFailResponse creates a new fail response

func NewDebugSuccessResponse added in v0.5.0

func NewDebugSuccessResponse(
	data interface{},
	debugData interface{},
	httpStatus int,
) *Response

NewDebugSuccessResponse creates a new success response

func NewErrorResponse

func NewErrorResponse(
	err error,
	data interface{},
	errorCode *string,
	httpStatus int,
) *Response

NewErrorResponse creates a new error response

func NewFailResponse added in v0.5.0

func NewFailResponse(
	data interface{},
	errorCode *string,
	httpStatus int,
) *Response

NewFailResponse creates a new fail response

func NewFailResponseFromRequestError added in v0.5.28

func NewFailResponseFromRequestError(
	requestError RequestError,
) *Response

NewFailResponseFromRequestError creates a new fail response from a request error

func NewSuccessResponse added in v0.5.0

func NewSuccessResponse(
	data interface{},
	httpStatus int,
) *Response

NewSuccessResponse creates a new success response

func (*Response) GetBody added in v0.5.17

func (r *Response) GetBody(mode *goflagsmode.Flag) interface{}

GetBody returns the response body

func (*Response) GetHTTPStatus added in v0.5.17

func (r *Response) GetHTTPStatus() int

GetHTTPStatus returns the HTTP status

Jump to

Keyboard shortcuts

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