marshaller

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Factory = MarshallerFactory{}

Functions

func SendMarshalRequest

func SendMarshalRequest(url string, request interface{}) (result map[string]string, err error)

func SendUnmarshalRequest

func SendUnmarshalRequest(url string, request interface{}) (characteristicData interface{}, err error)

Types

type Configurable

type Configurable struct {
	CharacteristicId string                            `json:"characteristic_id"`
	Values           []ConfigurableCharacteristicValue `json:"values"`
}

type ConfigurableCharacteristicValue

type ConfigurableCharacteristicValue struct {
	Path  string `json:"path"`
	Value string `json:"value"`
}

type ConfigurableV2

type ConfigurableV2 struct {
	Path             string           `json:"path"`
	CharacteristicId string           `json:"characteristic_id"`
	AspectNode       model.AspectNode `json:"aspect_node"`
	FunctionId       string           `json:"function_id"`
	Value            interface{}      `json:"value,omitempty"`
	Type             string           `json:"type,omitempty"`
}

type FactoryInterface

type FactoryInterface interface {
	New(ctx context.Context, url string) Interface
}

type FindConfigurablesRequest

type FindConfigurablesRequest struct {
	CharacteristicId string          `json:"characteristic_id"`
	Services         []model.Service `json:"services"`
}

type Interface

type Interface interface {
	MarshalV2(service model.Service, protocol model.Protocol, data []MarshallingV2RequestData) (result map[string]string, err error)
	UnmarshalV2(request UnmarshallingV2Request) (characteristicData interface{}, err error)

	MarshalFromServiceAndProtocol(characteristicId string, service model.Service, protocol model.Protocol, characteristicData interface{}, configurables []Configurable) (result map[string]string, err error)
	UnmarshalFromServiceAndProtocol(characteristicId string, service model.Service, protocol model.Protocol, message map[string]string, hints []string) (characteristicData interface{}, err error)
}

type Marshaller

type Marshaller struct {
	// contains filtered or unexported fields
}

func New

func New(url string) *Marshaller

func (*Marshaller) Marshal

func (this *Marshaller) Marshal(characteristicId string, serviceId string, characteristicData interface{}, configurables []Configurable) (result map[string]string, err error)

func (*Marshaller) MarshalFromService

func (this *Marshaller) MarshalFromService(characteristicId string, service model.Service, characteristicData interface{}, configurables []Configurable) (result map[string]string, err error)

func (*Marshaller) MarshalFromServiceAndProtocol

func (this *Marshaller) MarshalFromServiceAndProtocol(characteristicId string, service model.Service, protocol model.Protocol, characteristicData interface{}, configurables []Configurable) (result map[string]string, err error)

func (*Marshaller) MarshalV2

func (this *Marshaller) MarshalV2(service model.Service, protocol model.Protocol, data []MarshallingV2RequestData) (result map[string]string, err error)

func (*Marshaller) Unmarshal

func (this *Marshaller) Unmarshal(characteristicId string, serviceId string, message map[string]string, hints []string) (characteristicData interface{}, err error)

func (*Marshaller) UnmarshalFromService

func (this *Marshaller) UnmarshalFromService(characteristicId string, service model.Service, message map[string]string, hints []string) (characteristicData interface{}, err error)

func (*Marshaller) UnmarshalFromServiceAndProtocol

func (this *Marshaller) UnmarshalFromServiceAndProtocol(characteristicId string, service model.Service, protocol model.Protocol, message map[string]string, hints []string) (characteristicData interface{}, err error)

func (*Marshaller) UnmarshalV2

func (this *Marshaller) UnmarshalV2(request UnmarshallingV2Request) (characteristicData interface{}, err error)

type MarshallerFactory

type MarshallerFactory struct{}

func (MarshallerFactory) New

func (this MarshallerFactory) New(ctx context.Context, url string) Interface

type MarshallingRequest

type MarshallingRequest struct {
	Service          model.Service   `json:"service,omitempty"`           //semi-optional, may be determined by request path
	Protocol         *model.Protocol `json:"protocol,omitempty"`          //semi-optional, may be determined by request path
	CharacteristicId string          `json:"characteristic_id,omitempty"` //semi-optional, may be determined by request path
	Configurables    []Configurable  `json:"configurables,omitempty"`     //optional, may be empty
	Data             interface{}     `json:"data"`
}

type MarshallingV2Request

type MarshallingV2Request struct {
	Service  model.Service              `json:"service"`  //semi-optional, may be determined by request path
	Protocol model.Protocol             `json:"protocol"` //semi-optional, may be determined by service
	Data     []MarshallingV2RequestData `json:"data"`
}

type MarshallingV2RequestData

type MarshallingV2RequestData struct {
	Value            interface{}       `json:"value"`
	CharacteristicId string            `json:"characteristic_id"`
	Paths            []string          `json:"paths"`                 //semi-optional, may be determent by FunctionId
	FunctionId       string            `json:"function_id"`           //semi-optional, to determine Paths if they are not set
	AspectNode       *model.AspectNode `json:"aspect_node,omitempty"` //optional, to determine Paths if they are not set, may be empty if only FunctionId should be searched
}

type UnmarshallingRequest

type UnmarshallingRequest struct {
	Service              model.Service     `json:"service,omitempty"`           //semi-optional, may be determined by request path
	Protocol             *model.Protocol   `json:"protocol,omitempty"`          //semi-optional, may be determined by service
	CharacteristicId     string            `json:"characteristic_id,omitempty"` //semi-optional, may be determined by request path
	Message              map[string]string `json:"message"`
	ContentVariableHints []string          `json:"content_variable_hints"` //optional
}

type UnmarshallingV2Request

type UnmarshallingV2Request struct {
	Service          model.Service     `json:"service"`           //semi-optional, may be determined by request path
	Protocol         model.Protocol    `json:"protocol"`          //semi-optional, may be determined by service
	CharacteristicId string            `json:"characteristic_id"` //semi-optional, may be determined by request path
	Message          map[string]string `json:"message"`

	Path         string           `json:"path"`           //semi-optional, may be determent by FunctionId and AspectNode
	FunctionId   string           `json:"function_id"`    //semi-optional, to determine Path if not set
	AspectNode   model.AspectNode `json:"aspect_node"`    //semi-optional, to determine Path if not set, may itself be determent by AspectNodeId
	AspectNodeId string           `json:"aspect_node_id"` //semi-optional, to determine AspectNode if not set
}

Jump to

Keyboard shortcuts

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