response

package
v0.0.0-...-2ec00d9 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Not found")

ErrNotFound indicates that the operation did not return a result

Functions

This section is empty.

Types

type EntityData

type EntityData struct {
	Channel         *channel.ChannelData            `json:"channel,omitempty"`
	Asterisk        *asterisk.AsteriskInfo          `json:"asterisk,omitempty"`
	Bridge          *bridge.BridgeData              `json:"bridge,omitempty"`
	Playback        *play.PlaybackData              `json:"playback,omitempty"`
	StoredRecording *recordings.StoredRecordingData `json:"stored_recording,omitempty"`
	LiveRecording   *recordings.LiveRecordingData   `json:"live_recording,omitempty"`
	ChannelList     []*channel.ChannelData          `json:"channellist,omitempty"`

	Variable string `json:"variable,omitempty"`
}

type Response

type Response struct {
	// Error is the error encountered
	Error string `json:"error"`

	Code int `json:"code,omitempty"`

	// Data is the returned entity data, if applicable
	Data *EntityData `json:"data,omitempty"`

	// Key is the key of the returned entity, if applicable
	Key *key.Key `json:"key,omitempty"`

	// Keys is the list of keys of any matching entities, if applicable
	Keys []*key.Key `json:"keys,omitempty"`
}

func NewErrorResponse

func NewErrorResponse(err error) *Response

NewErrorResponse wraps an error as an ErrorResponse

func (*Response) Err

func (e *Response) Err() error

Err returns an error from the Response. If the response's Error is empty, a nil error is returned. Otherwise, the error will be filled with the value of response.Error.

func (*Response) IsNotFound

func (e *Response) IsNotFound() bool

IsNotFound indicates that the retuned error response was a Not Found error response

Jump to

Keyboard shortcuts

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