pub async fn fetch_adguard_status(
    client: &Client,
    endpoint: &str,
    username: &str,
    password: &str
) -> Result<StatusResponse, Error>
Expand description

Fetches the current status from the AdGuard Home instance.

This function sends a GET request to the /control/status endpoint of the AdGuard Home API, then deserializes the JSON response into a StatusResponse.

Arguments

  • client - A reference to the reqwest::Client.
  • hostname - The hostname of the AdGuard Home instance.
  • username - The username for the AdGuard Home instance.
  • password - The password for the AdGuard Home instance.

Returns

A Result which is Ok if the status was successfully fetched and Err otherwise. The Ok variant contains a StatusResponse.

Example

let client = reqwest::Client::new();
let hostname = "http://localhost:80";
let username = "username";
let password = "password";
let status = fetch_adguard_status(&client, &hostname, &username, &password).await?;
println!("AdGuard Status: {:?}", status);