message

package
v2.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorResponse

func GetErrorResponse(ctx context.Context, messagePool *pool.Pool, code codes.Code, token message.Token, err error) (*pool.Message, func())

func GetResourceInterface

func GetResourceInterface(msg *mux.Message) string

Get resource interface from request query.

func GetResponse

func GetResponse(ctx context.Context, messagePool *pool.Pool, code codes.Code, token message.Token, contentFormat message.MediaType, payload []byte) (*pool.Message, func())

func IsTempError added in v2.2.4

func IsTempError(err error) bool

IsTempError returns true if error is temporary. Only certain errors are not considered as temporary errors.

func URIToDeviceIDHref

func URIToDeviceIDHref(msg *mux.Message) (deviceID, href string, err error)

URIToDeviceIDHref convert uri to deviceID and href. Expected input "/api/v1/devices/{deviceID}/{Href}".

Types

type JsonCoapMessage added in v2.2.4

type JsonCoapMessage struct {
	Code          string      `json:"code,omitempty"`
	Path          string      `json:"href,omitempty"`
	Token         string      `json:"token,omitempty"`
	Queries       []string    `json:"queries,omitempty"`
	Observe       *uint32     `json:"observe,omitempty"`
	ContentFormat string      `json:"contentFormat,omitempty"`
	Body          interface{} `json:"body,omitempty"`
	Etag          []byte      `json:"etag,omitempty"`
}

func ToJson added in v2.2.4

func ToJson(m *pool.Message, withBody, withToken bool) JsonCoapMessage

func (JsonCoapMessage) IsEmpty added in v2.2.4

func (c JsonCoapMessage) IsEmpty() bool

Jump to

Keyboard shortcuts

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