Documentation ¶
Index ¶
- type Command
- func (cmd *Command) Attribute(attributePath string) *Command
- func (cmd *Command) Attributes() *Command
- func (cmd *Command) Create(thing *model.Thing) *Command
- func (cmd *Command) Definition() *Command
- func (cmd *Command) Delete() *Command
- func (cmd *Command) Envelope(headerOpts ...protocol.HeaderOpt) *protocol.Envelope
- func (cmd *Command) Feature(featureID string) *Command
- func (cmd *Command) FeatureDefinition(featureID string) *Command
- func (cmd *Command) FeatureDesiredProperties(featureID string) *Command
- func (cmd *Command) FeatureDesiredProperty(featureID, propertyPath string) *Command
- func (cmd *Command) FeatureProperties(featureID string) *Command
- func (cmd *Command) FeatureProperty(featureID, propertyPath string) *Command
- func (cmd *Command) Features() *Command
- func (cmd *Command) Live() *Command
- func (cmd *Command) Merge(payload interface{}) *Command
- func (cmd *Command) Modify(payload interface{}) *Command
- func (cmd *Command) PolicyID() *Command
- func (cmd *Command) Retrieve(thingIDs ...model.NamespacedID) *Command
- func (cmd *Command) Twin() *Command
- type Event
- func (event *Event) Attribute(attributePath string) *Event
- func (event *Event) Attributes() *Event
- func (event *Event) Created(thing *model.Thing) *Event
- func (event *Event) Definition() *Event
- func (event *Event) Deleted() *Event
- func (event *Event) Envelope(headerOpts ...protocol.HeaderOpt) *protocol.Envelope
- func (event *Event) Feature(featureID string) *Event
- func (event *Event) FeatureDefinition(featureID string) *Event
- func (event *Event) FeatureDesiredProperties(featureID string) *Event
- func (event *Event) FeatureDesiredProperty(featureID, propertyPath string) *Event
- func (event *Event) FeatureProperties(featureID string) *Event
- func (event *Event) FeatureProperty(featureID, propertyPath string) *Event
- func (event *Event) Features() *Event
- func (event *Event) Live() *Event
- func (event *Event) Merged(payload interface{}) *Event
- func (event *Event) Modified(payload interface{}) *Event
- func (event *Event) PolicyID() *Event
- func (event *Event) Twin() *Event
- type Message
- func (msg *Message) Envelope(headerOpts ...protocol.HeaderOpt) *protocol.Envelope
- func (msg *Message) Feature(featureID string) *Message
- func (msg *Message) Inbox(subject string) *Message
- func (msg *Message) Outbox(subject string) *Message
- func (msg *Message) WithPayload(payload interface{}) *Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
Command represents a message entity defined by the Ditto protocol for the Things group that defines the execution of a certain action. This is a special Message that is always bound to a specific Thing instance along with providing the capabilities to configure:
- the type of the action it will signal for execution - Create, Modify, Retrieve, Delete
- the channel it will be sent - Twin, Live
- the entity it will affect - the whole Thing (the default), all features of the Thing (Features), a single Feature of the Thing (Feature), all attributes of the Thing (Attributes) or a single attribute of the Thing (Attribute), the Thing's policy (PolicyID) or the Thing's definition (Definition).
Note: Only one action can be configured to the command - if using the methods for configuring it - only the last one applies. Note: Only one channel can be configured to the command - if using the methods for configuring it - only the last one applies. Note: Only one entity that will b affected by the command can be configured - if using the methods for configuring it - only the last one applies.
func NewCommand ¶
func NewCommand(thingID *model.NamespacedID) *Command
NewCommand creates a new Command instance for the defined by the provided NamespacedID Thing.
func (*Command) Attribute ¶
Attribute configures the command to affect a specified attribute of the Thing, defined by the attributePath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Command) Attributes ¶
Attributes configures the command to affect the Thing's attributes.
func (*Command) Definition ¶
Definition configures the command to affect the Thing's definition.
func (*Command) Envelope ¶
Envelope generates the Ditto envelope with command's data applying all configurations and optionally all Headers provided.
func (*Command) Feature ¶
Feature configures the command to affect a specified by the provided featureID feature of the Thing.
func (*Command) FeatureDefinition ¶
FeatureDefinition configures the command to affect the definition of a specified by the provided featureID feature of the Thing.
func (*Command) FeatureDesiredProperties ¶
FeatureDesiredProperties configures the command to affect all desired properties of a specified by the provided featureID feature of the Thing.
func (*Command) FeatureDesiredProperty ¶
FeatureDesiredProperty configures the command to affect a specified desired property via the provided featureID feature of the Thing and the propertyPath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Command) FeatureProperties ¶
FeatureProperties configures the command to affect all properties of a specified by the provided featureID feature of the Thing.
func (*Command) FeatureProperty ¶
FeatureProperty configures the command to affect a specified property via the provided featureID feature of the Thing and the propertyPath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Command) Merge ¶
Merge sets the action of the command instance accordingly. For all merge commands the provided partial payload data is expected to match the defined JSON merge patch format (https://tools.ietf.org/html/rfc7396). In case of conflicts with the existing thing, the value provided in the patch overwrites the existing value. Any provided nil values will be used to remove the referenced thing data.
func (*Command) Modify ¶
Modify sets the action of the command instance accordingly. The provided payload must be the new value to be used for modification compliant with the (part of) the Thing it is to be applied to.
func (*Command) Retrieve ¶
func (cmd *Command) Retrieve(thingIDs ...model.NamespacedID) *Command
Retrieve sets the action of the command instance accordingly. If thingIDs are provided the response will contain the information for these Things only. Further Headers can be added via the Message method to adjust the response even more. The topic placeholder for the Thing ID's namespace and/or name can be used to perform the multiple Things request, e.g.: '_:_', '_:thing.id' are valid Thing NamespacedIDs to perform the multiple Things retrieve call.
type Event ¶
Event represents a message entity defined by the Ditto protocol for the Things group that defines a notification for a change that happened. This is a special Message that is always bound to a specific Thing instance along with providing the capabilities to configure:
- the type of the change that happened - Created, Modified, Deleted
- the channel used for the notification - Twin, Live
- the entity that was affected - the whole Thing (the default), all features of the Thing (Features), a single Feature of the Thing (Feature), all attributes of the Thing (Attributes) or a single attribute of the Thing (Attribute), the Thing's policy (PolicyID) or the Thing's definition (Definition).
Note: Only one change type can be configured to the event - if using the methods for configuring it - only the last one applies. Note: Only one channel can be configured to the event - if using the methods for configuring it - only the last one applies. Note: Only one entity that will b affected by the event can be configured - if using the methods for configuring it - only the last one applies.
func NewEvent ¶
func NewEvent(thingID *model.NamespacedID) *Event
NewEvent creates a new Event instance for the defined by the provided NamespacedID Thing.
func (*Event) Attribute ¶
Attribute configures the Event to notify for a change in the Thing's attribute defined by the provided attributePath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Event) Attributes ¶
Attributes configures the Event to notify for a change in the Thing's attributes.
func (*Event) Created ¶
Created configures the Event to notify for a Thing that has been created using the provided payload instance.
func (*Event) Definition ¶
Definition configures the Event to notify for a change in the Thing's definition.
func (*Event) Deleted ¶
Deleted configures the Event to notify for a deletion of a Thing or parts of the content it holds.
func (*Event) Envelope ¶
Envelope generates the Ditto envelope with event's data applying all configurations and optionally all Headers provided.
func (*Event) Feature ¶
Feature configures the Event to notify for a change in the Thing's feature defined by the provided featureID.
func (*Event) FeatureDefinition ¶
FeatureDefinition configures the Event to notify for a change in the Thing's feature's definition for the feature defined by the provided featureID.
func (*Event) FeatureDesiredProperties ¶
FeatureDesiredProperties configures the Event to notify for a change in the Thing's feature's desired properties of the feature defined by the provided featureID.
func (*Event) FeatureDesiredProperty ¶
FeatureDesiredProperty configures the Event to notify for a change in the Thing's feature's desired property defined by the provided featureID and propertyPath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Event) FeatureProperties ¶
FeatureProperties configures the Event to notify for a change in the Thing's feature's properties of the feature defined by the provided featureID.
func (*Event) FeatureProperty ¶
FeatureProperty configures the Event to notify for a change in the Thing's feature's property defined by the provided featureID and propertyPath as JSON pointer path (https://tools.ietf.org/html/rfc6901).
func (*Event) Features ¶
Features configures the Event to notify for a change in the Thing's features.
func (*Event) Merged ¶
Merged configures the Event to notify for a modification with a merge patch defined by the provided payload.
func (*Event) Modified ¶
Modified configures the Event to notify for a modification with a new value applied defined by the provided payload.
type Message ¶
type Message struct { Topic *protocol.Topic Subject string Mailbox string AddressedPartOfThing string Payload interface{} }
Message represents a message entity defined by the Ditto protocol for the Things group that defines an instant communication with the underlying device/implementation. This is a special Message that is always bound to a specific Thing instance, it's always exchanged vie the Live communication channel and it provides the capabilities to configure: - the type of the communication - Inbox, Outbox - the entity that was affected - the whole Thing (the default) or a single Feature of the Thing (Feature). Note: Only one communication type can be configured to the live message - if using the methods for configuring it - only the last one applies. Note: Only one entity that the message targets can be configured to the live message - if using the methods for configuring it - only the last one applies.
func NewMessage ¶
func NewMessage(thingID *model.NamespacedID) *Message
NewMessage creates a new Message instance for the defined by the provided NamespacedID Thing.
func (*Message) Envelope ¶
Envelope generates the Ditto envelope with message's data applying all configurations and optionally all Headers provided.
func (*Message) Feature ¶
Feature configures the Message's target to be the specified by the featureID Thing's Feature.
func (*Message) Inbox ¶
Inbox configures the live Message to be sent to the inbox of the target entity, i.e. it defines an incoming communication. The Message is configured to serve only one subject - the one provided.
func (*Message) Outbox ¶
Outbox configures the live Message to be sent to the outbox of the target entity, i.e. it defines an outgoing communication. The Message is configured to serve only one subject - the one provided.
func (*Message) WithPayload ¶
WithPayload sets the data to be sent in the message, i.e. its content.