tapo 0.9.0

Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L535, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P110M, P115), power strips (P300, P304M, P306, P316M), hubs (H100), switches (S200B, S200D, S210) and sensors (KE100, T100, T110, T300, T310, T315).
Documentation
use serde::{Deserialize, Serialize};

/// A still snapshot captured from a camera.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "python", pyo3::prelude::pyclass(from_py_object))]
pub struct Snapshot {
    /// The raw bytes of the snapshot.
    pub data: Vec<u8>,
    /// MIME content type of the snapshot, e.g. `"image/jpeg"`.
    pub content_type: String,
}

#[cfg(feature = "python")]
#[pyo3::prelude::pymethods]
impl Snapshot {
    /// The raw bytes of the snapshot.
    #[getter]
    fn data<'py>(&self, py: pyo3::Python<'py>) -> pyo3::Bound<'py, pyo3::types::PyBytes> {
        pyo3::types::PyBytes::new(py, &self.data)
    }

    /// MIME content type of the snapshot, e.g. `"image/jpeg"`.
    #[getter]
    fn content_type(&self) -> String {
        self.content_type.clone()
    }
}

#[cfg(feature = "python")]
crate::impl_to_dict!(Snapshot);