streamdeck-sdk/streamdeck/messages.go

49 lines
956 B
Go
Raw Normal View History

2019-07-12 16:39:12 -06:00
package streamdeck
import (
"context"
)
2019-07-13 14:26:08 -06:00
type Event struct {
Action string `json:"action,omitempty"`
Event string `json:"event,omitempty"`
UUID string `json:"uuid,omitempty"`
Context string `json:"context,omitempty"`
Device string `json:"device,omitempty"`
Payload interface{} `json:"payload,omitempty"`
2019-07-12 16:39:12 -06:00
}
2019-07-13 14:26:08 -06:00
func NewEvent(ctx context.Context, name string, payload interface{}) Event {
return Event{
Event: name,
Context: getContext(ctx),
Payload: payload,
}
2019-07-12 16:39:12 -06:00
}
2019-07-13 14:26:08 -06:00
type LogMessagePayload struct {
Message string `json:"message"`
2019-07-12 16:39:12 -06:00
}
2019-07-13 14:26:08 -06:00
type OpenURLPayload struct {
URL string `json:"url"`
2019-07-12 16:39:12 -06:00
}
2019-07-13 14:26:08 -06:00
type Target int
2019-07-12 16:39:12 -06:00
2019-07-13 14:26:08 -06:00
const (
HardwareAndSoftware Target = 0
OnlyHardware Target = 1
OnlySoftware Target = 2
)
2019-07-12 16:39:12 -06:00
2019-07-13 14:26:08 -06:00
type SetTitlePayload struct {
Title string `json:"title"`
Target Target `json:"target"`
}
type SetImagePayload struct {
Base64Image string `json:"image"`
Target Target `json:"target"`
2019-07-12 16:39:12 -06:00
}