httpx

package
v0.0.0-...-1bd3253 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseError

type BaseError struct {
	Code         int          `json:"code"`    // One of a server-defined set of error codes.
	Message      string       `json:"message"` // A human-readable representation of the error.
	ErrorMessage string       `json:"errorMessage"`
	Details      []InnerError `json:"details"` // Optional, An array of Details about specific errors that led to this reported error.
}

BaseError base error wich will be shown to the client

type Builder

type Builder struct {
	GenericResponse
}

func NewResponseBuilder

func NewResponseBuilder() *Builder

func (*Builder) Build

func (rb *Builder) Build() GenericResponse

func (*Builder) BuildPointer

func (rb *Builder) BuildPointer() *GenericResponse

func (*Builder) IsSuccess

func (rb *Builder) IsSuccess() *Builder

func (*Builder) SetData

func (rb *Builder) SetData(data interface{}) *Builder

func (*Builder) SetError

func (rb *Builder) SetError(data interface{}) *Builder

type GenericResponse

type GenericResponse struct {
	Success bool        `json:"success"`         // Success - true, false
	Data    interface{} `json:"data"`            // Optional
	Error   *BaseError  `json:"error,omitempty"` // Optional
	Next    string      `json:"next,omitempty"`  // Next Paginated Url
	Prev    string      `json:"prev,omitempty"`  // Prev Paginated Url
}

GenericResponse is an extension of the BaseResponse which contains additional requestUUID tag

func NewError

func NewError(msg errors.CodeMsg) GenericResponse

func NewErrorWithData

func NewErrorWithData(msg errors.CodeMsg, data interface{}) GenericResponse

func NewErrorWithDetails

func NewErrorWithDetails(msg errors.CodeMsg, details []InnerError) GenericResponse

func NewSuccess

func NewSuccess() GenericResponse

func NewSuccessWithData

func NewSuccessWithData(data interface{}) GenericResponse

func (*GenericResponse) UnmarshalData

func (gen *GenericResponse) UnmarshalData(data interface{})

type InnerError

type InnerError struct {
	Field  string            `json:"field"`
	Code   int               `json:"code"`
	Params map[string]string `json:"params,omitempty"`
}

InnerError is an additional error that can be used in validation

Jump to

Keyboard shortcuts

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