Add event for updating things

This commit is contained in:
Mo Tarbin 2025-02-10 02:03:37 -05:00
parent 80afab3bc0
commit b1036730c4
2 changed files with 32 additions and 11 deletions

View file

@ -31,6 +31,7 @@ const (
EventTypeTaskCompleted EventType = "task.completed"
EventTypeTaskReassigned EventType = "task.reassigned"
EventTypeTaskSkipped EventType = "task.skipped"
EventTypeThingChanged EventType = "thing.changed"
)
type Event struct {
@ -162,3 +163,12 @@ func (p *EventsProducer) NotificationEvent(ctx context.Context, url string, even
Data: event,
})
}
func (p *EventsProducer) ThingsUpdated(ctx context.Context, url string, data interface{}) {
p.publishEvent(Event{
URL: url,
Type: EventTypeThingChanged,
Timestamp: time.Now(),
Data: data,
})
}