Skip to content

Commit 9e585b5

Browse files
committed
Add cached team repos
1 parent eb6e005 commit 9e585b5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/team_data.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use reqwest::Client;
2-
use rust_team_data::v1::{BASE_URL, People, Teams, ZulipMapping};
2+
use rust_team_data::v1::{BASE_URL, People, Repos, Teams, ZulipMapping};
33
use serde::de::DeserializeOwned;
44
use std::sync::Arc;
55
use std::time::{Duration, Instant};
@@ -10,6 +10,7 @@ pub struct TeamClient {
1010
base_url: String,
1111
client: Client,
1212
teams: CachedTeamItem<Teams>,
13+
repos: CachedTeamItem<Repos>,
1314
people: CachedTeamItem<People>,
1415
zulip_mapping: CachedTeamItem<ZulipMapping>,
1516
}
@@ -25,6 +26,7 @@ impl TeamClient {
2526
base_url,
2627
client: Client::new(),
2728
teams: CachedTeamItem::new("/teams.json"),
29+
repos: CachedTeamItem::new("/repos.json"),
2830
people: CachedTeamItem::new("/people.json"),
2931
zulip_mapping: CachedTeamItem::new("/zulip-map.json"),
3032
}
@@ -99,6 +101,10 @@ impl TeamClient {
99101
self.teams.get(&self.client, &self.base_url).await
100102
}
101103

104+
pub async fn repos(&self) -> anyhow::Result<Repos> {
105+
self.repos.get(&self.client, &self.base_url).await
106+
}
107+
102108
pub async fn people(&self) -> anyhow::Result<People> {
103109
self.people.get(&self.client, &self.base_url).await
104110
}

0 commit comments

Comments
 (0)