package streamdeck import ( "context" "encoding/json" sdcontext "code.encyclopediaofdaniel.com/dlprows/streamdeck-sdk/context" ) 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"` DeviceInfo DeviceInfo `json:"deviceInfo,omitempty"` Payload json.RawMessage `json:"payload,omitempty"` } type DeviceInfo struct { DeviceName string `json:"deviceName,omitempty"` Type DeviceType `json:"type,omitempty"` Size DeviceSize `json:"size,omitempty"` } type DeviceSize struct { Columns int `json:"columns,omitempty"` Rows int `json:"rows,omitempty"` } type DeviceType int const ( StreamDeck DeviceType = 0 StreamDeckMini DeviceType = 1 StreamDeckXL DeviceType = 2 StreamDeckMobile DeviceType = 3 CorsairGKeys DeviceType = 4 StreamDeckPedal DeviceType = 5 CorsairVoyager DeviceType = 6 StreamDeckPlus DeviceType = 7 ) func NewEvent(ctx context.Context, name string, payload any) Event { p, err := json.Marshal(payload) if err != nil { panic(err) } return Event{ Event: name, Action: sdcontext.Action(ctx), Context: sdcontext.Context(ctx), Device: sdcontext.Device(ctx), Payload: p, } }