envelope

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	XMLName    xml.Name    `json:"-" xml:"envelope"`
	StatusCode int         `json:"-" xml:"-"`
	Status     Status      `json:"status" xml:"status"`
	Data       interface{} `json:"data,omitempty" xml:"data,omitempty"`
}

Envelope identifies the structure used to define a normalized endpoint response

func NewEnvelope

func NewEnvelope(statusCode int, data interface{}) Envelope

NewEnvelope instantiates a new response data envelope structure

func (Envelope) AddError

func (s Envelope) AddError(err Error) Envelope

AddError add a new error to the response envelope instance

func (Envelope) SetEndpoint

func (s Envelope) SetEndpoint(val int) Envelope

SetEndpoint assign the endpoint identifier to all stored error codes

func (Envelope) SetService

func (s Envelope) SetService(val int) Envelope

SetService assign the service identifier to all stored error codes

type Error

type Error struct {
	Service  int    `json:"-" xml:"-"`
	Endpoint int    `json:"-" xml:"-"`
	Param    int    `json:"-" xml:"-"`
	Error    int    `json:"-" xml:"-"`
	Code     string `json:"code" xml:"code"`
	Message  string `json:"message" xml:"message"`
}

Error @todo doc

func NewError

func NewError(err int, msg string) Error

NewError @todo doc

func (Error) SetEndpoint

func (e Error) SetEndpoint(val int) Error

SetEndpoint @todo doc

func (Error) SetError

func (e Error) SetError(err int) Error

SetError @todo doc

func (Error) SetMessage

func (e Error) SetMessage(msg string) Error

SetMessage @todo doc

func (Error) SetParam

func (e Error) SetParam(param int) Error

SetParam @todo doc

func (Error) SetService

func (e Error) SetService(val int) Error

SetService @todo doc

type Status

type Status struct {
	Status bool    `json:"status" xml:"status"`
	Errors []Error `json:"errors" xml:"errors"`
}

Status @todo doc

func NewStatus

func NewStatus() Status

NewStatus @todo doc

func (Status) AddError

func (s Status) AddError(err Error) Status

AddError @todo doc

func (Status) SetEndpoint

func (s Status) SetEndpoint(val int) Status

SetEndpoint @todo doc

func (Status) SetService

func (s Status) SetService(val int) Status

SetService @todo doc

Jump to

Keyboard shortcuts

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