provident 0.3.1

Unofficial client for the Provident (MeterConnex) utility metering portal: meters, usage history, and reports
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: GPL-3.0-only

use crate::http::Request;
use crate::models::login::login_service::check_login::{self, CheckLoginResponse};

use super::Auth;
use crate::Result;

impl Auth {
    /// Whether the client currently holds a valid session (`CheckLogin`).
    #[maybe_async::maybe_async]
    pub async fn verify(&self) -> Result<bool> {
        let request = Request::page_method(check_login::METHOD, check_login::PATH).build();
        let response = self.http.send::<CheckLoginResponse>(request).await?;
        Ok(response.logged_in)
    }
}