pub struct ServiceClient { /* private fields */ }Expand description
HTTP client for the aranet-service API.
Implementations§
Source§impl ServiceClient
impl ServiceClient
Sourcepub fn new(base_url: &str) -> Result<Self>
pub fn new(base_url: &str) -> Result<Self>
Create a new service client.
§Arguments
base_url- The base URL of the aranet-service (e.g., “http://localhost:8080”)
Sourcepub fn with_client(base_url: &str, client: Client) -> Result<Self>
pub fn with_client(base_url: &str, client: Client) -> Result<Self>
Create a client with a custom reqwest Client.
Sourcepub async fn is_reachable(&self) -> bool
pub async fn is_reachable(&self) -> bool
Check if the service is reachable.
Sourcepub async fn health(&self) -> Result<HealthResponse>
pub async fn health(&self) -> Result<HealthResponse>
Get service health.
Sourcepub async fn status(&self) -> Result<ServiceStatus>
pub async fn status(&self) -> Result<ServiceStatus>
Get service status including collector state and device stats.
Sourcepub async fn start_collector(&self) -> Result<CollectorActionResponse>
pub async fn start_collector(&self) -> Result<CollectorActionResponse>
Start the collector.
Sourcepub async fn stop_collector(&self) -> Result<CollectorActionResponse>
pub async fn stop_collector(&self) -> Result<CollectorActionResponse>
Stop the collector.
Sourcepub async fn config(&self) -> Result<ServiceConfig>
pub async fn config(&self) -> Result<ServiceConfig>
Get current configuration.
Sourcepub async fn add_device(&self, device: DeviceConfig) -> Result<DeviceConfig>
pub async fn add_device(&self, device: DeviceConfig) -> Result<DeviceConfig>
Add a device to monitor.
Sourcepub async fn update_device(
&self,
device_id: &str,
alias: Option<String>,
poll_interval: Option<u64>,
) -> Result<DeviceConfig>
pub async fn update_device( &self, device_id: &str, alias: Option<String>, poll_interval: Option<u64>, ) -> Result<DeviceConfig>
Update a device configuration.
Sourcepub async fn remove_device(&self, device_id: &str) -> Result<()>
pub async fn remove_device(&self, device_id: &str) -> Result<()>
Remove a device from monitoring.
Trait Implementations§
Source§impl Clone for ServiceClient
impl Clone for ServiceClient
Source§fn clone(&self) -> ServiceClient
fn clone(&self) -> ServiceClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServiceClient
impl !RefUnwindSafe for ServiceClient
impl Send for ServiceClient
impl Sync for ServiceClient
impl Unpin for ServiceClient
impl !UnwindSafe for ServiceClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more