| @@ 108-116 (lines=9) @@ | ||
| 105 | * |
|
| 106 | * @since 1.0 |
|
| 107 | */ |
|
| 108 | public function getOrg($org) |
|
| 109 | { |
|
| 110 | // Build the request path. |
|
| 111 | $path = '/orgs/' . $org . '/events'; |
|
| 112 | ||
| 113 | return $this->processResponse( |
|
| 114 | $this->client->get($this->fetchUrl($path)) |
|
| 115 | ); |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * List events that a user has received. |
|
| @@ 131-139 (lines=9) @@ | ||
| 128 | * |
|
| 129 | * @since 1.0 |
|
| 130 | */ |
|
| 131 | public function getUser($user) |
|
| 132 | { |
|
| 133 | // Build the request path. |
|
| 134 | $path = '/users/' . $user . '/received_events'; |
|
| 135 | ||
| 136 | return $this->processResponse( |
|
| 137 | $this->client->get($this->fetchUrl($path)) |
|
| 138 | ); |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * List public events that a user has received. |
|
| @@ 150-158 (lines=9) @@ | ||
| 147 | * |
|
| 148 | * @since 1.0 |
|
| 149 | */ |
|
| 150 | public function getUserPublic($user) |
|
| 151 | { |
|
| 152 | // Build the request path. |
|
| 153 | $path = '/users/' . $user . '/received_events/public'; |
|
| 154 | ||
| 155 | return $this->processResponse( |
|
| 156 | $this->client->get($this->fetchUrl($path)) |
|
| 157 | ); |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * List events performed by a user. |
|
| @@ 172-180 (lines=9) @@ | ||
| 169 | * |
|
| 170 | * @since 1.0 |
|
| 171 | */ |
|
| 172 | public function getByUser($user) |
|
| 173 | { |
|
| 174 | // Build the request path. |
|
| 175 | $path = '/users/' . $user . '/events'; |
|
| 176 | ||
| 177 | return $this->processResponse( |
|
| 178 | $this->client->get($this->fetchUrl($path)) |
|
| 179 | ); |
|
| 180 | } |
|
| 181 | ||
| 182 | /** |
|
| 183 | * List public events performed by a user. |
|
| @@ 191-199 (lines=9) @@ | ||
| 188 | * |
|
| 189 | * @since 1.0 |
|
| 190 | */ |
|
| 191 | public function getByUserPublic($user) |
|
| 192 | { |
|
| 193 | // Build the request path. |
|
| 194 | $path = '/users/' . $user . '/events/public'; |
|
| 195 | ||
| 196 | return $this->processResponse( |
|
| 197 | $this->client->get($this->fetchUrl($path)) |
|
| 198 | ); |
|
| 199 | } |
|
| 200 | ||
| 201 | /** |
|
| 202 | * List events for an organization. |
|
| @@ 247-255 (lines=9) @@ | ||
| 244 | * |
|
| 245 | * @since 1.0 |
|
| 246 | */ |
|
| 247 | public function getThreadSubscription($id) |
|
| 248 | { |
|
| 249 | // Build the request path. |
|
| 250 | $path = '/notifications/threads/' . $id . '/subscription'; |
|
| 251 | ||
| 252 | return $this->processResponse( |
|
| 253 | $this->client->get($this->fetchUrl($path)) |
|
| 254 | ); |
|
| 255 | } |
|
| 256 | ||
| 257 | /** |
|
| 258 | * Set a Thread Subscription. |
|
| @@ 296-305 (lines=10) @@ | ||
| 293 | * |
|
| 294 | * @since 1.0 |
|
| 295 | */ |
|
| 296 | public function deleteThreadSubscription($id) |
|
| 297 | { |
|
| 298 | // Build the request path. |
|
| 299 | $path = '/notifications/threads/' . $id . '/subscription'; |
|
| 300 | ||
| 301 | return $this->processResponse( |
|
| 302 | $this->client->delete($this->fetchUrl($path)), |
|
| 303 | 204 |
|
| 304 | ); |
|
| 305 | } |
|
| 306 | } |
|
| 307 | ||
| @@ 53-63 (lines=11) @@ | ||
| 50 | * |
|
| 51 | * @since 1.0 |
|
| 52 | */ |
|
| 53 | public function getRepositories($user = '') |
|
| 54 | { |
|
| 55 | // Build the request path. |
|
| 56 | $path = ($user) |
|
| 57 | ? '/users/' . $user . '/subscriptions' |
|
| 58 | : '/user/subscriptions'; |
|
| 59 | ||
| 60 | return $this->processResponse( |
|
| 61 | $this->client->get($this->fetchUrl($path)) |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Get a Repository Subscription. |
|
| @@ 37-48 (lines=12) @@ | ||
| 34 | * |
|
| 35 | * @since 1.0 |
|
| 36 | */ |
|
| 37 | public function getList($user = '') |
|
| 38 | { |
|
| 39 | // Build the request path. |
|
| 40 | $path = ($user) |
|
| 41 | ? '/users/' . $user . '/orgs' |
|
| 42 | : '/user/orgs'; |
|
| 43 | ||
| 44 | // Send the request. |
|
| 45 | return $this->processResponse( |
|
| 46 | $this->client->get($this->fetchUrl($path)) |
|
| 47 | ); |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Get an organization. |
|
| @@ 54-62 (lines=9) @@ | ||
| 51 | * |
|
| 52 | * @since 1.4.0 |
|
| 53 | */ |
|
| 54 | public function get($org, $id) |
|
| 55 | { |
|
| 56 | // Build the request path. |
|
| 57 | $path = "/orgs/$org/hooks/" . (int) $id; |
|
| 58 | ||
| 59 | return $this->processResponse( |
|
| 60 | $this->client->get($this->fetchUrl($path)) |
|
| 61 | ); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Create a hook. |
|
| @@ 218-227 (lines=10) @@ | ||
| 215 | * @since 1.4.0 |
|
| 216 | * @throws \DomainException |
|
| 217 | */ |
|
| 218 | public function ping($org, $id) |
|
| 219 | { |
|
| 220 | // Build the request path. |
|
| 221 | $path = "/orgs/$org/hooks/$id/pings"; |
|
| 222 | ||
| 223 | return $this->processResponse( |
|
| 224 | $this->client->post($this->fetchUrl($path), json_encode('')), |
|
| 225 | 204 |
|
| 226 | ); |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * Delete a hook. |
|
| @@ 148-156 (lines=9) @@ | ||
| 145 | * |
|
| 146 | * @return object |
|
| 147 | */ |
|
| 148 | public function getListPublic($org) |
|
| 149 | { |
|
| 150 | // Build the request path. |
|
| 151 | $path = '/orgs/' . $org . '/public_members'; |
|
| 152 | ||
| 153 | return $this->processResponse( |
|
| 154 | $this->client->get($this->fetchUrl($path)) |
|
| 155 | ); |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|
| 159 | * Check public membership. |
|
| @@ 34-42 (lines=9) @@ | ||
| 31 | * |
|
| 32 | * @since 1.0 |
|
| 33 | */ |
|
| 34 | public function getList($org) |
|
| 35 | { |
|
| 36 | // Build the request path. |
|
| 37 | $path = '/orgs/' . $org . '/teams'; |
|
| 38 | ||
| 39 | return $this->processResponse( |
|
| 40 | $this->client->get($this->fetchUrl($path)) |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * Get team. |
|
| @@ 185-193 (lines=9) @@ | ||
| 182 | * |
|
| 183 | * @since 1.0 |
|
| 184 | */ |
|
| 185 | public function getListMembers($id) |
|
| 186 | { |
|
| 187 | // Build the request path. |
|
| 188 | $path = '/teams/' . $id . '/members'; |
|
| 189 | ||
| 190 | return $this->processResponse( |
|
| 191 | $this->client->get($this->fetchUrl($path)) |
|
| 192 | ); |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * Get team member. |
|
| @@ 387-395 (lines=9) @@ | ||
| 384 | * |
|
| 385 | * @since 1.0 |
|
| 386 | */ |
|
| 387 | public function getListRepos($id) |
|
| 388 | { |
|
| 389 | // Build the request path. |
|
| 390 | $path = '/teams/' . $id . '/repos'; |
|
| 391 | ||
| 392 | return $this->processResponse( |
|
| 393 | $this->client->get($this->fetchUrl($path)) |
|
| 394 | ); |
|
| 395 | } |
|
| 396 | ||
| 397 | /** |
|
| 398 | * Check if a team manages a repository. |
|
| @@ 173-183 (lines=11) @@ | ||
| 170 | * @since 1.0 |
|
| 171 | * @throws \RuntimeException |
|
| 172 | */ |
|
| 173 | public function getList($id = 0) |
|
| 174 | { |
|
| 175 | // Build the request path. |
|
| 176 | $path = '/repositories'; |
|
| 177 | $path .= ($id) ? '?since=' . (int) $id : ''; |
|
| 178 | ||
| 179 | // Send the request. |
|
| 180 | return $this->processResponse( |
|
| 181 | $this->client->get($this->fetchUrl($path)) |
|
| 182 | ); |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Create. |
|
| @@ 51-60 (lines=10) @@ | ||
| 48 | * |
|
| 49 | * @since 1.0 |
|
| 50 | */ |
|
| 51 | public function add($email) |
|
| 52 | { |
|
| 53 | // Build the request path. |
|
| 54 | $path = '/user/emails'; |
|
| 55 | ||
| 56 | return $this->processResponse( |
|
| 57 | $this->client->post($this->fetchUrl($path), json_encode($email)), |
|
| 58 | 201 |
|
| 59 | ); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Delete email address(es). |
|
| @@ 71-82 (lines=12) @@ | ||
| 68 | * |
|
| 69 | * @since 1.0 |
|
| 70 | */ |
|
| 71 | public function delete($email) |
|
| 72 | { |
|
| 73 | // Build the request path. |
|
| 74 | $path = '/user/emails'; |
|
| 75 | ||
| 76 | $this->client->setOption('body', json_encode($email)); |
|
| 77 | ||
| 78 | return $this->processResponse( |
|
| 79 | $this->client->delete($this->fetchUrl($path)), |
|
| 80 | 204 |
|
| 81 | ); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 31-41 (lines=11) @@ | ||
| 28 | * |
|
| 29 | * @since 1.0 |
|
| 30 | */ |
|
| 31 | public function getList($user = '') |
|
| 32 | { |
|
| 33 | // Build the request path. |
|
| 34 | $path = ($user) |
|
| 35 | ? '/users/' . $user . '/followers' |
|
| 36 | : '/user/followers'; |
|
| 37 | ||
| 38 | return $this->processResponse( |
|
| 39 | $this->client->get($this->fetchUrl($path)) |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * List users followed by another user. |
|
| @@ 52-62 (lines=11) @@ | ||
| 49 | * |
|
| 50 | * @since 1.0 |
|
| 51 | */ |
|
| 52 | public function getListFollowedBy($user = '') |
|
| 53 | { |
|
| 54 | // Build the request path. |
|
| 55 | $path = ($user) |
|
| 56 | ? '/users/' . $user . '/following' |
|
| 57 | : '/user/following'; |
|
| 58 | ||
| 59 | return $this->processResponse( |
|
| 60 | $this->client->get($this->fetchUrl($path)) |
|
| 61 | ); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Check if you are following a user. |
|
| @@ 147-156 (lines=10) @@ | ||
| 144 | * |
|
| 145 | * @since 1.0 |
|
| 146 | */ |
|
| 147 | public function follow($user) |
|
| 148 | { |
|
| 149 | // Build the request path. |
|
| 150 | $path = '/user/following/' . $user; |
|
| 151 | ||
| 152 | return $this->processResponse( |
|
| 153 | $this->client->put($this->fetchUrl($path), ''), |
|
| 154 | 204 |
|
| 155 | ); |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|
| 159 | * Unfollow a user. |
|
| @@ 33-41 (lines=9) @@ | ||
| 30 | * |
|
| 31 | * @since 1.0 |
|
| 32 | */ |
|
| 33 | public function getListUser($user) |
|
| 34 | { |
|
| 35 | // Build the request path. |
|
| 36 | $path = '/users/' . $user . '/keys'; |
|
| 37 | ||
| 38 | return $this->processResponse( |
|
| 39 | $this->client->get($this->fetchUrl($path)) |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * List your public keys. |
|
| @@ 144-153 (lines=10) @@ | ||
| 141 | * |
|
| 142 | * @since 1.0 |
|
| 143 | */ |
|
| 144 | public function delete($id) |
|
| 145 | { |
|
| 146 | // Build the request path. |
|
| 147 | $path = '/users/keys/' . (int) $id; |
|
| 148 | ||
| 149 | return $this->processResponse( |
|
| 150 | $this->client->delete($this->fetchUrl($path)), |
|
| 151 | 204 |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | } |
|
| 155 | ||