use crate::{define_operation_with_response, Validate};
use paste::paste;
define_operation_with_response! {
operation: GetZoneGroupStateOperation,
action: "GetZoneGroupState",
service: ZoneGroupTopology,
request: {},
response: GetZoneGroupStateResponse {
zone_group_state: String,
},
xml_mapping: {
zone_group_state: "ZoneGroupState",
},
}
impl Validate for GetZoneGroupStateOperationRequest {
}
pub use get_zone_group_state_operation as get_zone_group_state;
pub const SERVICE: crate::Service = crate::Service::ZoneGroupTopology;
pub fn subscribe(
client: &crate::SonosClient,
ip: &str,
callback_url: &str,
) -> crate::Result<crate::ManagedSubscription> {
client.subscribe(ip, SERVICE, callback_url)
}
pub fn subscribe_with_timeout(
client: &crate::SonosClient,
ip: &str,
callback_url: &str,
timeout_seconds: u32,
) -> crate::Result<crate::ManagedSubscription> {
client.subscribe_with_timeout(ip, SERVICE, callback_url, timeout_seconds)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_get_zone_group_state_operation() {
let op = get_zone_group_state_operation().build().unwrap();
assert_eq!(op.metadata().action, "GetZoneGroupState");
}
#[test]
fn test_service_constant() {
assert_eq!(SERVICE, crate::Service::ZoneGroupTopology);
}
#[test]
fn test_subscription_helpers() {
let client = crate::SonosClient::new();
let _subscribe_fn = || subscribe(&client, "192.168.1.100", "http://callback.url");
let _subscribe_timeout_fn =
|| subscribe_with_timeout(&client, "192.168.1.100", "http://callback.url", 3600);
}
}