use std::convert::Infallible;
use uuid::Uuid;
use crate::client::{DeviceBase, HlapiClient, HlapiClientError};
#[derive(Debug, Clone)]
pub struct Spawner {
client: HlapiClient,
uuid: Uuid,
}
impl Spawner {
pub fn get_entity_type(&self) -> Result<Option<String>, HlapiClientError> {
Ok(self.call("getEntityType", &[], &[])?.0)
}
}
impl DeviceBase for Spawner {
const TYPE: &'static str = "spawner";
type Event = Infallible;
fn new(client: HlapiClient, uuid: Uuid) -> Result<Self, HlapiClientError> {
Ok(Self { client, uuid })
}
fn uuid_base(&self) -> Uuid {
self.uuid
}
fn client(&self) -> &HlapiClient {
&self.client
}
}