Skip to content

Commit ca59785

Browse files
committed
refactor: support new team endpoint, fallback to legacy if no org
1 parent e1c8cb9 commit ca59785

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/Github/Api/Organization/Teams.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,16 @@ public function removeMember($team, $username, $organization)
9595
return $this->delete('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
9696
}
9797

98-
public function repositories($team)
98+
/**
99+
* @link https://docs.github.com/en/rest/teams/teams#list-team-repositories
100+
*/
101+
public function repositories($team, $organization = '')
99102
{
100-
return $this->get('/teams/'.rawurlencode($team).'/repos');
103+
if (empty($organization)) {
104+
return $this->get('/teams/'.rawurlencode($team).'/repos');
105+
}
106+
107+
return $this->get('/orgs/'.rawurlencode($organization).'/teams/'.rawurlencode($team).'/repos');
101108
}
102109

103110
public function repository($team, $organization, $repository)

0 commit comments

Comments
 (0)