@@ -35,15 +35,19 @@ public function create($organization, array $params)
35
35
/**
36
36
* @link https://developer.github.com/v3/teams/#list-teams
37
37
*/
38
- public function show ($ team , $ organization )
38
+ public function show ($ team , $ organization = null )
39
39
{
40
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ));
40
+ if ($ organization ) {
41
+ return $ this ->get ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ));
42
+ }
43
+
44
+ return $ this ->get ('/teams/ ' .rawurlencode ($ team ));
41
45
}
42
46
43
47
/**
44
48
* @link https://developer.github.com/v3/teams/#edit-team
45
49
*/
46
- public function update ($ team , array $ params , $ organization )
50
+ public function update ($ team , array $ params , $ organization = null )
47
51
{
48
52
if (!isset ($ params ['name ' ])) {
49
53
throw new MissingArgumentException ('name ' );
@@ -52,47 +56,71 @@ public function update($team, array $params, $organization)
52
56
$ params ['permission ' ] = 'pull ' ;
53
57
}
54
58
55
- return $ this ->patch ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ), $ params );
59
+ if ($ organization ) {
60
+ return $ this ->patch ('/teams/ ' . rawurlencode ($ team ), $ params );
61
+ }
62
+
63
+ return $ this ->patch ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ), $ params );
56
64
}
57
65
58
66
/**
59
67
* @link https://developer.github.com/v3/teams/#delete-team
60
68
*/
61
- public function remove ($ team , $ organization )
69
+ public function remove ($ team , $ organization = null )
62
70
{
63
- return $ this ->delete ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ));
71
+ if ($ organization ) {
72
+ return $ this ->delete ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ));
73
+ }
74
+
75
+ return $ this ->delete ('/teams/ ' . rawurlencode ($ team ));
64
76
}
65
77
66
78
/**
67
79
* @link https://developer.github.com/v3/teams/members/#list-team-members
68
80
*/
69
- public function members ($ team , $ organization )
81
+ public function members ($ team , $ organization = null )
70
82
{
71
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/members ' );
83
+ if ($ organization ) {
84
+ return $ this ->get ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ) . '/members ' );
85
+ }
86
+
87
+ return $ this ->get ('/teams/ ' . rawurlencode ($ team ) . '/members ' );
72
88
}
73
89
74
90
/**
75
91
* @link https://developer.github.com/v3/teams/members/#get-team-membership
76
92
*/
77
- public function check ($ team , $ username , $ organization )
93
+ public function check ($ team , $ username , $ organization = null )
78
94
{
79
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
95
+ if ($ organization ) {
96
+ return $ this ->get ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ) . '/memberships/ ' . rawurlencode ($ username ));
97
+ }
98
+
99
+ return $ this ->get ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
80
100
}
81
101
82
102
/**
83
103
* @link https://developer.github.com/v3/teams/members/#add-or-update-team-membership
84
104
*/
85
- public function addMember ($ team , $ username , $ organization )
105
+ public function addMember ($ team , $ username , $ organization = null )
86
106
{
87
- return $ this ->put ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
107
+ if ($ organization ) {
108
+ return $ this ->put ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ) . '/memberships/ ' . rawurlencode ($ username ));
109
+ }
110
+
111
+ return $ this ->put ('/teams/ ' . rawurlencode ($ team ) . '/memberships/ ' . rawurlencode ($ username ));
88
112
}
89
113
90
114
/**
91
115
* @link https://developer.github.com/v3/teams/members/#remove-team-membership
92
116
*/
93
- public function removeMember ($ team , $ username , $ organization )
117
+ public function removeMember ($ team , $ username , $ organization = null )
94
118
{
95
- return $ this ->delete ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
119
+ if ($ organization ) {
120
+ return $ this ->delete ('/orgs/ ' . rawurlencode ($ organization ) . '/teams/ ' . rawurlencode ($ team ) . '/memberships/ ' . rawurlencode ($ username ));
121
+ }
122
+
123
+ return $ this ->delete ('/teams/ ' . rawurlencode ($ team ) . '/memberships/ ' . rawurlencode ($ username ));
96
124
}
97
125
98
126
public function repositories ($ team )
0 commit comments