kdeconnect-proto 0.1.0

A pure Rust modular implementation of the KDE Connect protocol
Documentation
//! The Lock plugin allows requesting a device to lock or unlock.
use serde::{Deserialize, Serialize};

/// This packet is a lock status update.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectlock>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct LockPacket {
    /// Indicates the current locked status of the device. If true the device is locked and false if unlocked.
    pub is_locked: bool,
}

/// This packet is a request for a lock status update or change.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectlockrequest>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct LockRequestPacket {
    /// A request to change the locked status. If true the device will be locked or if false unlocked.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub set_locked: Option<bool>,

    /// Indicates this is a request for the current locked status. Always true, if present.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub request_locked: Option<bool>,
}