1+ use crate :: team_data:: TeamApiClient ;
12use anyhow:: { anyhow, Context } ;
23use async_trait:: async_trait;
34use bytes:: Bytes ;
@@ -240,9 +241,9 @@ impl User {
240241 . await
241242 }
242243
243- pub async fn is_team_member < ' a > ( & ' a self , client : & ' a GithubClient ) -> anyhow:: Result < bool > {
244+ pub async fn is_team_member < ' a > ( & ' a self , client : & ' a TeamApiClient ) -> anyhow:: Result < bool > {
244245 log:: trace!( "Getting team membership for {:?}" , self . login) ;
245- let permission = crate :: team_data :: teams ( client ) . await ?;
246+ let permission = client . teams ( ) . await ?;
246247 let map = permission. teams ;
247248 let is_triager = map
248249 . get ( "wg-triage" )
@@ -268,10 +269,10 @@ impl User {
268269
269270// Returns the ID of the given user, if the user is in the `all` team.
270271pub async fn get_id_for_username (
271- client : & GithubClient ,
272+ client : & TeamApiClient ,
272273 login : & str ,
273274) -> anyhow:: Result < Option < u64 > > {
274- let permission = crate :: team_data :: teams ( client ) . await ?;
275+ let permission = client . teams ( ) . await ?;
275276 let map = permission. teams ;
276277 let login = login. to_lowercase ( ) ;
277278 Ok ( map[ "all" ]
@@ -282,21 +283,21 @@ pub async fn get_id_for_username(
282283}
283284
284285pub async fn get_team (
285- client : & GithubClient ,
286+ client : & TeamApiClient ,
286287 team : & str ,
287288) -> anyhow:: Result < Option < rust_team_data:: v1:: Team > > {
288- let permission = crate :: team_data :: teams ( client ) . await ?;
289+ let permission = client . teams ( ) . await ?;
289290 let mut map = permission. teams ;
290291 Ok ( map. swap_remove ( team) )
291292}
292293
293294/// Fetches a Rust team via its GitHub team name.
294295pub async fn get_team_by_github_name (
295- client : & GithubClient ,
296+ client : & TeamApiClient ,
296297 org : & str ,
297298 team : & str ,
298299) -> anyhow:: Result < Option < rust_team_data:: v1:: Team > > {
299- let teams = crate :: team_data :: teams ( client ) . await ?;
300+ let teams = client . teams ( ) . await ?;
300301 for rust_team in teams. teams . into_values ( ) {
301302 if let Some ( github) = & rust_team. github {
302303 for gh_team in & github. teams {
@@ -2059,10 +2060,11 @@ impl<'q> IssuesQuery for Query<'q> {
20592060 repo : & ' a Repository ,
20602061 include_fcp_details : bool ,
20612062 include_mcp_details : bool ,
2062- client : & ' a GithubClient ,
2063+ gh_client : & ' a GithubClient ,
2064+ team_api_client : & ' a TeamApiClient ,
20632065 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
20642066 let issues = repo
2065- . get_issues ( & client , self )
2067+ . get_issues ( & gh_client , self )
20662068 . await
20672069 . with_context ( || "Unable to get issues." ) ?;
20682070
@@ -2075,7 +2077,7 @@ impl<'q> IssuesQuery for Query<'q> {
20752077 } ;
20762078
20772079 let zulip_map = if include_fcp_details {
2078- Some ( crate :: team_data :: zulip_map ( client ) . await ?)
2080+ Some ( team_api_client . zulip_map ( ) . await ?)
20792081 } else {
20802082 None
20812083 } ;
@@ -2111,7 +2113,7 @@ impl<'q> IssuesQuery for Query<'q> {
21112113 ( "" . to_string ( ) , "" . to_string ( ) )
21122114 } else {
21132115 let comment = issue
2114- . get_comment ( & client , fk_initiating_comment. try_into ( ) ?)
2116+ . get_comment ( & gh_client , fk_initiating_comment. try_into ( ) ?)
21152117 . await
21162118 . with_context ( || {
21172119 format ! (
@@ -2176,7 +2178,7 @@ impl<'q> IssuesQuery for Query<'q> {
21762178 } ;
21772179
21782180 let mcp_details = if include_mcp_details {
2179- let first100_comments = issue. get_first100_comments ( & client ) . await ?;
2181+ let first100_comments = issue. get_first100_comments ( & gh_client ) . await ?;
21802182 let ( zulip_link, concerns) = if !first100_comments. is_empty ( ) {
21812183 let split = re_zulip_link
21822184 . split ( & first100_comments[ 0 ] . body )
@@ -2891,7 +2893,8 @@ pub trait IssuesQuery {
28912893 repo : & ' a Repository ,
28922894 include_fcp_details : bool ,
28932895 include_mcp_details : bool ,
2894- client : & ' a GithubClient ,
2896+ gh_client : & ' a GithubClient ,
2897+ team_api_client : & ' a TeamApiClient ,
28952898 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > ;
28962899}
28972900
@@ -2904,6 +2907,7 @@ impl IssuesQuery for LeastRecentlyReviewedPullRequests {
29042907 _include_fcp_details : bool ,
29052908 _include_mcp_details : bool ,
29062909 client : & ' a GithubClient ,
2910+ _team_api_client : & ' a TeamApiClient ,
29072911 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
29082912 use cynic:: QueryBuilder ;
29092913 use github_graphql:: queries;
@@ -3122,6 +3126,7 @@ impl IssuesQuery for DesignMeetings {
31223126 _include_fcp_details : bool ,
31233127 _include_mcp_details : bool ,
31243128 client : & ' a GithubClient ,
3129+ _team_api_client : & ' a TeamApiClient ,
31253130 ) -> anyhow:: Result < Vec < crate :: actions:: IssueDecorator > > {
31263131 use github_graphql:: project_items:: ProjectV2ItemContent ;
31273132
0 commit comments