Skip to main content

ipscanner/types/
account.rs

1use serde::{Deserialize, Serialize};
2
3/// Response of `GET /v1/user/limits`.
4#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5#[serde(default, rename_all = "camelCase")]
6pub struct Limits {
7    pub account_type: String,
8    pub limit: i64,
9    pub usage: i64,
10    pub remaining: i64,
11    pub reset_date: String,
12    pub daily: Option<Window>,
13    pub hourly: Option<Window>,
14}
15
16/// A daily or hourly allowance.
17#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
18#[serde(default, rename_all = "camelCase")]
19pub struct Window {
20    pub limit: i64,
21    pub used: i64,
22    pub remaining: i64,
23    pub reset_at: String,
24}
25
26/// Response of `GET /v1/usage/summary`.
27#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
28#[serde(default, rename_all = "camelCase")]
29pub struct UsageSummary {
30    pub plan: String,
31    pub used: i64,
32    pub limit: i64,
33    pub unlimited: bool,
34    pub remaining: i64,
35    pub percent: f64,
36    pub soft_blocked: bool,
37    /// Empty, `monthly`, `daily` or `hourly`.
38    pub blocked_by: String,
39    pub upgrade_hint: bool,
40    pub bulk_cap: i64,
41    pub daily: Option<Window>,
42    pub hourly: Option<Window>,
43    pub period_start: String,
44    pub reset_date: String,
45    pub as_of: String,
46}