1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! `Client` methods for the `WanAPI` domain (new in v8.0.0).
use super::Client;
use crate::envelope::Envelope;
use crate::error::Error;
use serde_json::Value;
impl Client {
// ==================== Multi-static IP & Secondary WAN ====================
/// Gets the multi-static-IP configuration — returns the raw Eero API response.
///
/// Ported from `get_multistaticip` (`eero-api src/eero/client.py:3034-3043`).
/// `auto_discover = false`. Passes the network's cached envelope (if fresh) as `parent`. The
/// API answers 404 with `error.network.multistaticip_not_found` on a network without the
/// feature.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_multistaticip(&self, network_id: Option<&str>) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
let parent = self.network_parent(&network_id);
self.api
.wan()
.get_multistaticip(&network_id, parent.as_ref())
.await
}
/// Sets the multi-static-IP configuration — returns the raw Eero API response.
///
/// Ported from `set_multistaticip` (`eero-api src/eero/client.py:3045-3052`).
/// `auto_discover = false`. No `parent=` forwarded — matches
/// [`crate::endpoints::wan::WanApi::set_multistaticip`], which never accepts one.
/// Invalidates `network[{nid}]` unconditionally after the write.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn set_multistaticip(
&self,
config: Value,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
let response = self
.api
.wan()
.set_multistaticip(&network_id, config)
.await?;
self.invalidate_network_cache(&network_id);
Ok(response)
}
/// Sets the secondary WAN configuration for every device in one call — returns the raw Eero
/// API response.
///
/// Ported from `set_secondary_wan_config` (`eero-api src/eero/client.py:3054-3061`).
/// `auto_discover = false`. No `parent=` forwarded. Invalidates `network[{nid}]`
/// unconditionally after the write.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn set_secondary_wan_config(
&self,
config: Value,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
let response = self
.api
.wan()
.set_secondary_wan_config(&network_id, config)
.await?;
self.invalidate_network_cache(&network_id);
Ok(response)
}
/// Allows or denies a single device's secondary-WAN access — returns the raw Eero API
/// response.
///
/// Ported from `set_device_secondary_wan_access` (`eero-api src/eero/client.py:3063-3070`).
/// `auto_discover = false`. Invalidates the **device** cache (`Dev{nid,mac}` +
/// `DevList{nid}`, via `Client::invalidate_device_cache`) after the write, not the network
/// cache — matches Python's `self._invalidate_device_cache(network_id, mac)` exactly, even
/// though the domain call lives on `WanApi`.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn set_device_secondary_wan_access(
&self,
mac: &str,
deny: bool,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
let response = self
.api
.wan()
.set_device_secondary_wan_access(&network_id, mac, deny)
.await?;
self.invalidate_device_cache(&network_id, mac);
Ok(response)
}
}