7
7
8
8
/**
9
9
* @link http://developer.github.com/v3/orgs/teams/
10
- *
11
10
* @author Joseph Bielawski <stloyd@gmail.com>
12
11
*/
13
12
class Teams extends AbstractApi
@@ -37,11 +36,13 @@ public function create($organization, array $params)
37
36
*/
38
37
public function show ($ team , $ organization = null )
39
38
{
40
- if ($ organization ) {
41
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ));
39
+ if (null === $ organization ) {
40
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
41
+
42
+ return $ this ->get ('/teams/ ' .rawurlencode ($ team ));
42
43
}
43
44
44
- return $ this ->get ('/teams/ ' .rawurlencode ($ team ));
45
+ return $ this ->get ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ));
45
46
}
46
47
47
48
/**
@@ -56,71 +57,83 @@ public function update($team, array $params, $organization = null)
56
57
$ params ['permission ' ] = 'pull ' ;
57
58
}
58
59
59
- if ($ organization ) {
60
- return $ this ->patch ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ), $ params );
60
+ if (null === $ organization ) {
61
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
62
+
63
+ return $ this ->patch ('/teams/ ' .rawurlencode ($ team ), $ params );
61
64
}
62
65
63
- return $ this ->patch ('/teams/ ' .rawurlencode ($ team ), $ params );
66
+ return $ this ->patch ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ), $ params );
64
67
}
65
68
66
69
/**
67
70
* @link https://developer.github.com/v3/teams/#delete-team
68
71
*/
69
72
public function remove ($ team , $ organization = null )
70
73
{
71
- if ($ organization ) {
72
- return $ this ->delete ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ));
74
+ if (null === $ organization ) {
75
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
76
+
77
+ return $ this ->delete ('/teams/ ' .rawurlencode ($ team ));
73
78
}
74
79
75
- return $ this ->delete ('/teams/ ' .rawurlencode ($ team ));
80
+ return $ this ->delete ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ));
76
81
}
77
82
78
83
/**
79
84
* @link https://developer.github.com/v3/teams/members/#list-team-members
80
85
*/
81
86
public function members ($ team , $ organization = null )
82
87
{
83
- if ($ organization ) {
84
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/members ' );
88
+ if (null === $ organization ) {
89
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
90
+
91
+ return $ this ->get ('/teams/ ' .rawurlencode ($ team ).'/members ' );
85
92
}
86
93
87
- return $ this ->get ('/teams/ ' .rawurlencode ($ team ).'/members ' );
94
+ return $ this ->get ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ).'/members ' );
88
95
}
89
96
90
97
/**
91
98
* @link https://developer.github.com/v3/teams/members/#get-team-membership
92
99
*/
93
100
public function check ($ team , $ username , $ organization = null )
94
101
{
95
- if ($ organization ) {
96
- return $ this ->get ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
102
+ if (null === $ organization ) {
103
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
104
+
105
+ return $ this ->get ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
97
106
}
98
107
99
- return $ this ->get ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
108
+ return $ this ->get ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
100
109
}
101
110
102
111
/**
103
112
* @link https://developer.github.com/v3/teams/members/#add-or-update-team-membership
104
113
*/
105
114
public function addMember ($ team , $ username , $ organization = null )
106
115
{
107
- if ($ organization ) {
108
- return $ this ->put ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
116
+ if (null === $ organization ) {
117
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
118
+
119
+ return $ this ->put ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
109
120
}
110
121
111
- return $ this ->put ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
122
+ return $ this ->put ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
112
123
}
113
124
114
125
/**
115
126
* @link https://developer.github.com/v3/teams/members/#remove-team-membership
116
127
*/
117
128
public function removeMember ($ team , $ username , $ organization = null )
118
129
{
119
- if ($ organization ) {
120
- return $ this ->delete ('/orgs/ ' .rawurlencode ($ organization ).'/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
130
+ if (null === $ organization ) {
131
+ @trigger_error ('Not passing the $organisation parameter is deprecated in knpLabs/php-github-api v2.14 and will be mandatory in v3.0. ' , E_USER_DEPRECATED );
132
+
133
+ return $ this ->delete ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
121
134
}
122
135
123
- return $ this ->delete ('/teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
136
+ return $ this ->delete ('/orgs/ ' . rawurlencode ( $ organization ). ' / teams/ ' .rawurlencode ($ team ).'/memberships/ ' .rawurlencode ($ username ));
124
137
}
125
138
126
139
public function repositories ($ team )
0 commit comments