@@ -14,245 +14,245 @@ |
||
| 14 | 14 | class Issues extends AbstractReceiver |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** Available sub-Receiver */ |
|
| 18 | - const ASSIGNEES = 'Assignees'; |
|
| 19 | - const COMMENTS = 'Comments'; |
|
| 20 | - const EVENTS = 'Events'; |
|
| 21 | - const LABELS = 'Labels'; |
|
| 22 | - const MILESTONES = 'Milestones'; |
|
| 17 | + /** Available sub-Receiver */ |
|
| 18 | + const ASSIGNEES = 'Assignees'; |
|
| 19 | + const COMMENTS = 'Comments'; |
|
| 20 | + const EVENTS = 'Events'; |
|
| 21 | + const LABELS = 'Labels'; |
|
| 22 | + const MILESTONES = 'Milestones'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * List issues |
|
| 26 | - * |
|
| 27 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
| 28 | - * |
|
| 29 | - * @param string $filter |
|
| 30 | - * @param string $state |
|
| 31 | - * @param string $labels |
|
| 32 | - * @param string $sort |
|
| 33 | - * @param string $direction |
|
| 34 | - * @param string $since |
|
| 35 | - * |
|
| 36 | - * @return array |
|
| 37 | - */ |
|
| 38 | - public function listIssues( |
|
| 39 | - string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 40 | - string $state = AbstractApi::STATE_OPEN, |
|
| 41 | - string $labels = '', |
|
| 42 | - string $sort = AbstractApi::SORT_CREATED, |
|
| 43 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
| 44 | - string $since = '1970-01-01' |
|
| 45 | - ): array { |
|
| 46 | - return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([ |
|
| 47 | - 'filter' => $filter, |
|
| 48 | - 'state' => $state, |
|
| 49 | - 'labels' => $labels, |
|
| 50 | - 'sort' => $sort, |
|
| 51 | - 'direction' => $direction, |
|
| 52 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 53 | - ]))); |
|
| 54 | - } |
|
| 24 | + /** |
|
| 25 | + * List issues |
|
| 26 | + * |
|
| 27 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
| 28 | + * |
|
| 29 | + * @param string $filter |
|
| 30 | + * @param string $state |
|
| 31 | + * @param string $labels |
|
| 32 | + * @param string $sort |
|
| 33 | + * @param string $direction |
|
| 34 | + * @param string $since |
|
| 35 | + * |
|
| 36 | + * @return array |
|
| 37 | + */ |
|
| 38 | + public function listIssues( |
|
| 39 | + string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 40 | + string $state = AbstractApi::STATE_OPEN, |
|
| 41 | + string $labels = '', |
|
| 42 | + string $sort = AbstractApi::SORT_CREATED, |
|
| 43 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
| 44 | + string $since = '1970-01-01' |
|
| 45 | + ): array { |
|
| 46 | + return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([ |
|
| 47 | + 'filter' => $filter, |
|
| 48 | + 'state' => $state, |
|
| 49 | + 'labels' => $labels, |
|
| 50 | + 'sort' => $sort, |
|
| 51 | + 'direction' => $direction, |
|
| 52 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 53 | + ]))); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * List all issues across owned and member repositories for the authenticated user |
|
| 58 | - * |
|
| 59 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
| 60 | - * |
|
| 61 | - * @param string $filter |
|
| 62 | - * @param string $state |
|
| 63 | - * @param string $labels |
|
| 64 | - * @param string $sort |
|
| 65 | - * @param string $direction |
|
| 66 | - * @param string $since |
|
| 67 | - * |
|
| 68 | - * @return array |
|
| 69 | - */ |
|
| 70 | - public function listUserIssues( |
|
| 71 | - string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 72 | - string $state = AbstractApi::STATE_OPEN, |
|
| 73 | - string $labels = '', |
|
| 74 | - string $sort = AbstractApi::SORT_CREATED, |
|
| 75 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
| 76 | - string $since = '1970-01-01' |
|
| 77 | - ): array { |
|
| 78 | - return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([ |
|
| 79 | - 'filter' => $filter, |
|
| 80 | - 'state' => $state, |
|
| 81 | - 'labels' => $labels, |
|
| 82 | - 'sort' => $sort, |
|
| 83 | - 'direction' => $direction, |
|
| 84 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 85 | - ]))); |
|
| 86 | - } |
|
| 56 | + /** |
|
| 57 | + * List all issues across owned and member repositories for the authenticated user |
|
| 58 | + * |
|
| 59 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
| 60 | + * |
|
| 61 | + * @param string $filter |
|
| 62 | + * @param string $state |
|
| 63 | + * @param string $labels |
|
| 64 | + * @param string $sort |
|
| 65 | + * @param string $direction |
|
| 66 | + * @param string $since |
|
| 67 | + * |
|
| 68 | + * @return array |
|
| 69 | + */ |
|
| 70 | + public function listUserIssues( |
|
| 71 | + string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 72 | + string $state = AbstractApi::STATE_OPEN, |
|
| 73 | + string $labels = '', |
|
| 74 | + string $sort = AbstractApi::SORT_CREATED, |
|
| 75 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
| 76 | + string $since = '1970-01-01' |
|
| 77 | + ): array { |
|
| 78 | + return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([ |
|
| 79 | + 'filter' => $filter, |
|
| 80 | + 'state' => $state, |
|
| 81 | + 'labels' => $labels, |
|
| 82 | + 'sort' => $sort, |
|
| 83 | + 'direction' => $direction, |
|
| 84 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 85 | + ]))); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * List all issues for a given organization for the authenticated user |
|
| 90 | - * |
|
| 91 | - * @link https://developer.github.com/v3/issues/#list-issues |
|
| 92 | - * |
|
| 93 | - * @param string $organization |
|
| 94 | - * @param string $filter |
|
| 95 | - * @param string $state |
|
| 96 | - * @param string $labels |
|
| 97 | - * @param string $sort |
|
| 98 | - * @param string $direction |
|
| 99 | - * @param string $since |
|
| 100 | - * |
|
| 101 | - * @return array |
|
| 102 | - */ |
|
| 103 | - public function listOrganizationIssues( |
|
| 104 | - string $organization, |
|
| 105 | - string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 106 | - string $state = AbstractApi::STATE_OPEN, |
|
| 107 | - string $labels = '', |
|
| 108 | - string $sort = AbstractApi::SORT_CREATED, |
|
| 109 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
| 110 | - string $since = '1970-01-01' |
|
| 111 | - ): array { |
|
| 112 | - return $this->getApi()->request($this->getApi() |
|
| 113 | - ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([ |
|
| 114 | - 'filter' => $filter, |
|
| 115 | - 'state' => $state, |
|
| 116 | - 'labels' => $labels, |
|
| 117 | - 'sort' => $sort, |
|
| 118 | - 'direction' => $direction, |
|
| 119 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 120 | - ]))); |
|
| 121 | - } |
|
| 88 | + /** |
|
| 89 | + * List all issues for a given organization for the authenticated user |
|
| 90 | + * |
|
| 91 | + * @link https://developer.github.com/v3/issues/#list-issues |
|
| 92 | + * |
|
| 93 | + * @param string $organization |
|
| 94 | + * @param string $filter |
|
| 95 | + * @param string $state |
|
| 96 | + * @param string $labels |
|
| 97 | + * @param string $sort |
|
| 98 | + * @param string $direction |
|
| 99 | + * @param string $since |
|
| 100 | + * |
|
| 101 | + * @return array |
|
| 102 | + */ |
|
| 103 | + public function listOrganizationIssues( |
|
| 104 | + string $organization, |
|
| 105 | + string $filter = AbstractApi::FILTER_ASSIGNED, |
|
| 106 | + string $state = AbstractApi::STATE_OPEN, |
|
| 107 | + string $labels = '', |
|
| 108 | + string $sort = AbstractApi::SORT_CREATED, |
|
| 109 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
| 110 | + string $since = '1970-01-01' |
|
| 111 | + ): array { |
|
| 112 | + return $this->getApi()->request($this->getApi() |
|
| 113 | + ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([ |
|
| 114 | + 'filter' => $filter, |
|
| 115 | + 'state' => $state, |
|
| 116 | + 'labels' => $labels, |
|
| 117 | + 'sort' => $sort, |
|
| 118 | + 'direction' => $direction, |
|
| 119 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 120 | + ]))); |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * List issues for a repository |
|
| 125 | - * |
|
| 126 | - * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository |
|
| 127 | - * |
|
| 128 | - * @param string $milestone |
|
| 129 | - * @param string $state |
|
| 130 | - * @param string $assignee |
|
| 131 | - * @param string $creator |
|
| 132 | - * @param string $mentioned |
|
| 133 | - * @param string $labels |
|
| 134 | - * @param string $sort |
|
| 135 | - * @param string $direction |
|
| 136 | - * @param string $since |
|
| 137 | - * |
|
| 138 | - * @return array |
|
| 139 | - */ |
|
| 140 | - public function listRepositoryIssues( |
|
| 141 | - string $milestone = '*', |
|
| 142 | - string $state = AbstractApi::STATE_OPEN, |
|
| 143 | - string $assignee = '*', |
|
| 144 | - string $creator = '', |
|
| 145 | - string $mentioned = '', |
|
| 146 | - string $labels = '', |
|
| 147 | - string $sort = AbstractApi::SORT_CREATED, |
|
| 148 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
| 149 | - string $since = '1970-01-01' |
|
| 150 | - ): array { |
|
| 151 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 152 | - '/repos/:owner/:repo/issues?:args', |
|
| 153 | - $this->getOwner(), |
|
| 154 | - $this->getRepo(), |
|
| 155 | - http_build_query([ |
|
| 156 | - 'milestone' => $milestone, |
|
| 157 | - 'state' => $state, |
|
| 158 | - 'assignee' => $assignee, |
|
| 159 | - 'creator' => $creator, |
|
| 160 | - 'mentioned' => $mentioned, |
|
| 161 | - 'labels' => $labels, |
|
| 162 | - 'sort' => $sort, |
|
| 163 | - 'direction' => $direction, |
|
| 164 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 165 | - ]) |
|
| 166 | - )); |
|
| 167 | - } |
|
| 123 | + /** |
|
| 124 | + * List issues for a repository |
|
| 125 | + * |
|
| 126 | + * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository |
|
| 127 | + * |
|
| 128 | + * @param string $milestone |
|
| 129 | + * @param string $state |
|
| 130 | + * @param string $assignee |
|
| 131 | + * @param string $creator |
|
| 132 | + * @param string $mentioned |
|
| 133 | + * @param string $labels |
|
| 134 | + * @param string $sort |
|
| 135 | + * @param string $direction |
|
| 136 | + * @param string $since |
|
| 137 | + * |
|
| 138 | + * @return array |
|
| 139 | + */ |
|
| 140 | + public function listRepositoryIssues( |
|
| 141 | + string $milestone = '*', |
|
| 142 | + string $state = AbstractApi::STATE_OPEN, |
|
| 143 | + string $assignee = '*', |
|
| 144 | + string $creator = '', |
|
| 145 | + string $mentioned = '', |
|
| 146 | + string $labels = '', |
|
| 147 | + string $sort = AbstractApi::SORT_CREATED, |
|
| 148 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
| 149 | + string $since = '1970-01-01' |
|
| 150 | + ): array { |
|
| 151 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 152 | + '/repos/:owner/:repo/issues?:args', |
|
| 153 | + $this->getOwner(), |
|
| 154 | + $this->getRepo(), |
|
| 155 | + http_build_query([ |
|
| 156 | + 'milestone' => $milestone, |
|
| 157 | + 'state' => $state, |
|
| 158 | + 'assignee' => $assignee, |
|
| 159 | + 'creator' => $creator, |
|
| 160 | + 'mentioned' => $mentioned, |
|
| 161 | + 'labels' => $labels, |
|
| 162 | + 'sort' => $sort, |
|
| 163 | + 'direction' => $direction, |
|
| 164 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
| 165 | + ]) |
|
| 166 | + )); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * Get a single issue |
|
| 171 | - * |
|
| 172 | - * @link https://developer.github.com/v3/issues/#get-a-single-issue |
|
| 173 | - * |
|
| 174 | - * @param int $number |
|
| 175 | - * |
|
| 176 | - * @return array |
|
| 177 | - */ |
|
| 178 | - public function getIssue(int $number): array |
|
| 179 | - { |
|
| 180 | - return $this->getApi()->request($this->getApi() |
|
| 181 | - ->sprintf( |
|
| 182 | - '/repos/:owner/:repo/issues/:number', |
|
| 183 | - $this->getOwner(), |
|
| 184 | - $this->getRepo(), |
|
| 185 | - $number |
|
| 186 | - )); |
|
| 187 | - } |
|
| 169 | + /** |
|
| 170 | + * Get a single issue |
|
| 171 | + * |
|
| 172 | + * @link https://developer.github.com/v3/issues/#get-a-single-issue |
|
| 173 | + * |
|
| 174 | + * @param int $number |
|
| 175 | + * |
|
| 176 | + * @return array |
|
| 177 | + */ |
|
| 178 | + public function getIssue(int $number): array |
|
| 179 | + { |
|
| 180 | + return $this->getApi()->request($this->getApi() |
|
| 181 | + ->sprintf( |
|
| 182 | + '/repos/:owner/:repo/issues/:number', |
|
| 183 | + $this->getOwner(), |
|
| 184 | + $this->getRepo(), |
|
| 185 | + $number |
|
| 186 | + )); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * Create an issue |
|
| 191 | - * |
|
| 192 | - * @link https://developer.github.com/v3/issues/#create-an-issue |
|
| 193 | - * |
|
| 194 | - * @param string $title |
|
| 195 | - * @param string $body |
|
| 196 | - * @param string $assignee |
|
| 197 | - * @param int $milestone |
|
| 198 | - * @param array $labels |
|
| 199 | - * |
|
| 200 | - * @return array |
|
| 201 | - */ |
|
| 202 | - public function createIssue( |
|
| 203 | - string $title, |
|
| 204 | - string $body = '', |
|
| 205 | - string $assignee = '', |
|
| 206 | - int $milestone = 0, |
|
| 207 | - array $labels = [] |
|
| 208 | - ): array { |
|
| 209 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 210 | - '/repos/:owner/:repo/issues', |
|
| 211 | - $this->getOwner(), |
|
| 212 | - $this->getRepo() |
|
| 213 | - ), Request::METHOD_POST, [ |
|
| 214 | - 'title' => $title, |
|
| 215 | - 'body' => $body, |
|
| 216 | - 'assignee' => $assignee, |
|
| 217 | - 'milestone' => $milestone, |
|
| 218 | - 'labels' => $labels |
|
| 219 | - ]); |
|
| 220 | - } |
|
| 189 | + /** |
|
| 190 | + * Create an issue |
|
| 191 | + * |
|
| 192 | + * @link https://developer.github.com/v3/issues/#create-an-issue |
|
| 193 | + * |
|
| 194 | + * @param string $title |
|
| 195 | + * @param string $body |
|
| 196 | + * @param string $assignee |
|
| 197 | + * @param int $milestone |
|
| 198 | + * @param array $labels |
|
| 199 | + * |
|
| 200 | + * @return array |
|
| 201 | + */ |
|
| 202 | + public function createIssue( |
|
| 203 | + string $title, |
|
| 204 | + string $body = '', |
|
| 205 | + string $assignee = '', |
|
| 206 | + int $milestone = 0, |
|
| 207 | + array $labels = [] |
|
| 208 | + ): array { |
|
| 209 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 210 | + '/repos/:owner/:repo/issues', |
|
| 211 | + $this->getOwner(), |
|
| 212 | + $this->getRepo() |
|
| 213 | + ), Request::METHOD_POST, [ |
|
| 214 | + 'title' => $title, |
|
| 215 | + 'body' => $body, |
|
| 216 | + 'assignee' => $assignee, |
|
| 217 | + 'milestone' => $milestone, |
|
| 218 | + 'labels' => $labels |
|
| 219 | + ]); |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Edit an issue |
|
| 224 | - * |
|
| 225 | - * @link https://developer.github.com/v3/issues/#edit-an-issue |
|
| 226 | - * |
|
| 227 | - * @param int $number |
|
| 228 | - * @param string $title |
|
| 229 | - * @param string $body |
|
| 230 | - * @param string $assignee |
|
| 231 | - * @param int $milestone |
|
| 232 | - * @param array $labels |
|
| 233 | - * |
|
| 234 | - * @return array |
|
| 235 | - */ |
|
| 236 | - public function editIssue( |
|
| 237 | - int $number, |
|
| 238 | - string $title = '', |
|
| 239 | - string $body = '', |
|
| 240 | - string $assignee = '', |
|
| 241 | - int $milestone = 0, |
|
| 242 | - array $labels = [] |
|
| 243 | - ): array { |
|
| 244 | - return $this->getApi()->request($this->getApi() |
|
| 245 | - ->sprintf( |
|
| 246 | - '/repos/:owner/:repo/issues/:number', |
|
| 247 | - $this->getOwner(), |
|
| 248 | - $this->getRepo(), |
|
| 249 | - $number |
|
| 250 | - ), Request::METHOD_PATCH, [ |
|
| 251 | - 'title' => $title, |
|
| 252 | - 'body' => $body, |
|
| 253 | - 'assignee' => $assignee, |
|
| 254 | - 'milestone' => $milestone, |
|
| 255 | - 'labels' => $labels |
|
| 256 | - ]); |
|
| 257 | - } |
|
| 222 | + /** |
|
| 223 | + * Edit an issue |
|
| 224 | + * |
|
| 225 | + * @link https://developer.github.com/v3/issues/#edit-an-issue |
|
| 226 | + * |
|
| 227 | + * @param int $number |
|
| 228 | + * @param string $title |
|
| 229 | + * @param string $body |
|
| 230 | + * @param string $assignee |
|
| 231 | + * @param int $milestone |
|
| 232 | + * @param array $labels |
|
| 233 | + * |
|
| 234 | + * @return array |
|
| 235 | + */ |
|
| 236 | + public function editIssue( |
|
| 237 | + int $number, |
|
| 238 | + string $title = '', |
|
| 239 | + string $body = '', |
|
| 240 | + string $assignee = '', |
|
| 241 | + int $milestone = 0, |
|
| 242 | + array $labels = [] |
|
| 243 | + ): array { |
|
| 244 | + return $this->getApi()->request($this->getApi() |
|
| 245 | + ->sprintf( |
|
| 246 | + '/repos/:owner/:repo/issues/:number', |
|
| 247 | + $this->getOwner(), |
|
| 248 | + $this->getRepo(), |
|
| 249 | + $number |
|
| 250 | + ), Request::METHOD_PATCH, [ |
|
| 251 | + 'title' => $title, |
|
| 252 | + 'body' => $body, |
|
| 253 | + 'assignee' => $assignee, |
|
| 254 | + 'milestone' => $milestone, |
|
| 255 | + 'labels' => $labels |
|
| 256 | + ]); |
|
| 257 | + } |
|
| 258 | 258 | } |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | class Enterprise extends AbstractReceiver |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** Available sub-Receiver */ |
|
| 16 | - const ADMIN_STATS = 'AdminStats'; |
|
| 17 | - const LDAP = 'Ldap'; |
|
| 18 | - const LICENSE = 'License'; |
|
| 19 | - const MANAGEMENT_CONSOLE = 'ManagementConsole'; |
|
| 20 | - const SEARCH_INDEXING = 'SearchIndexing'; |
|
| 15 | + /** Available sub-Receiver */ |
|
| 16 | + const ADMIN_STATS = 'AdminStats'; |
|
| 17 | + const LDAP = 'Ldap'; |
|
| 18 | + const LICENSE = 'License'; |
|
| 19 | + const MANAGEMENT_CONSOLE = 'ManagementConsole'; |
|
| 20 | + const SEARCH_INDEXING = 'SearchIndexing'; |
|
| 21 | 21 | } |
@@ -12,44 +12,44 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | abstract class AbstractOrganizations |
| 14 | 14 | { |
| 15 | - /** Api trait */ |
|
| 16 | - use Api; |
|
| 15 | + /** Api trait */ |
|
| 16 | + use Api; |
|
| 17 | 17 | |
| 18 | - /** Properties */ |
|
| 19 | - protected $organizations; |
|
| 18 | + /** Properties */ |
|
| 19 | + protected $organizations; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Constructor |
|
| 23 | - * |
|
| 24 | - * @param Organizations $organizations |
|
| 25 | - */ |
|
| 26 | - public function __construct(Organizations $organizations) |
|
| 27 | - { |
|
| 28 | - $this->setOrganizations($organizations); |
|
| 29 | - $this->setApi($organizations->getApi()); |
|
| 30 | - } |
|
| 21 | + /** |
|
| 22 | + * Constructor |
|
| 23 | + * |
|
| 24 | + * @param Organizations $organizations |
|
| 25 | + */ |
|
| 26 | + public function __construct(Organizations $organizations) |
|
| 27 | + { |
|
| 28 | + $this->setOrganizations($organizations); |
|
| 29 | + $this->setApi($organizations->getApi()); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Get organizations |
|
| 34 | - * |
|
| 35 | - * @return Organizations |
|
| 36 | - */ |
|
| 37 | - public function getOrganizations(): Organizations |
|
| 38 | - { |
|
| 39 | - return $this->organizations; |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Get organizations |
|
| 34 | + * |
|
| 35 | + * @return Organizations |
|
| 36 | + */ |
|
| 37 | + public function getOrganizations(): Organizations |
|
| 38 | + { |
|
| 39 | + return $this->organizations; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Set organizations |
|
| 44 | - * |
|
| 45 | - * @param Organizations $organizations |
|
| 46 | - * |
|
| 47 | - * @return AbstractOrganizations |
|
| 48 | - */ |
|
| 49 | - public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
| 50 | - { |
|
| 51 | - $this->organizations = $organizations; |
|
| 42 | + /** |
|
| 43 | + * Set organizations |
|
| 44 | + * |
|
| 45 | + * @param Organizations $organizations |
|
| 46 | + * |
|
| 47 | + * @return AbstractOrganizations |
|
| 48 | + */ |
|
| 49 | + public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
| 50 | + { |
|
| 51 | + $this->organizations = $organizations; |
|
| 52 | 52 | |
| 53 | - return $this; |
|
| 54 | - } |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -12,284 +12,284 @@ |
||
| 12 | 12 | class Members extends AbstractOrganizations |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Members list |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/orgs/members/#members-list |
|
| 19 | - * |
|
| 20 | - * @param string $org |
|
| 21 | - * @param string $filter |
|
| 22 | - * @param string $role |
|
| 23 | - * |
|
| 24 | - * @return array |
|
| 25 | - */ |
|
| 26 | - public function listMembers(string $org, string $filter = AbstractApi::FILTER_ALL, string $role = 'admin'): array |
|
| 27 | - { |
|
| 28 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 15 | + /** |
|
| 16 | + * Members list |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/orgs/members/#members-list |
|
| 19 | + * |
|
| 20 | + * @param string $org |
|
| 21 | + * @param string $filter |
|
| 22 | + * @param string $role |
|
| 23 | + * |
|
| 24 | + * @return array |
|
| 25 | + */ |
|
| 26 | + public function listMembers(string $org, string $filter = AbstractApi::FILTER_ALL, string $role = 'admin'): array |
|
| 27 | + { |
|
| 28 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 29 | 29 | |
| 30 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 31 | - '/orgs/:org/members?:args', |
|
| 32 | - $org, |
|
| 33 | - http_build_query(['filter' => $filter, 'role' => $role]) |
|
| 34 | - )); |
|
| 35 | - } |
|
| 30 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 31 | + '/orgs/:org/members?:args', |
|
| 32 | + $org, |
|
| 33 | + http_build_query(['filter' => $filter, 'role' => $role]) |
|
| 34 | + )); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Check membership |
|
| 39 | - * |
|
| 40 | - * @link https://developer.github.com/v3/orgs/members/#check-membership |
|
| 41 | - * |
|
| 42 | - * @param string $org |
|
| 43 | - * @param string $username |
|
| 44 | - * |
|
| 45 | - * @return bool |
|
| 46 | - * @throws \Exception |
|
| 47 | - */ |
|
| 48 | - public function checkMembership(string $org, string $username): bool |
|
| 49 | - { |
|
| 50 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username)); |
|
| 37 | + /** |
|
| 38 | + * Check membership |
|
| 39 | + * |
|
| 40 | + * @link https://developer.github.com/v3/orgs/members/#check-membership |
|
| 41 | + * |
|
| 42 | + * @param string $org |
|
| 43 | + * @param string $username |
|
| 44 | + * |
|
| 45 | + * @return bool |
|
| 46 | + * @throws \Exception |
|
| 47 | + */ |
|
| 48 | + public function checkMembership(string $org, string $username): bool |
|
| 49 | + { |
|
| 50 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username)); |
|
| 51 | 51 | |
| 52 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 53 | - return true; |
|
| 54 | - } |
|
| 52 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 53 | + return true; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return false; |
|
| 57 | - } |
|
| 56 | + return false; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Remove a member |
|
| 61 | - * |
|
| 62 | - * @link https://developer.github.com/v3/orgs/members/#remove-a-member |
|
| 63 | - * |
|
| 64 | - * @param string $org |
|
| 65 | - * @param string $username |
|
| 66 | - * |
|
| 67 | - * @return bool |
|
| 68 | - * @throws \Exception |
|
| 69 | - */ |
|
| 70 | - public function removeMember(string $org, string $username): bool |
|
| 71 | - { |
|
| 72 | - $this->getApi()->request( |
|
| 73 | - $this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username), |
|
| 74 | - Request::METHOD_DELETE |
|
| 75 | - ); |
|
| 59 | + /** |
|
| 60 | + * Remove a member |
|
| 61 | + * |
|
| 62 | + * @link https://developer.github.com/v3/orgs/members/#remove-a-member |
|
| 63 | + * |
|
| 64 | + * @param string $org |
|
| 65 | + * @param string $username |
|
| 66 | + * |
|
| 67 | + * @return bool |
|
| 68 | + * @throws \Exception |
|
| 69 | + */ |
|
| 70 | + public function removeMember(string $org, string $username): bool |
|
| 71 | + { |
|
| 72 | + $this->getApi()->request( |
|
| 73 | + $this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username), |
|
| 74 | + Request::METHOD_DELETE |
|
| 75 | + ); |
|
| 76 | 76 | |
| 77 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 78 | - return true; |
|
| 79 | - } |
|
| 77 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 78 | + return true; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - return false; |
|
| 82 | - } |
|
| 81 | + return false; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Public members list |
|
| 86 | - * |
|
| 87 | - * @link https://developer.github.com/v3/orgs/members/#public-members-list |
|
| 88 | - * |
|
| 89 | - * @param string $org |
|
| 90 | - * |
|
| 91 | - * @return array |
|
| 92 | - * @throws \Exception |
|
| 93 | - */ |
|
| 94 | - public function listPublicMembers(string $org): array |
|
| 95 | - { |
|
| 96 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); |
|
| 97 | - } |
|
| 84 | + /** |
|
| 85 | + * Public members list |
|
| 86 | + * |
|
| 87 | + * @link https://developer.github.com/v3/orgs/members/#public-members-list |
|
| 88 | + * |
|
| 89 | + * @param string $org |
|
| 90 | + * |
|
| 91 | + * @return array |
|
| 92 | + * @throws \Exception |
|
| 93 | + */ |
|
| 94 | + public function listPublicMembers(string $org): array |
|
| 95 | + { |
|
| 96 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Check public membership |
|
| 101 | - * |
|
| 102 | - * @link https://developer.github.com/v3/orgs/members/#check-public-membership |
|
| 103 | - * |
|
| 104 | - * @param string $org |
|
| 105 | - * @param string $username |
|
| 106 | - * |
|
| 107 | - * @return bool |
|
| 108 | - * @throws \Exception |
|
| 109 | - */ |
|
| 110 | - public function checkPublicMembership(string $org, string $username): bool |
|
| 111 | - { |
|
| 112 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username)); |
|
| 99 | + /** |
|
| 100 | + * Check public membership |
|
| 101 | + * |
|
| 102 | + * @link https://developer.github.com/v3/orgs/members/#check-public-membership |
|
| 103 | + * |
|
| 104 | + * @param string $org |
|
| 105 | + * @param string $username |
|
| 106 | + * |
|
| 107 | + * @return bool |
|
| 108 | + * @throws \Exception |
|
| 109 | + */ |
|
| 110 | + public function checkPublicMembership(string $org, string $username): bool |
|
| 111 | + { |
|
| 112 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username)); |
|
| 113 | 113 | |
| 114 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | - return true; |
|
| 116 | - } |
|
| 114 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return false; |
|
| 119 | - } |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Publicize a user’s membership |
|
| 123 | - * |
|
| 124 | - * @link https://developer.github.com/v3/orgs/members/#publicize-a-users-membership |
|
| 125 | - * |
|
| 126 | - * @param string $org |
|
| 127 | - * @param string $username |
|
| 128 | - * |
|
| 129 | - * @return bool |
|
| 130 | - * @throws \Exception |
|
| 131 | - */ |
|
| 132 | - public function publicizeUsersMembership(string $org, string $username): bool |
|
| 133 | - { |
|
| 134 | - $this->getApi()->request( |
|
| 135 | - $this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 136 | - Request::METHOD_PUT |
|
| 137 | - ); |
|
| 121 | + /** |
|
| 122 | + * Publicize a user’s membership |
|
| 123 | + * |
|
| 124 | + * @link https://developer.github.com/v3/orgs/members/#publicize-a-users-membership |
|
| 125 | + * |
|
| 126 | + * @param string $org |
|
| 127 | + * @param string $username |
|
| 128 | + * |
|
| 129 | + * @return bool |
|
| 130 | + * @throws \Exception |
|
| 131 | + */ |
|
| 132 | + public function publicizeUsersMembership(string $org, string $username): bool |
|
| 133 | + { |
|
| 134 | + $this->getApi()->request( |
|
| 135 | + $this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 136 | + Request::METHOD_PUT |
|
| 137 | + ); |
|
| 138 | 138 | |
| 139 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 140 | - return true; |
|
| 141 | - } |
|
| 139 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 140 | + return true; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - return false; |
|
| 144 | - } |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Conceal a user’s membership |
|
| 148 | - * |
|
| 149 | - * @link https://developer.github.com/v3/orgs/members/#conceal-a-users-membership |
|
| 150 | - * |
|
| 151 | - * @param string $org |
|
| 152 | - * @param string $username |
|
| 153 | - * |
|
| 154 | - * @return bool |
|
| 155 | - * @throws \Exception |
|
| 156 | - */ |
|
| 157 | - public function concealUsersMembership(string $org, string $username): bool |
|
| 158 | - { |
|
| 159 | - $this->getApi()->request( |
|
| 160 | - $this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 161 | - Request::METHOD_DELETE |
|
| 162 | - ); |
|
| 146 | + /** |
|
| 147 | + * Conceal a user’s membership |
|
| 148 | + * |
|
| 149 | + * @link https://developer.github.com/v3/orgs/members/#conceal-a-users-membership |
|
| 150 | + * |
|
| 151 | + * @param string $org |
|
| 152 | + * @param string $username |
|
| 153 | + * |
|
| 154 | + * @return bool |
|
| 155 | + * @throws \Exception |
|
| 156 | + */ |
|
| 157 | + public function concealUsersMembership(string $org, string $username): bool |
|
| 158 | + { |
|
| 159 | + $this->getApi()->request( |
|
| 160 | + $this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 161 | + Request::METHOD_DELETE |
|
| 162 | + ); |
|
| 163 | 163 | |
| 164 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 165 | - return true; |
|
| 166 | - } |
|
| 164 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 165 | + return true; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - return false; |
|
| 169 | - } |
|
| 168 | + return false; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Get organization membership |
|
| 173 | - * |
|
| 174 | - * @link https://developer.github.com/v3/orgs/members/#get-organization-membership |
|
| 175 | - * |
|
| 176 | - * @param string $org |
|
| 177 | - * @param string $username |
|
| 178 | - * |
|
| 179 | - * @return array |
|
| 180 | - * @throws \Exception |
|
| 181 | - */ |
|
| 182 | - public function getOrganizationMembership(string $org, string $username): array |
|
| 183 | - { |
|
| 184 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 171 | + /** |
|
| 172 | + * Get organization membership |
|
| 173 | + * |
|
| 174 | + * @link https://developer.github.com/v3/orgs/members/#get-organization-membership |
|
| 175 | + * |
|
| 176 | + * @param string $org |
|
| 177 | + * @param string $username |
|
| 178 | + * |
|
| 179 | + * @return array |
|
| 180 | + * @throws \Exception |
|
| 181 | + */ |
|
| 182 | + public function getOrganizationMembership(string $org, string $username): array |
|
| 183 | + { |
|
| 184 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 185 | 185 | |
| 186 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); |
|
| 187 | - } |
|
| 186 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * Add or update organization membership |
|
| 191 | - * |
|
| 192 | - * @link https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership |
|
| 193 | - * |
|
| 194 | - * @param string $org |
|
| 195 | - * @param string $username |
|
| 196 | - * @param string $role |
|
| 197 | - * |
|
| 198 | - * @return array |
|
| 199 | - * @throws \Exception |
|
| 200 | - */ |
|
| 201 | - public function addUpdateOrganizationMembership(string $org, string $username, string $role): array |
|
| 202 | - { |
|
| 203 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 189 | + /** |
|
| 190 | + * Add or update organization membership |
|
| 191 | + * |
|
| 192 | + * @link https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership |
|
| 193 | + * |
|
| 194 | + * @param string $org |
|
| 195 | + * @param string $username |
|
| 196 | + * @param string $role |
|
| 197 | + * |
|
| 198 | + * @return array |
|
| 199 | + * @throws \Exception |
|
| 200 | + */ |
|
| 201 | + public function addUpdateOrganizationMembership(string $org, string $username, string $role): array |
|
| 202 | + { |
|
| 203 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 204 | 204 | |
| 205 | - return $this->getApi()->request($this->getApi() |
|
| 206 | - ->sprintf( |
|
| 207 | - '/orgs/:org/memberships/:username?:args', |
|
| 208 | - $org, |
|
| 209 | - $username, |
|
| 210 | - http_build_query(['role' => $role]) |
|
| 211 | - ), Request::METHOD_PUT); |
|
| 212 | - } |
|
| 205 | + return $this->getApi()->request($this->getApi() |
|
| 206 | + ->sprintf( |
|
| 207 | + '/orgs/:org/memberships/:username?:args', |
|
| 208 | + $org, |
|
| 209 | + $username, |
|
| 210 | + http_build_query(['role' => $role]) |
|
| 211 | + ), Request::METHOD_PUT); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * Remove organization membership |
|
| 216 | - * |
|
| 217 | - * @link https://developer.github.com/v3/orgs/members/#remove-organization-membership |
|
| 218 | - * |
|
| 219 | - * @param string $org |
|
| 220 | - * @param string $username |
|
| 221 | - * |
|
| 222 | - * @return bool |
|
| 223 | - * @throws \Exception |
|
| 224 | - */ |
|
| 225 | - public function removeOrganizationMembership(string $org, string $username): bool |
|
| 226 | - { |
|
| 227 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 214 | + /** |
|
| 215 | + * Remove organization membership |
|
| 216 | + * |
|
| 217 | + * @link https://developer.github.com/v3/orgs/members/#remove-organization-membership |
|
| 218 | + * |
|
| 219 | + * @param string $org |
|
| 220 | + * @param string $username |
|
| 221 | + * |
|
| 222 | + * @return bool |
|
| 223 | + * @throws \Exception |
|
| 224 | + */ |
|
| 225 | + public function removeOrganizationMembership(string $org, string $username): bool |
|
| 226 | + { |
|
| 227 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 228 | 228 | |
| 229 | - $this->getApi()->request( |
|
| 230 | - $this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), |
|
| 231 | - Request::METHOD_DELETE |
|
| 232 | - ); |
|
| 229 | + $this->getApi()->request( |
|
| 230 | + $this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), |
|
| 231 | + Request::METHOD_DELETE |
|
| 232 | + ); |
|
| 233 | 233 | |
| 234 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 235 | - return true; |
|
| 236 | - } |
|
| 234 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 235 | + return true; |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - return false; |
|
| 239 | - } |
|
| 238 | + return false; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * List your organization memberships |
|
| 243 | - * |
|
| 244 | - * @link https://developer.github.com/v3/orgs/members/#list-your-organization-memberships |
|
| 245 | - * |
|
| 246 | - * @param string|null $state |
|
| 247 | - * |
|
| 248 | - * @return array |
|
| 249 | - * @throws \Exception |
|
| 250 | - */ |
|
| 251 | - public function listYourOrganizationMembership(string $state = null): array |
|
| 252 | - { |
|
| 253 | - return $this->getApi()->request($this->getApi()->sprintf( |
|
| 254 | - '/user/memberships/orgs?:args', |
|
| 255 | - http_build_query(['state' => $state]) |
|
| 256 | - )); |
|
| 257 | - } |
|
| 241 | + /** |
|
| 242 | + * List your organization memberships |
|
| 243 | + * |
|
| 244 | + * @link https://developer.github.com/v3/orgs/members/#list-your-organization-memberships |
|
| 245 | + * |
|
| 246 | + * @param string|null $state |
|
| 247 | + * |
|
| 248 | + * @return array |
|
| 249 | + * @throws \Exception |
|
| 250 | + */ |
|
| 251 | + public function listYourOrganizationMembership(string $state = null): array |
|
| 252 | + { |
|
| 253 | + return $this->getApi()->request($this->getApi()->sprintf( |
|
| 254 | + '/user/memberships/orgs?:args', |
|
| 255 | + http_build_query(['state' => $state]) |
|
| 256 | + )); |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Get your organization membership |
|
| 261 | - * |
|
| 262 | - * @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership |
|
| 263 | - * |
|
| 264 | - * @param string $org |
|
| 265 | - * |
|
| 266 | - * @return array |
|
| 267 | - * @throws \Exception |
|
| 268 | - */ |
|
| 269 | - public function getYourOrganizationMembership(string $org): array |
|
| 270 | - { |
|
| 271 | - return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); |
|
| 272 | - } |
|
| 259 | + /** |
|
| 260 | + * Get your organization membership |
|
| 261 | + * |
|
| 262 | + * @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership |
|
| 263 | + * |
|
| 264 | + * @param string $org |
|
| 265 | + * |
|
| 266 | + * @return array |
|
| 267 | + * @throws \Exception |
|
| 268 | + */ |
|
| 269 | + public function getYourOrganizationMembership(string $org): array |
|
| 270 | + { |
|
| 271 | + return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - /** |
|
| 275 | - * Edit your organization membership |
|
| 276 | - * |
|
| 277 | - * @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership |
|
| 278 | - * |
|
| 279 | - * @param string $org |
|
| 280 | - * @param string $state |
|
| 281 | - * |
|
| 282 | - * @return array |
|
| 283 | - * @throws \Exception |
|
| 284 | - */ |
|
| 285 | - public function editYourOrganizationMembership(string $org, string $state = AbstractApi::STATE_ACTIVE): array |
|
| 286 | - { |
|
| 287 | - return $this->getApi()->request( |
|
| 288 | - $this->getApi()->sprintf('/user/memberships/orgs/:org', $org), |
|
| 289 | - Request::METHOD_PATCH, |
|
| 290 | - [ |
|
| 291 | - 'state' => $state |
|
| 292 | - ] |
|
| 293 | - ); |
|
| 294 | - } |
|
| 274 | + /** |
|
| 275 | + * Edit your organization membership |
|
| 276 | + * |
|
| 277 | + * @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership |
|
| 278 | + * |
|
| 279 | + * @param string $org |
|
| 280 | + * @param string $state |
|
| 281 | + * |
|
| 282 | + * @return array |
|
| 283 | + * @throws \Exception |
|
| 284 | + */ |
|
| 285 | + public function editYourOrganizationMembership(string $org, string $state = AbstractApi::STATE_ACTIVE): array |
|
| 286 | + { |
|
| 287 | + return $this->getApi()->request( |
|
| 288 | + $this->getApi()->sprintf('/user/memberships/orgs/:org', $org), |
|
| 289 | + Request::METHOD_PATCH, |
|
| 290 | + [ |
|
| 291 | + 'state' => $state |
|
| 292 | + ] |
|
| 293 | + ); |
|
| 294 | + } |
|
| 295 | 295 | } |
@@ -12,145 +12,145 @@ |
||
| 12 | 12 | class Hooks extends AbstractOrganizations |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List hooks |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/orgs/hooks/#list-hooks |
|
| 19 | - * |
|
| 20 | - * @param string $org |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - * @throws \Exception |
|
| 24 | - */ |
|
| 25 | - public function listHooks(string $org): array |
|
| 26 | - { |
|
| 27 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org)); |
|
| 28 | - } |
|
| 15 | + /** |
|
| 16 | + * List hooks |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/orgs/hooks/#list-hooks |
|
| 19 | + * |
|
| 20 | + * @param string $org |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + * @throws \Exception |
|
| 24 | + */ |
|
| 25 | + public function listHooks(string $org): array |
|
| 26 | + { |
|
| 27 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org)); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Get single hook |
|
| 32 | - * |
|
| 33 | - * @link https://developer.github.com/v3/orgs/hooks/#get-single-hook |
|
| 34 | - * |
|
| 35 | - * @param string $org |
|
| 36 | - * @param int $id |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - * @throws \Exception |
|
| 40 | - */ |
|
| 41 | - public function getSingleHook(string $org, int $id): array |
|
| 42 | - { |
|
| 43 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id)); |
|
| 44 | - } |
|
| 30 | + /** |
|
| 31 | + * Get single hook |
|
| 32 | + * |
|
| 33 | + * @link https://developer.github.com/v3/orgs/hooks/#get-single-hook |
|
| 34 | + * |
|
| 35 | + * @param string $org |
|
| 36 | + * @param int $id |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + * @throws \Exception |
|
| 40 | + */ |
|
| 41 | + public function getSingleHook(string $org, int $id): array |
|
| 42 | + { |
|
| 43 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id)); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Create a hook |
|
| 48 | - * |
|
| 49 | - * @link https://developer.github.com/v3/orgs/hooks/#create-a-hook |
|
| 50 | - * |
|
| 51 | - * @param string $org |
|
| 52 | - * @param string $name |
|
| 53 | - * @param string|array $config |
|
| 54 | - * @param array $events |
|
| 55 | - * @param bool $active |
|
| 56 | - * |
|
| 57 | - * @return array |
|
| 58 | - * @throws \Exception |
|
| 59 | - */ |
|
| 60 | - public function createHook( |
|
| 61 | - string $org, |
|
| 62 | - string $name, |
|
| 63 | - $config, |
|
| 64 | - array $events = [AbstractApi::EVENTS_PUSH], |
|
| 65 | - bool $active = false |
|
| 66 | - ): array { |
|
| 67 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org), Request::METHOD_POST, [ |
|
| 68 | - 'name' => $name, |
|
| 69 | - 'config' => $config, |
|
| 70 | - 'events' => $events, |
|
| 71 | - 'active' => $active |
|
| 72 | - ]); |
|
| 73 | - } |
|
| 46 | + /** |
|
| 47 | + * Create a hook |
|
| 48 | + * |
|
| 49 | + * @link https://developer.github.com/v3/orgs/hooks/#create-a-hook |
|
| 50 | + * |
|
| 51 | + * @param string $org |
|
| 52 | + * @param string $name |
|
| 53 | + * @param string|array $config |
|
| 54 | + * @param array $events |
|
| 55 | + * @param bool $active |
|
| 56 | + * |
|
| 57 | + * @return array |
|
| 58 | + * @throws \Exception |
|
| 59 | + */ |
|
| 60 | + public function createHook( |
|
| 61 | + string $org, |
|
| 62 | + string $name, |
|
| 63 | + $config, |
|
| 64 | + array $events = [AbstractApi::EVENTS_PUSH], |
|
| 65 | + bool $active = false |
|
| 66 | + ): array { |
|
| 67 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org), Request::METHOD_POST, [ |
|
| 68 | + 'name' => $name, |
|
| 69 | + 'config' => $config, |
|
| 70 | + 'events' => $events, |
|
| 71 | + 'active' => $active |
|
| 72 | + ]); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Edit a hook |
|
| 77 | - * |
|
| 78 | - * @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook |
|
| 79 | - * |
|
| 80 | - * @param string $org |
|
| 81 | - * @param int $id |
|
| 82 | - * @param string|array $config |
|
| 83 | - * @param array $events |
|
| 84 | - * @param bool $active |
|
| 85 | - * |
|
| 86 | - * @return array |
|
| 87 | - * @throws \Exception |
|
| 88 | - */ |
|
| 89 | - public function editHook( |
|
| 90 | - string $org, |
|
| 91 | - int $id, |
|
| 92 | - $config, |
|
| 93 | - array $events = [AbstractApi::EVENTS_PUSH], |
|
| 94 | - bool $active = false |
|
| 95 | - ): array { |
|
| 96 | - return $this->getApi()->request( |
|
| 97 | - $this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
| 98 | - Request::METHOD_PATCH, |
|
| 99 | - [ |
|
| 100 | - 'config' => $config, |
|
| 101 | - 'events' => $events, |
|
| 102 | - 'active' => $active |
|
| 103 | - ] |
|
| 104 | - ); |
|
| 105 | - } |
|
| 75 | + /** |
|
| 76 | + * Edit a hook |
|
| 77 | + * |
|
| 78 | + * @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook |
|
| 79 | + * |
|
| 80 | + * @param string $org |
|
| 81 | + * @param int $id |
|
| 82 | + * @param string|array $config |
|
| 83 | + * @param array $events |
|
| 84 | + * @param bool $active |
|
| 85 | + * |
|
| 86 | + * @return array |
|
| 87 | + * @throws \Exception |
|
| 88 | + */ |
|
| 89 | + public function editHook( |
|
| 90 | + string $org, |
|
| 91 | + int $id, |
|
| 92 | + $config, |
|
| 93 | + array $events = [AbstractApi::EVENTS_PUSH], |
|
| 94 | + bool $active = false |
|
| 95 | + ): array { |
|
| 96 | + return $this->getApi()->request( |
|
| 97 | + $this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
| 98 | + Request::METHOD_PATCH, |
|
| 99 | + [ |
|
| 100 | + 'config' => $config, |
|
| 101 | + 'events' => $events, |
|
| 102 | + 'active' => $active |
|
| 103 | + ] |
|
| 104 | + ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Ping a hook |
|
| 109 | - * |
|
| 110 | - * @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook |
|
| 111 | - * |
|
| 112 | - * @param string $org |
|
| 113 | - * @param int $id |
|
| 114 | - * |
|
| 115 | - * @return bool |
|
| 116 | - * @throws \Exception |
|
| 117 | - */ |
|
| 118 | - public function pingHook(string $org, int $id): bool |
|
| 119 | - { |
|
| 120 | - $this->getApi()->request( |
|
| 121 | - $this->getApi()->sprintf('/orgs/:org/hooks/:id/pings', $org, (string)$id), |
|
| 122 | - Request::METHOD_POST |
|
| 123 | - ); |
|
| 107 | + /** |
|
| 108 | + * Ping a hook |
|
| 109 | + * |
|
| 110 | + * @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook |
|
| 111 | + * |
|
| 112 | + * @param string $org |
|
| 113 | + * @param int $id |
|
| 114 | + * |
|
| 115 | + * @return bool |
|
| 116 | + * @throws \Exception |
|
| 117 | + */ |
|
| 118 | + public function pingHook(string $org, int $id): bool |
|
| 119 | + { |
|
| 120 | + $this->getApi()->request( |
|
| 121 | + $this->getApi()->sprintf('/orgs/:org/hooks/:id/pings', $org, (string)$id), |
|
| 122 | + Request::METHOD_POST |
|
| 123 | + ); |
|
| 124 | 124 | |
| 125 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 126 | - return true; |
|
| 127 | - } |
|
| 125 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 126 | + return true; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - return false; |
|
| 130 | - } |
|
| 129 | + return false; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Delete a hook |
|
| 134 | - * |
|
| 135 | - * @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook |
|
| 136 | - * |
|
| 137 | - * @param string $org |
|
| 138 | - * @param int $id |
|
| 139 | - * |
|
| 140 | - * @return bool |
|
| 141 | - * @throws \Exception |
|
| 142 | - */ |
|
| 143 | - public function deleteHook(string $org, int $id): bool |
|
| 144 | - { |
|
| 145 | - $this->getApi()->request( |
|
| 146 | - $this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
| 147 | - Request::METHOD_DELETE |
|
| 148 | - ); |
|
| 132 | + /** |
|
| 133 | + * Delete a hook |
|
| 134 | + * |
|
| 135 | + * @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook |
|
| 136 | + * |
|
| 137 | + * @param string $org |
|
| 138 | + * @param int $id |
|
| 139 | + * |
|
| 140 | + * @return bool |
|
| 141 | + * @throws \Exception |
|
| 142 | + */ |
|
| 143 | + public function deleteHook(string $org, int $id): bool |
|
| 144 | + { |
|
| 145 | + $this->getApi()->request( |
|
| 146 | + $this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
| 147 | + Request::METHOD_DELETE |
|
| 148 | + ); |
|
| 149 | 149 | |
| 150 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 151 | - return true; |
|
| 152 | - } |
|
| 150 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 151 | + return true; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - return false; |
|
| 155 | - } |
|
| 154 | + return false; |
|
| 155 | + } |
|
| 156 | 156 | } |
@@ -12,291 +12,291 @@ |
||
| 12 | 12 | class Teams extends AbstractOrganizations |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List teams |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/orgs/teams/#list-teams |
|
| 19 | - * |
|
| 20 | - * @param string $org |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - * @throws \Exception |
|
| 24 | - */ |
|
| 25 | - public function listTeams(string $org): array |
|
| 26 | - { |
|
| 27 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org)); |
|
| 28 | - } |
|
| 15 | + /** |
|
| 16 | + * List teams |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/orgs/teams/#list-teams |
|
| 19 | + * |
|
| 20 | + * @param string $org |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + * @throws \Exception |
|
| 24 | + */ |
|
| 25 | + public function listTeams(string $org): array |
|
| 26 | + { |
|
| 27 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org)); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Get team |
|
| 32 | - * |
|
| 33 | - * @link https://developer.github.com/v3/orgs/teams/#get-team |
|
| 34 | - * |
|
| 35 | - * @param int $id |
|
| 36 | - * |
|
| 37 | - * @return array |
|
| 38 | - * @throws \Exception |
|
| 39 | - */ |
|
| 40 | - public function getTeam(int $id): array |
|
| 41 | - { |
|
| 42 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id)); |
|
| 43 | - } |
|
| 30 | + /** |
|
| 31 | + * Get team |
|
| 32 | + * |
|
| 33 | + * @link https://developer.github.com/v3/orgs/teams/#get-team |
|
| 34 | + * |
|
| 35 | + * @param int $id |
|
| 36 | + * |
|
| 37 | + * @return array |
|
| 38 | + * @throws \Exception |
|
| 39 | + */ |
|
| 40 | + public function getTeam(int $id): array |
|
| 41 | + { |
|
| 42 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id)); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Create team |
|
| 47 | - * |
|
| 48 | - * @link https://developer.github.com/v3/orgs/teams/#create-team |
|
| 49 | - * |
|
| 50 | - * @param string $org |
|
| 51 | - * @param string $name |
|
| 52 | - * @param null|string $description |
|
| 53 | - * @param array $repoNames |
|
| 54 | - * @param string $permission |
|
| 55 | - * |
|
| 56 | - * @return array |
|
| 57 | - * @throws \Exception |
|
| 58 | - */ |
|
| 59 | - public function createTeam( |
|
| 60 | - string $org, |
|
| 61 | - string $name, |
|
| 62 | - string $description = null, |
|
| 63 | - array $repoNames = [], |
|
| 64 | - string $permission = AbstractApi::PERMISSION_PULL |
|
| 65 | - ): array { |
|
| 66 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org), Request::METHOD_POST, [ |
|
| 67 | - 'name' => $name, |
|
| 68 | - 'description' => $description, |
|
| 69 | - 'repo_names' => $repoNames, |
|
| 70 | - 'permission' => $permission |
|
| 71 | - ]); |
|
| 72 | - } |
|
| 45 | + /** |
|
| 46 | + * Create team |
|
| 47 | + * |
|
| 48 | + * @link https://developer.github.com/v3/orgs/teams/#create-team |
|
| 49 | + * |
|
| 50 | + * @param string $org |
|
| 51 | + * @param string $name |
|
| 52 | + * @param null|string $description |
|
| 53 | + * @param array $repoNames |
|
| 54 | + * @param string $permission |
|
| 55 | + * |
|
| 56 | + * @return array |
|
| 57 | + * @throws \Exception |
|
| 58 | + */ |
|
| 59 | + public function createTeam( |
|
| 60 | + string $org, |
|
| 61 | + string $name, |
|
| 62 | + string $description = null, |
|
| 63 | + array $repoNames = [], |
|
| 64 | + string $permission = AbstractApi::PERMISSION_PULL |
|
| 65 | + ): array { |
|
| 66 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org), Request::METHOD_POST, [ |
|
| 67 | + 'name' => $name, |
|
| 68 | + 'description' => $description, |
|
| 69 | + 'repo_names' => $repoNames, |
|
| 70 | + 'permission' => $permission |
|
| 71 | + ]); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Edit team |
|
| 76 | - * |
|
| 77 | - * @link https://developer.github.com/v3/orgs/teams/#edit-team |
|
| 78 | - * |
|
| 79 | - * @param int $id |
|
| 80 | - * @param string $name |
|
| 81 | - * @param null|string $description |
|
| 82 | - * @param string $permission |
|
| 83 | - * |
|
| 84 | - * @return array |
|
| 85 | - * @throws \Exception |
|
| 86 | - */ |
|
| 87 | - public function editTeam( |
|
| 88 | - int $id, |
|
| 89 | - string $name, |
|
| 90 | - string $description = null, |
|
| 91 | - string $permission = AbstractApi::PERMISSION_PULL |
|
| 92 | - ): array { |
|
| 93 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_PATCH, [ |
|
| 94 | - 'name' => $name, |
|
| 95 | - 'description' => $description, |
|
| 96 | - 'permission' => $permission |
|
| 97 | - ]); |
|
| 98 | - } |
|
| 74 | + /** |
|
| 75 | + * Edit team |
|
| 76 | + * |
|
| 77 | + * @link https://developer.github.com/v3/orgs/teams/#edit-team |
|
| 78 | + * |
|
| 79 | + * @param int $id |
|
| 80 | + * @param string $name |
|
| 81 | + * @param null|string $description |
|
| 82 | + * @param string $permission |
|
| 83 | + * |
|
| 84 | + * @return array |
|
| 85 | + * @throws \Exception |
|
| 86 | + */ |
|
| 87 | + public function editTeam( |
|
| 88 | + int $id, |
|
| 89 | + string $name, |
|
| 90 | + string $description = null, |
|
| 91 | + string $permission = AbstractApi::PERMISSION_PULL |
|
| 92 | + ): array { |
|
| 93 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_PATCH, [ |
|
| 94 | + 'name' => $name, |
|
| 95 | + 'description' => $description, |
|
| 96 | + 'permission' => $permission |
|
| 97 | + ]); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Delete team |
|
| 102 | - * |
|
| 103 | - * @link https://developer.github.com/v3/orgs/teams/#delete-team |
|
| 104 | - * |
|
| 105 | - * @param int $id |
|
| 106 | - * |
|
| 107 | - * @return bool |
|
| 108 | - * @throws \Exception |
|
| 109 | - */ |
|
| 110 | - public function deleteTeam(int $id): bool |
|
| 111 | - { |
|
| 112 | - $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_DELETE); |
|
| 100 | + /** |
|
| 101 | + * Delete team |
|
| 102 | + * |
|
| 103 | + * @link https://developer.github.com/v3/orgs/teams/#delete-team |
|
| 104 | + * |
|
| 105 | + * @param int $id |
|
| 106 | + * |
|
| 107 | + * @return bool |
|
| 108 | + * @throws \Exception |
|
| 109 | + */ |
|
| 110 | + public function deleteTeam(int $id): bool |
|
| 111 | + { |
|
| 112 | + $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_DELETE); |
|
| 113 | 113 | |
| 114 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | - return true; |
|
| 116 | - } |
|
| 114 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return false; |
|
| 119 | - } |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * List team members |
|
| 123 | - * |
|
| 124 | - * @link https://developer.github.com/v3/orgs/teams/#list-team-members |
|
| 125 | - * |
|
| 126 | - * @param int $id |
|
| 127 | - * |
|
| 128 | - * @return array |
|
| 129 | - * @throws \Exception |
|
| 130 | - */ |
|
| 131 | - public function listTeamMembers(int $id): array |
|
| 132 | - { |
|
| 133 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id)); |
|
| 134 | - } |
|
| 121 | + /** |
|
| 122 | + * List team members |
|
| 123 | + * |
|
| 124 | + * @link https://developer.github.com/v3/orgs/teams/#list-team-members |
|
| 125 | + * |
|
| 126 | + * @param int $id |
|
| 127 | + * |
|
| 128 | + * @return array |
|
| 129 | + * @throws \Exception |
|
| 130 | + */ |
|
| 131 | + public function listTeamMembers(int $id): array |
|
| 132 | + { |
|
| 133 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id)); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Get team membership |
|
| 138 | - * |
|
| 139 | - * @link https://developer.github.com/v3/orgs/teams/#get-team-membership |
|
| 140 | - * |
|
| 141 | - * @param int $id |
|
| 142 | - * @param string $username |
|
| 143 | - * |
|
| 144 | - * @return array |
|
| 145 | - * @throws \Exception |
|
| 146 | - */ |
|
| 147 | - public function getTeamMembership(int $id, string $username): array |
|
| 148 | - { |
|
| 149 | - return $this->getApi()->request($this->getApi() |
|
| 150 | - ->sprintf('/teams/:id/memberships/:username', (string)$id, $username)); |
|
| 151 | - } |
|
| 136 | + /** |
|
| 137 | + * Get team membership |
|
| 138 | + * |
|
| 139 | + * @link https://developer.github.com/v3/orgs/teams/#get-team-membership |
|
| 140 | + * |
|
| 141 | + * @param int $id |
|
| 142 | + * @param string $username |
|
| 143 | + * |
|
| 144 | + * @return array |
|
| 145 | + * @throws \Exception |
|
| 146 | + */ |
|
| 147 | + public function getTeamMembership(int $id, string $username): array |
|
| 148 | + { |
|
| 149 | + return $this->getApi()->request($this->getApi() |
|
| 150 | + ->sprintf('/teams/:id/memberships/:username', (string)$id, $username)); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Add team membership |
|
| 155 | - * |
|
| 156 | - * @link https://developer.github.com/v3/orgs/teams/#add-team-membership |
|
| 157 | - * |
|
| 158 | - * @param int $id |
|
| 159 | - * @param string $username |
|
| 160 | - * |
|
| 161 | - * @return array |
|
| 162 | - * @throws \Exception |
|
| 163 | - */ |
|
| 164 | - public function addTeamMembership(int $id, string $username): array |
|
| 165 | - { |
|
| 166 | - return $this->getApi()->request( |
|
| 167 | - $this->getApi() |
|
| 168 | - ->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
| 169 | - Request::METHOD_PUT |
|
| 170 | - ); |
|
| 171 | - } |
|
| 153 | + /** |
|
| 154 | + * Add team membership |
|
| 155 | + * |
|
| 156 | + * @link https://developer.github.com/v3/orgs/teams/#add-team-membership |
|
| 157 | + * |
|
| 158 | + * @param int $id |
|
| 159 | + * @param string $username |
|
| 160 | + * |
|
| 161 | + * @return array |
|
| 162 | + * @throws \Exception |
|
| 163 | + */ |
|
| 164 | + public function addTeamMembership(int $id, string $username): array |
|
| 165 | + { |
|
| 166 | + return $this->getApi()->request( |
|
| 167 | + $this->getApi() |
|
| 168 | + ->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
| 169 | + Request::METHOD_PUT |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Remove team membership |
|
| 175 | - * |
|
| 176 | - * @link https://developer.github.com/v3/orgs/teams/#remove-team-membership |
|
| 177 | - * |
|
| 178 | - * @param int $id |
|
| 179 | - * @param string $username |
|
| 180 | - * |
|
| 181 | - * @return bool |
|
| 182 | - * @throws \Exception |
|
| 183 | - */ |
|
| 184 | - public function removeTeamMembership(int $id, string $username): bool |
|
| 185 | - { |
|
| 186 | - $this->getApi()->request( |
|
| 187 | - $this->getApi()->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
| 188 | - Request::METHOD_DELETE |
|
| 189 | - ); |
|
| 173 | + /** |
|
| 174 | + * Remove team membership |
|
| 175 | + * |
|
| 176 | + * @link https://developer.github.com/v3/orgs/teams/#remove-team-membership |
|
| 177 | + * |
|
| 178 | + * @param int $id |
|
| 179 | + * @param string $username |
|
| 180 | + * |
|
| 181 | + * @return bool |
|
| 182 | + * @throws \Exception |
|
| 183 | + */ |
|
| 184 | + public function removeTeamMembership(int $id, string $username): bool |
|
| 185 | + { |
|
| 186 | + $this->getApi()->request( |
|
| 187 | + $this->getApi()->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
| 188 | + Request::METHOD_DELETE |
|
| 189 | + ); |
|
| 190 | 190 | |
| 191 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 192 | - return true; |
|
| 193 | - } |
|
| 191 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - return false; |
|
| 196 | - } |
|
| 195 | + return false; |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * List team repos |
|
| 200 | - * |
|
| 201 | - * @link https://developer.github.com/v3/orgs/teams/#list-team-repos |
|
| 202 | - * |
|
| 203 | - * @param int $id |
|
| 204 | - * |
|
| 205 | - * @return array |
|
| 206 | - * @throws \Exception |
|
| 207 | - */ |
|
| 208 | - public function listTeamRepos(int $id): array |
|
| 209 | - { |
|
| 210 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id)); |
|
| 211 | - } |
|
| 198 | + /** |
|
| 199 | + * List team repos |
|
| 200 | + * |
|
| 201 | + * @link https://developer.github.com/v3/orgs/teams/#list-team-repos |
|
| 202 | + * |
|
| 203 | + * @param int $id |
|
| 204 | + * |
|
| 205 | + * @return array |
|
| 206 | + * @throws \Exception |
|
| 207 | + */ |
|
| 208 | + public function listTeamRepos(int $id): array |
|
| 209 | + { |
|
| 210 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id)); |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Check if a team manages a repository |
|
| 215 | - * |
|
| 216 | - * @link https://developer.github.com/v3/orgs/teams/#get-team-repo |
|
| 217 | - * |
|
| 218 | - * @param int $id |
|
| 219 | - * |
|
| 220 | - * @return bool |
|
| 221 | - * @throws \Exception |
|
| 222 | - */ |
|
| 223 | - public function checkTeamManagesRepository(int $id): bool |
|
| 224 | - { |
|
| 225 | - $this->getApi()->request($this->getApi()->sprintf( |
|
| 226 | - '/teams/:id/repos/:owner/:repo', |
|
| 227 | - (string)$id, |
|
| 228 | - $this->getOrganizations()->getOwner(), |
|
| 229 | - $this->getOrganizations()->getRepo() |
|
| 230 | - )); |
|
| 213 | + /** |
|
| 214 | + * Check if a team manages a repository |
|
| 215 | + * |
|
| 216 | + * @link https://developer.github.com/v3/orgs/teams/#get-team-repo |
|
| 217 | + * |
|
| 218 | + * @param int $id |
|
| 219 | + * |
|
| 220 | + * @return bool |
|
| 221 | + * @throws \Exception |
|
| 222 | + */ |
|
| 223 | + public function checkTeamManagesRepository(int $id): bool |
|
| 224 | + { |
|
| 225 | + $this->getApi()->request($this->getApi()->sprintf( |
|
| 226 | + '/teams/:id/repos/:owner/:repo', |
|
| 227 | + (string)$id, |
|
| 228 | + $this->getOrganizations()->getOwner(), |
|
| 229 | + $this->getOrganizations()->getRepo() |
|
| 230 | + )); |
|
| 231 | 231 | |
| 232 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 233 | - return true; |
|
| 234 | - } |
|
| 232 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 233 | + return true; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - return false; |
|
| 237 | - } |
|
| 236 | + return false; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Add team repository |
|
| 241 | - * |
|
| 242 | - * @link https://developer.github.com/v3/orgs/teams/#add-team-repo |
|
| 243 | - * |
|
| 244 | - * @param int $id |
|
| 245 | - * |
|
| 246 | - * @return bool|array |
|
| 247 | - * @throws \Exception |
|
| 248 | - */ |
|
| 249 | - public function addTeamRepository(int $id) |
|
| 250 | - { |
|
| 251 | - $return = $this->getApi()->request($this->getApi()->sprintf( |
|
| 252 | - '/teams/:id/repos/:org/:repo', |
|
| 253 | - (string)$id, |
|
| 254 | - $this->getOrganizations()->getOwner(), |
|
| 255 | - $this->getOrganizations()->getRepo() |
|
| 256 | - ), Request::METHOD_PUT); |
|
| 239 | + /** |
|
| 240 | + * Add team repository |
|
| 241 | + * |
|
| 242 | + * @link https://developer.github.com/v3/orgs/teams/#add-team-repo |
|
| 243 | + * |
|
| 244 | + * @param int $id |
|
| 245 | + * |
|
| 246 | + * @return bool|array |
|
| 247 | + * @throws \Exception |
|
| 248 | + */ |
|
| 249 | + public function addTeamRepository(int $id) |
|
| 250 | + { |
|
| 251 | + $return = $this->getApi()->request($this->getApi()->sprintf( |
|
| 252 | + '/teams/:id/repos/:org/:repo', |
|
| 253 | + (string)$id, |
|
| 254 | + $this->getOrganizations()->getOwner(), |
|
| 255 | + $this->getOrganizations()->getRepo() |
|
| 256 | + ), Request::METHOD_PUT); |
|
| 257 | 257 | |
| 258 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 259 | - return true; |
|
| 260 | - } |
|
| 258 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 259 | + return true; |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - return $return; |
|
| 263 | - } |
|
| 262 | + return $return; |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Remove team repository |
|
| 267 | - * |
|
| 268 | - * @link https://developer.github.com/v3/orgs/teams/#remove-team-repo |
|
| 269 | - * |
|
| 270 | - * @param int $id |
|
| 271 | - * |
|
| 272 | - * @return bool |
|
| 273 | - * @throws \Exception |
|
| 274 | - */ |
|
| 275 | - public function removeTeamRepository(int $id): bool |
|
| 276 | - { |
|
| 277 | - $this->getApi()->request($this->getApi()->sprintf( |
|
| 278 | - '/teams/:id/repos/:owner/:repo', |
|
| 279 | - (string)$id, |
|
| 280 | - $this->getOrganizations()->getOwner(), |
|
| 281 | - $this->getOrganizations()->getRepo() |
|
| 282 | - ), Request::METHOD_DELETE); |
|
| 265 | + /** |
|
| 266 | + * Remove team repository |
|
| 267 | + * |
|
| 268 | + * @link https://developer.github.com/v3/orgs/teams/#remove-team-repo |
|
| 269 | + * |
|
| 270 | + * @param int $id |
|
| 271 | + * |
|
| 272 | + * @return bool |
|
| 273 | + * @throws \Exception |
|
| 274 | + */ |
|
| 275 | + public function removeTeamRepository(int $id): bool |
|
| 276 | + { |
|
| 277 | + $this->getApi()->request($this->getApi()->sprintf( |
|
| 278 | + '/teams/:id/repos/:owner/:repo', |
|
| 279 | + (string)$id, |
|
| 280 | + $this->getOrganizations()->getOwner(), |
|
| 281 | + $this->getOrganizations()->getRepo() |
|
| 282 | + ), Request::METHOD_DELETE); |
|
| 283 | 283 | |
| 284 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 285 | - return true; |
|
| 286 | - } |
|
| 284 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 285 | + return true; |
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | - return false; |
|
| 289 | - } |
|
| 288 | + return false; |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | - /** |
|
| 292 | - * List user teams |
|
| 293 | - * |
|
| 294 | - * @link https://developer.github.com/v3/orgs/teams/#list-user-teams |
|
| 295 | - * @return array |
|
| 296 | - * @throws \Exception |
|
| 297 | - */ |
|
| 298 | - public function lisUserTeams(): array |
|
| 299 | - { |
|
| 300 | - return $this->getApi()->request($this->getApi()->sprintf('/user/teams')); |
|
| 301 | - } |
|
| 291 | + /** |
|
| 292 | + * List user teams |
|
| 293 | + * |
|
| 294 | + * @link https://developer.github.com/v3/orgs/teams/#list-user-teams |
|
| 295 | + * @return array |
|
| 296 | + * @throws \Exception |
|
| 297 | + */ |
|
| 298 | + public function lisUserTeams(): array |
|
| 299 | + { |
|
| 300 | + return $this->getApi()->request($this->getApi()->sprintf('/user/teams')); |
|
| 301 | + } |
|
| 302 | 302 | } |
@@ -19,30 +19,30 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | trait Api |
| 21 | 21 | { |
| 22 | - /** @var mixed */ |
|
| 23 | - protected $api; |
|
| 22 | + /** @var mixed */ |
|
| 23 | + protected $api; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Get api |
|
| 27 | - * |
|
| 28 | - * @return AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories |
|
| 29 | - */ |
|
| 30 | - public function getApi() |
|
| 31 | - { |
|
| 32 | - return $this->api; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * Get api |
|
| 27 | + * |
|
| 28 | + * @return AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories |
|
| 29 | + */ |
|
| 30 | + public function getApi() |
|
| 31 | + { |
|
| 32 | + return $this->api; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Set api |
|
| 37 | - * |
|
| 38 | - * @param AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories $api |
|
| 39 | - * |
|
| 40 | - * @return Api |
|
| 41 | - */ |
|
| 42 | - public function setApi($api): self |
|
| 43 | - { |
|
| 44 | - $this->api = $api; |
|
| 35 | + /** |
|
| 36 | + * Set api |
|
| 37 | + * |
|
| 38 | + * @param AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories $api |
|
| 39 | + * |
|
| 40 | + * @return Api |
|
| 41 | + */ |
|
| 42 | + public function setApi($api): self |
|
| 43 | + { |
|
| 44 | + $this->api = $api; |
|
| 45 | 45 | |
| 46 | - return $this; |
|
| 47 | - } |
|
| 46 | + return $this; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -12,87 +12,87 @@ |
||
| 12 | 12 | class Users extends AbstractReceiver |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** Available sub-Receiver */ |
|
| 16 | - const EMAILS = 'Emails'; |
|
| 17 | - const FOLLOWERS = 'Followers'; |
|
| 18 | - const PUBLIC_KEYS = 'PublicKeys'; |
|
| 15 | + /** Available sub-Receiver */ |
|
| 16 | + const EMAILS = 'Emails'; |
|
| 17 | + const FOLLOWERS = 'Followers'; |
|
| 18 | + const PUBLIC_KEYS = 'PublicKeys'; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Get a single user |
|
| 22 | - * |
|
| 23 | - * @link https://developer.github.com/v3/users/#get-a-single-user |
|
| 24 | - * |
|
| 25 | - * @param string $username |
|
| 26 | - * |
|
| 27 | - * @return array |
|
| 28 | - * @throws \Exception |
|
| 29 | - */ |
|
| 30 | - public function getSingleUser(string $username): array |
|
| 31 | - { |
|
| 32 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username', $username)); |
|
| 33 | - } |
|
| 20 | + /** |
|
| 21 | + * Get a single user |
|
| 22 | + * |
|
| 23 | + * @link https://developer.github.com/v3/users/#get-a-single-user |
|
| 24 | + * |
|
| 25 | + * @param string $username |
|
| 26 | + * |
|
| 27 | + * @return array |
|
| 28 | + * @throws \Exception |
|
| 29 | + */ |
|
| 30 | + public function getSingleUser(string $username): array |
|
| 31 | + { |
|
| 32 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username', $username)); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Get the authenticated user |
|
| 37 | - * |
|
| 38 | - * @link https://developer.github.com/v3/users/#get-the-authenticated-user |
|
| 39 | - * @return array |
|
| 40 | - * @throws \Exception |
|
| 41 | - */ |
|
| 42 | - public function getUser(): array |
|
| 43 | - { |
|
| 44 | - return $this->getApi()->request($this->getApi()->sprintf('/user')); |
|
| 45 | - } |
|
| 35 | + /** |
|
| 36 | + * Get the authenticated user |
|
| 37 | + * |
|
| 38 | + * @link https://developer.github.com/v3/users/#get-the-authenticated-user |
|
| 39 | + * @return array |
|
| 40 | + * @throws \Exception |
|
| 41 | + */ |
|
| 42 | + public function getUser(): array |
|
| 43 | + { |
|
| 44 | + return $this->getApi()->request($this->getApi()->sprintf('/user')); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Update the authenticated user |
|
| 49 | - * |
|
| 50 | - * @link https://developer.github.com/v3/users/#update-the-authenticated-user |
|
| 51 | - * |
|
| 52 | - * @param string $name |
|
| 53 | - * @param string $email |
|
| 54 | - * @param string $blog |
|
| 55 | - * @param string $company |
|
| 56 | - * @param string $location |
|
| 57 | - * @param bool $hireable |
|
| 58 | - * @param string $bio |
|
| 59 | - * |
|
| 60 | - * @return array |
|
| 61 | - * @throws \Exception |
|
| 62 | - */ |
|
| 63 | - public function updateUser( |
|
| 64 | - string $name = null, |
|
| 65 | - string $email = null, |
|
| 66 | - string $blog = null, |
|
| 67 | - string $company = null, |
|
| 68 | - string $location = null, |
|
| 69 | - bool $hireable = false, |
|
| 70 | - string $bio = null |
|
| 71 | - ): array { |
|
| 72 | - return $this->getApi()->request($this->getApi()->sprintf('/user'), Request::METHOD_PATCH, [ |
|
| 73 | - 'name' => $name, |
|
| 74 | - 'email' => $email, |
|
| 75 | - 'blog' => $blog, |
|
| 76 | - 'company' => $company, |
|
| 77 | - 'location' => $location, |
|
| 78 | - 'hireable' => $hireable, |
|
| 79 | - 'bio' => $bio |
|
| 80 | - ]); |
|
| 81 | - } |
|
| 47 | + /** |
|
| 48 | + * Update the authenticated user |
|
| 49 | + * |
|
| 50 | + * @link https://developer.github.com/v3/users/#update-the-authenticated-user |
|
| 51 | + * |
|
| 52 | + * @param string $name |
|
| 53 | + * @param string $email |
|
| 54 | + * @param string $blog |
|
| 55 | + * @param string $company |
|
| 56 | + * @param string $location |
|
| 57 | + * @param bool $hireable |
|
| 58 | + * @param string $bio |
|
| 59 | + * |
|
| 60 | + * @return array |
|
| 61 | + * @throws \Exception |
|
| 62 | + */ |
|
| 63 | + public function updateUser( |
|
| 64 | + string $name = null, |
|
| 65 | + string $email = null, |
|
| 66 | + string $blog = null, |
|
| 67 | + string $company = null, |
|
| 68 | + string $location = null, |
|
| 69 | + bool $hireable = false, |
|
| 70 | + string $bio = null |
|
| 71 | + ): array { |
|
| 72 | + return $this->getApi()->request($this->getApi()->sprintf('/user'), Request::METHOD_PATCH, [ |
|
| 73 | + 'name' => $name, |
|
| 74 | + 'email' => $email, |
|
| 75 | + 'blog' => $blog, |
|
| 76 | + 'company' => $company, |
|
| 77 | + 'location' => $location, |
|
| 78 | + 'hireable' => $hireable, |
|
| 79 | + 'bio' => $bio |
|
| 80 | + ]); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Get all users |
|
| 85 | - * |
|
| 86 | - * @link https://developer.github.com/v3/users/#get-all-users |
|
| 87 | - * |
|
| 88 | - * @param string $since |
|
| 89 | - * |
|
| 90 | - * @return array |
|
| 91 | - * @throws \Exception |
|
| 92 | - */ |
|
| 93 | - public function getAllUsers(string $since = null): array |
|
| 94 | - { |
|
| 95 | - return $this->getApi()->request($this->getApi() |
|
| 96 | - ->sprintf('/users?:args', http_build_query(['since' => $since]))); |
|
| 97 | - } |
|
| 83 | + /** |
|
| 84 | + * Get all users |
|
| 85 | + * |
|
| 86 | + * @link https://developer.github.com/v3/users/#get-all-users |
|
| 87 | + * |
|
| 88 | + * @param string $since |
|
| 89 | + * |
|
| 90 | + * @return array |
|
| 91 | + * @throws \Exception |
|
| 92 | + */ |
|
| 93 | + public function getAllUsers(string $since = null): array |
|
| 94 | + { |
|
| 95 | + return $this->getApi()->request($this->getApi() |
|
| 96 | + ->sprintf('/users?:args', http_build_query(['since' => $since]))); |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -12,85 +12,85 @@ |
||
| 12 | 12 | class Organizations extends AbstractReceiver |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** Available sub-Receiver */ |
|
| 16 | - const MEMBERS = 'Members'; |
|
| 17 | - const TEAMS = 'Teams'; |
|
| 18 | - const HOOKS = 'Hooks'; |
|
| 15 | + /** Available sub-Receiver */ |
|
| 16 | + const MEMBERS = 'Members'; |
|
| 17 | + const TEAMS = 'Teams'; |
|
| 18 | + const HOOKS = 'Hooks'; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * List your organizations |
|
| 22 | - * |
|
| 23 | - * @link https://developer.github.com/v3/orgs/#list-your-organizations |
|
| 24 | - * @return array |
|
| 25 | - * @throws \Exception |
|
| 26 | - */ |
|
| 27 | - public function listOrganizations(): array |
|
| 28 | - { |
|
| 29 | - return $this->getApi()->request($this->getApi()->sprintf('/user/orgs')); |
|
| 30 | - } |
|
| 20 | + /** |
|
| 21 | + * List your organizations |
|
| 22 | + * |
|
| 23 | + * @link https://developer.github.com/v3/orgs/#list-your-organizations |
|
| 24 | + * @return array |
|
| 25 | + * @throws \Exception |
|
| 26 | + */ |
|
| 27 | + public function listOrganizations(): array |
|
| 28 | + { |
|
| 29 | + return $this->getApi()->request($this->getApi()->sprintf('/user/orgs')); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * List user organizations |
|
| 34 | - * |
|
| 35 | - * @link https://developer.github.com/v3/orgs/#list-user-organizations |
|
| 36 | - * |
|
| 37 | - * @param string $username |
|
| 38 | - * |
|
| 39 | - * @return array |
|
| 40 | - * @throws \Exception |
|
| 41 | - */ |
|
| 42 | - public function listUserOrganizations(string $username): array |
|
| 43 | - { |
|
| 44 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/orgs', $username)); |
|
| 45 | - } |
|
| 32 | + /** |
|
| 33 | + * List user organizations |
|
| 34 | + * |
|
| 35 | + * @link https://developer.github.com/v3/orgs/#list-user-organizations |
|
| 36 | + * |
|
| 37 | + * @param string $username |
|
| 38 | + * |
|
| 39 | + * @return array |
|
| 40 | + * @throws \Exception |
|
| 41 | + */ |
|
| 42 | + public function listUserOrganizations(string $username): array |
|
| 43 | + { |
|
| 44 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/orgs', $username)); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get an organization |
|
| 49 | - * |
|
| 50 | - * @link https://developer.github.com/v3/orgs/#get-an-organization |
|
| 51 | - * |
|
| 52 | - * @param string $org |
|
| 53 | - * |
|
| 54 | - * @return array |
|
| 55 | - * @throws \Exception |
|
| 56 | - */ |
|
| 57 | - public function get(string $org): array |
|
| 58 | - { |
|
| 59 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org)); |
|
| 60 | - } |
|
| 47 | + /** |
|
| 48 | + * Get an organization |
|
| 49 | + * |
|
| 50 | + * @link https://developer.github.com/v3/orgs/#get-an-organization |
|
| 51 | + * |
|
| 52 | + * @param string $org |
|
| 53 | + * |
|
| 54 | + * @return array |
|
| 55 | + * @throws \Exception |
|
| 56 | + */ |
|
| 57 | + public function get(string $org): array |
|
| 58 | + { |
|
| 59 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org)); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Edit an organization |
|
| 64 | - * |
|
| 65 | - * @link https://developer.github.com/v3/orgs/#edit-an-organization |
|
| 66 | - * |
|
| 67 | - * @param string $org |
|
| 68 | - * @param string $billingEmail |
|
| 69 | - * @param string $company |
|
| 70 | - * @param string $email |
|
| 71 | - * @param string $location |
|
| 72 | - * @param string $name |
|
| 73 | - * @param string $description |
|
| 74 | - * |
|
| 75 | - * @return array |
|
| 76 | - * @throws \Exception |
|
| 77 | - */ |
|
| 78 | - public function edit( |
|
| 79 | - string $org, |
|
| 80 | - string $billingEmail = null, |
|
| 81 | - string $company = null, |
|
| 82 | - string $email = null, |
|
| 83 | - string $location = null, |
|
| 84 | - string $name = null, |
|
| 85 | - string $description = null |
|
| 86 | - ): array { |
|
| 87 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org), Request::METHOD_PATCH, [ |
|
| 88 | - 'billing_email' => $billingEmail, |
|
| 89 | - 'company' => $company, |
|
| 90 | - 'email' => $email, |
|
| 91 | - 'location' => $location, |
|
| 92 | - 'name' => $name, |
|
| 93 | - 'description' => $description |
|
| 94 | - ]); |
|
| 95 | - } |
|
| 62 | + /** |
|
| 63 | + * Edit an organization |
|
| 64 | + * |
|
| 65 | + * @link https://developer.github.com/v3/orgs/#edit-an-organization |
|
| 66 | + * |
|
| 67 | + * @param string $org |
|
| 68 | + * @param string $billingEmail |
|
| 69 | + * @param string $company |
|
| 70 | + * @param string $email |
|
| 71 | + * @param string $location |
|
| 72 | + * @param string $name |
|
| 73 | + * @param string $description |
|
| 74 | + * |
|
| 75 | + * @return array |
|
| 76 | + * @throws \Exception |
|
| 77 | + */ |
|
| 78 | + public function edit( |
|
| 79 | + string $org, |
|
| 80 | + string $billingEmail = null, |
|
| 81 | + string $company = null, |
|
| 82 | + string $email = null, |
|
| 83 | + string $location = null, |
|
| 84 | + string $name = null, |
|
| 85 | + string $description = null |
|
| 86 | + ): array { |
|
| 87 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org', $org), Request::METHOD_PATCH, [ |
|
| 88 | + 'billing_email' => $billingEmail, |
|
| 89 | + 'company' => $company, |
|
| 90 | + 'email' => $email, |
|
| 91 | + 'location' => $location, |
|
| 92 | + 'name' => $name, |
|
| 93 | + 'description' => $description |
|
| 94 | + ]); |
|
| 95 | + } |
|
| 96 | 96 | } |