Skip to content

Commit

Permalink
feat: project qouta (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
xDarksome authored Sep 4, 2023
1 parent e35d312 commit 1ee5d26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/project/types/project_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ pub struct ProjectData {
pub is_rate_limited: bool,
pub allowed_origins: Vec<String>,
pub verified_domains: Vec<String>,
pub quota: Quota,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Quota {
pub max: u64,
pub current: u64,
pub is_valid: bool,
}

impl ProjectData {
Expand Down
6 changes: 6 additions & 0 deletions src/registry/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ async fn parse_http_response(resp: reqwest::Response) -> RegistryResult<Option<P
mod test {
use {
super::*,
crate::project,
wiremock::{
http::Method,
matchers::{method, path},
Expand All @@ -153,6 +154,11 @@ mod test {
is_rate_limited: false,
allowed_origins: vec![],
verified_domains: vec![],
quota: project::Quota {
max: 42,
current: 1,
is_valid: true,
},
}
}

Expand Down

0 comments on commit 1ee5d26

Please sign in to comment.