File size: 1,224 Bytes
52a9af3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * codex-backend
 *
 * codex-backend
 *
 * The version of the OpenAPI document: 0.0.1
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::Deserialize;
use serde::Serialize;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RateLimitStatusDetails {
    #[serde(rename = "allowed")]
    pub allowed: bool,
    #[serde(rename = "limit_reached")]
    pub limit_reached: bool,
    #[serde(
        rename = "primary_window",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_window: Option<Option<Box<models::RateLimitWindowSnapshot>>>,
    #[serde(
        rename = "secondary_window",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub secondary_window: Option<Option<Box<models::RateLimitWindowSnapshot>>>,
}

impl RateLimitStatusDetails {
    pub fn new(allowed: bool, limit_reached: bool) -> RateLimitStatusDetails {
        RateLimitStatusDetails {
            allowed,
            limit_reached,
            primary_window: None,
            secondary_window: None,
        }
    }
}