message

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 14 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

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"`
}

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