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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! `Client` methods for the `InsightsAPI` domain.
//!
//! # `run_insights`: removed
//!
//! `InsightsAPI.run_insights` (v6.2.0 `insights.py:115-137`) was removed entirely in `05a2b07`
//! (v8.0.0) — no v8.0.4 API operation corresponds to it. `Client::run_insights`, which this crate
//! previously shipped, is removed along with the endpoint method and route it called.
use super::Client;
use crate::envelope::Envelope;
use crate::error::Error;
impl Client {
/// Queries network-level insights time-series data — returns the raw Eero API response.
///
/// Ported from `get_insights()` (`eero-api src/eero/client.py:1275-1309` at `v8.0.4`):
/// `start`, `end` and `insight_type` have been required since v6.0.0. `auto_discover =
/// false` — see [`Client::get_diagnostics`]. No `parent=`. Unlike Python (which
/// SDK-defaults `cadence` to `"daily"`), `cadence` has no default here — see
/// [`crate::endpoints::insights::InsightsApi::get_insights`]'s own docs for why this
/// divergence was kept.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_insights(
&self,
start: &str,
end: &str,
insight_type: &str,
cadence: &str,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
self.api
.insights()
.get_insights(&network_id, start, end, insight_type, cadence)
.await
}
/// Queries insights for every device on a network — returns the raw Eero API response.
///
/// Ported from `get_devices_insights()` (`eero-api src/eero/client.py:1310-1329`).
/// `auto_discover = false`. Passes the cached network envelope as `parent=` (`+net`).
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_devices_insights(
&self,
start: &str,
end: &str,
cadence: &str,
insight_type: &str,
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.as_str());
self.api
.insights()
.get_devices_insights(
&network_id,
start,
end,
cadence,
insight_type,
parent.as_ref(),
)
.await
}
/// Queries insights for a single device — returns the raw Eero API response.
///
/// Ported from `get_device_insights()` (`eero-api src/eero/client.py:1330-1350`).
/// `auto_discover = false`. No `parent=`.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_device_insights(
&self,
device_id: &str,
start: &str,
end: &str,
cadence: &str,
insight_type: &str,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
self.api
.insights()
.get_device_insights(&network_id, device_id, start, end, cadence, insight_type)
.await
}
/// Queries insights for every profile on a network — returns the raw Eero API response.
///
/// Ported from `get_profiles_insights()` (`eero-api src/eero/client.py:1351-1370`).
/// `auto_discover = false`. Passes the cached network envelope as `parent=` (`+net`).
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_profiles_insights(
&self,
start: &str,
end: &str,
cadence: &str,
insight_type: &str,
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.as_str());
self.api
.insights()
.get_profiles_insights(
&network_id,
start,
end,
cadence,
insight_type,
parent.as_ref(),
)
.await
}
/// Queries insights for a single profile — returns the raw Eero API response.
///
/// Ported from `get_profile_insights()` (`eero-api src/eero/client.py:1371-1391`).
/// `auto_discover = false`. No `parent=`.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_profile_insights(
&self,
profile_id: &str,
start: &str,
end: &str,
cadence: &str,
insight_type: &str,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
self.api
.insights()
.get_profile_insights(&network_id, profile_id, start, end, cadence, insight_type)
.await
}
/// Queries insights for every device belonging to a single profile — returns the raw Eero
/// API response.
///
/// Ported from `get_profile_devices_insights()` (`eero-api src/eero/client.py:1392-1412`).
/// `auto_discover = false`. No `parent=`.
///
/// # Errors
///
/// See [`Client::get_diagnostics`].
pub async fn get_profile_devices_insights(
&self,
profile_id: &str,
start: &str,
end: &str,
cadence: &str,
insight_type: &str,
network_id: Option<&str>,
) -> Result<Envelope, Error> {
let network_id = self.ensure_network_id(network_id, false).await?;
self.api
.insights()
.get_profile_devices_insights(
&network_id,
profile_id,
start,
end,
cadence,
insight_type,
)
.await
}
}