divoom 0.1.42

Rust API for controlling divoom devices, like pixoo.
Documentation
#[doc = include_str!("./api_select_cloud_channel.md")]
use crate::divoom_contracts::pixoo::common::*;
use crate::DivoomCloudChannelType;
use serde::{Deserialize, Serialize};

// Request
define_pixoo_command_request!(
    "Channel/CloudIndex",
    DivoomPixooCommandChannelSelectCloudChannelRequest,
    DivoomPixooCommandChannelSelectCloudChannelRequestPayload
);

#[derive(Debug, Serialize, Deserialize, PartialOrd, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct DivoomPixooCommandChannelSelectCloudChannelRequestPayload {
    // 0: Recommend gallery, 1: Favourite, 2: Subscribe artist
    pub index: i32,
}

impl DivoomPixooCommandChannelSelectCloudChannelRequestPayload {
    pub fn new(
        channel_type: DivoomCloudChannelType,
    ) -> DivoomPixooCommandChannelSelectCloudChannelRequestPayload {
        DivoomPixooCommandChannelSelectCloudChannelRequestPayload {
            index: channel_type.into(),
        }
    }
}

// Response
define_pixoo_command_response_without_payload!(DivoomPixooCommandChannelSelectCloudChannelResponse);