rusty_patio/payloads/
set_image.rs

1use serde::{Deserialize, Serialize};
2
3use crate::streamdeck::events::event_title::StreamDeckEventTitle;
4
5#[derive(Debug, Serialize, Deserialize)]
6pub struct StreamDeckSetImageMessage {
7    pub event: String,
8    pub context: String,
9    pub payload: StreamDeckSetImageMessagePayload,
10}
11
12impl StreamDeckSetImageMessage {
13    pub fn new(context: String, image: String, target: u8, state: Option<u8>) -> Self {
14        Self {
15            event: StreamDeckEventTitle::SET_IMAGE.to_string(),
16            context,
17            payload: StreamDeckSetImageMessagePayload {
18                image,
19                target,
20                state,
21            },
22        }
23    }
24}
25
26#[derive(Debug, Serialize, Deserialize)]
27pub struct StreamDeckSetImageMessagePayload {
28    pub image: String,
29    pub target: u8,
30    pub state: Option<u8>,
31}