Skip to main content

eero_api/api/
profiles.rs

1use crate::client::EeroClient;
2use crate::error::Result;
3use crate::types::profile::{Profile, ProfileUpdate};
4
5impl EeroClient {
6    /// List all profiles on a network.
7    #[tracing::instrument(skip(self))]
8    pub async fn get_profiles(&self, network_id: u64) -> Result<Vec<Profile>> {
9        let url = self.url(&format!("/networks/{network_id}/profiles"));
10        self.get(&url).await
11    }
12
13    /// Get a specific profile by its resource URL.
14    #[tracing::instrument(skip(self))]
15    pub async fn get_profile(&self, profile_url: &str) -> Result<Profile> {
16        let url = self.resource_url(profile_url);
17        self.get(&url).await
18    }
19
20    /// Update a profile (parental controls, schedule, DNS policies).
21    #[tracing::instrument(skip(self, update))]
22    pub async fn update_profile(
23        &self,
24        profile_url: &str,
25        update: &ProfileUpdate,
26    ) -> Result<Profile> {
27        let url = self.resource_url(profile_url);
28        self.put(&url, update).await
29    }
30}