Skip to main content

artifacts/models/
rate_limit_window_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct RateLimitWindowSchema {
7    /// Maximum requests allowed in this window.
8    #[serde(rename = "limit")]
9    pub limit: i32,
10    /// Remaining requests in the current window.
11    #[serde(rename = "remaining")]
12    pub remaining: i32,
13    /// UTC datetime when the window resets.
14    #[serde(rename = "reset")]
15    pub reset: String,
16}
17
18impl RateLimitWindowSchema {
19    pub fn new(limit: i32, remaining: i32, reset: String) -> RateLimitWindowSchema {
20        RateLimitWindowSchema {
21            limit,
22            remaining,
23            reset,
24        }
25    }
26}