#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct QueryDeviceInfoParams {
pub dids: Option<Vec<String>>,
pub position_id: Option<String>,
pub page_num: u32,
pub page_size: u32,
}
impl Default for QueryDeviceInfoParams {
fn default() -> Self {
Self {
dids: None,
position_id: None,
page_num: 1,
page_size: 50,
}
}
}
impl QueryDeviceInfoParams {
pub fn with_dids(mut self, dids: impl Into<Vec<String>>) -> Self {
self.dids = Some(dids.into());
self
}
pub fn with_position_id(mut self, position_id: impl Into<String>) -> Self {
self.position_id = Some(position_id.into());
self
}
pub fn with_page_num(mut self, page_num: u32) -> Self {
self.page_num = page_num;
self
}
pub fn with_page_size(mut self, page_size: u32) -> Self {
self.page_size = page_size;
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct QuerySubDevicesParams {
pub gateway_did: String,
}
impl QuerySubDevicesParams {
pub fn new(gateway_did: impl Into<String>) -> Self {
Self {
gateway_did: gateway_did.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct UpdateDeviceNameParams {
pub did: String,
pub name: String,
}
impl UpdateDeviceNameParams {
pub fn new(did: impl Into<String>, name: impl Into<String>) -> Self {
Self {
did: did.into(),
name: name.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct UpdateDevicePositionParams {
pub dids: Vec<String>,
pub position_id: String,
}
impl UpdateDevicePositionParams {
pub fn new(dids: impl Into<Vec<String>>, position_id: impl Into<String>) -> Self {
Self {
dids: dids.into(),
position_id: position_id.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct UnbindDeviceParams {
pub did: String,
}
impl UnbindDeviceParams {
pub fn new(did: impl Into<String>) -> Self {
Self { did: did.into() }
}
}