Skip to main content

ipscanner/resources/
account.rs

1use crate::types::{Limits, UsageSummary};
2use crate::{Client, Error};
3
4/// Account limits and usage. Get one with [`Client::account`].
5#[derive(Debug, Clone, Copy)]
6pub struct Account<'a> {
7    client: &'a Client,
8}
9
10impl<'a> Account<'a> {
11    pub(crate) fn new(client: &'a Client) -> Self {
12        Account { client }
13    }
14
15    /// Your plan's monthly, daily and hourly limits.
16    pub async fn limits(&self) -> Result<Limits, Error> {
17        self.client.get("/user/limits", &[]).await
18    }
19
20    /// Usage this billing period.
21    pub async fn usage(&self) -> Result<UsageSummary, Error> {
22        self.client.get("/usage/summary", &[]).await
23    }
24}