File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ impl GitHubClient {
25
25
self . request ( "/user" , auth)
26
26
}
27
27
28
+ pub fn org_by_name ( & self , org_name : & str , auth : & AccessToken ) -> AppResult < GitHubOrganization > {
29
+ let url = format ! ( "/orgs/{}" , org_name) ;
30
+ self . request ( & url, auth)
31
+ }
32
+
28
33
pub fn team_by_name (
29
34
& self ,
30
35
org_name : & str ,
@@ -116,9 +121,10 @@ pub struct GithubUser {
116
121
pub name : Option < String > ,
117
122
}
118
123
119
- #[ derive( Debug , Deserialize , Copy ) ]
124
+ #[ derive( Debug , Deserialize ) ]
120
125
pub struct GitHubOrganization {
121
126
pub id : i32 , // unique GH id (needed for membership queries)
127
+ pub avatar_url : Option < String > ,
122
128
}
123
129
124
130
#[ derive( Debug , Deserialize ) ]
Original file line number Diff line number Diff line change @@ -155,13 +155,7 @@ impl Team {
155
155
return Err ( cargo_err ( "only members of a team can add it as an owner" ) ) ;
156
156
}
157
157
158
- #[ derive( Deserialize ) ]
159
- struct Org {
160
- avatar_url : Option < String > ,
161
- }
162
-
163
- let url = format ! ( "/orgs/{}" , org_name) ;
164
- let org = app. github . request :: < Org > ( & url, & token) ?;
158
+ let org = app. github . org_by_name ( org_name, & token) ?;
165
159
166
160
NewTeam :: new (
167
161
& login. to_lowercase ( ) ,
You can’t perform that action at this time.
0 commit comments