| @@ 169-179 (lines=11) @@ | ||
| 166 | * |
|
| 167 | * @return bool |
|
| 168 | */ |
|
| 169 | public function deleteThreadSubscription(int $id): bool |
|
| 170 | { |
|
| 171 | $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription', (string)$id), |
|
| 172 | Request::METHOD_DELETE); |
|
| 173 | ||
| 174 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 175 | return true; |
|
| 176 | } |
|
| 177 | ||
| 178 | return false; |
|
| 179 | } |
|
| 180 | } |
|
| @@ 167-176 (lines=10) @@ | ||
| 164 | * |
|
| 165 | * @return bool |
|
| 166 | */ |
|
| 167 | public function starGist(string $id): bool |
|
| 168 | { |
|
| 169 | $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); |
|
| 170 | ||
| 171 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 172 | return true; |
|
| 173 | } |
|
| 174 | ||
| 175 | return false; |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * Unstar a gist |
|
| @@ 187-196 (lines=10) @@ | ||
| 184 | * |
|
| 185 | * @return bool |
|
| 186 | */ |
|
| 187 | public function unStarGist(string $id): bool |
|
| 188 | { |
|
| 189 | $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_DELETE); |
|
| 190 | ||
| 191 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 192 | return true; |
|
| 193 | } |
|
| 194 | ||
| 195 | return false; |
|
| 196 | } |
|
| 197 | ||
| 198 | /** |
|
| 199 | * Check if a gist is starred |
|
| @@ 207-216 (lines=10) @@ | ||
| 204 | * |
|
| 205 | * @return bool |
|
| 206 | */ |
|
| 207 | public function checkGistIsStarred(string $id): bool |
|
| 208 | { |
|
| 209 | $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); |
|
| 210 | ||
| 211 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 212 | return true; |
|
| 213 | } |
|
| 214 | ||
| 215 | return false; |
|
| 216 | } |
|
| 217 | ||
| 218 | /** |
|
| 219 | * Fork a gist |
|
| @@ 255-264 (lines=10) @@ | ||
| 252 | * |
|
| 253 | * @return bool |
|
| 254 | */ |
|
| 255 | public function deleteGist(string $id): bool |
|
| 256 | { |
|
| 257 | $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_DELETE); |
|
| 258 | ||
| 259 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 260 | return true; |
|
| 261 | } |
|
| 262 | ||
| 263 | return false; |
|
| 264 | } |
|
| 265 | } |
|
| @@ 107-117 (lines=11) @@ | ||
| 104 | * @return bool |
|
| 105 | * @throws \Exception |
|
| 106 | */ |
|
| 107 | public function pingHook(string $org, int $id): bool |
|
| 108 | { |
|
| 109 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id/pings', $org, (string)$id), |
|
| 110 | Request::METHOD_POST); |
|
| 111 | ||
| 112 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 113 | return true; |
|
| 114 | } |
|
| 115 | ||
| 116 | return false; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Delete a hook |
|
| @@ 130-140 (lines=11) @@ | ||
| 127 | * @return bool |
|
| 128 | * @throws \Exception |
|
| 129 | */ |
|
| 130 | public function deleteHook(string $org, int $id): bool |
|
| 131 | { |
|
| 132 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
| 133 | Request::METHOD_DELETE); |
|
| 134 | ||
| 135 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 136 | return true; |
|
| 137 | } |
|
| 138 | ||
| 139 | return false; |
|
| 140 | } |
|
| 141 | } |
|
| @@ 45-54 (lines=10) @@ | ||
| 42 | * @return bool |
|
| 43 | * @throws \Exception |
|
| 44 | */ |
|
| 45 | public function checkMembership(string $org, string $username): bool |
|
| 46 | { |
|
| 47 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username)); |
|
| 48 | ||
| 49 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 50 | return true; |
|
| 51 | } |
|
| 52 | ||
| 53 | return false; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Remove a member |
|
| @@ 67-77 (lines=11) @@ | ||
| 64 | * @return bool |
|
| 65 | * @throws \Exception |
|
| 66 | */ |
|
| 67 | public function removeMember(string $org, string $username): bool |
|
| 68 | { |
|
| 69 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username), |
|
| 70 | Request::METHOD_DELETE); |
|
| 71 | ||
| 72 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 73 | return true; |
|
| 74 | } |
|
| 75 | ||
| 76 | return false; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Public members list |
|
| @@ 105-114 (lines=10) @@ | ||
| 102 | * @return bool |
|
| 103 | * @throws \Exception |
|
| 104 | */ |
|
| 105 | public function checkPublicMembership(string $org, string $username): bool |
|
| 106 | { |
|
| 107 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username)); |
|
| 108 | ||
| 109 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 110 | return true; |
|
| 111 | } |
|
| 112 | ||
| 113 | return false; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Publicize a user’s membership |
|
| @@ 127-137 (lines=11) @@ | ||
| 124 | * @return bool |
|
| 125 | * @throws \Exception |
|
| 126 | */ |
|
| 127 | public function publicizeUsersMembership(string $org, string $username): bool |
|
| 128 | { |
|
| 129 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 130 | Request::METHOD_PUT); |
|
| 131 | ||
| 132 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 133 | return true; |
|
| 134 | } |
|
| 135 | ||
| 136 | return false; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Conceal a user’s membership |
|
| @@ 150-160 (lines=11) @@ | ||
| 147 | * @return bool |
|
| 148 | * @throws \Exception |
|
| 149 | */ |
|
| 150 | public function concealUsersMembership(string $org, string $username): bool |
|
| 151 | { |
|
| 152 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
| 153 | Request::METHOD_DELETE); |
|
| 154 | ||
| 155 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 156 | return true; |
|
| 157 | } |
|
| 158 | ||
| 159 | return false; |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * Get organization membership |
|
| @@ 212-224 (lines=13) @@ | ||
| 209 | * @return bool |
|
| 210 | * @throws \Exception |
|
| 211 | */ |
|
| 212 | public function removeOrganizationMembership(string $org, string $username): bool |
|
| 213 | { |
|
| 214 | $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
| 215 | ||
| 216 | $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), |
|
| 217 | Request::METHOD_DELETE); |
|
| 218 | ||
| 219 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 220 | return true; |
|
| 221 | } |
|
| 222 | ||
| 223 | return false; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * List your organization memberships |
|
| @@ 103-112 (lines=10) @@ | ||
| 100 | * @return bool |
|
| 101 | * @throws \Exception |
|
| 102 | */ |
|
| 103 | public function deleteTeam(int $id): bool |
|
| 104 | { |
|
| 105 | $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_DELETE); |
|
| 106 | ||
| 107 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 108 | return true; |
|
| 109 | } |
|
| 110 | ||
| 111 | return false; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * List team members |
|
| @@ 175-185 (lines=11) @@ | ||
| 172 | * @return bool |
|
| 173 | * @throws \Exception |
|
| 174 | */ |
|
| 175 | public function removeTeamMembership(int $id, string $username): bool |
|
| 176 | { |
|
| 177 | $this->getApi()->request($this->getApi()->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
| 178 | Request::METHOD_DELETE); |
|
| 179 | ||
| 180 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 181 | return true; |
|
| 182 | } |
|
| 183 | ||
| 184 | return false; |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * List team repos |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | * @return bool |
|
| 50 | * @throws \Exception |
|
| 51 | */ |
|
| 52 | public function deleteEmailAddress(array $addresses = []): bool |
|
| 53 | { |
|
| 54 | $this->getApi()->request($this->getApi()->sprintf('/user/emails'), Request::METHOD_DELETE, $addresses); |
|
| 55 | ||
| 56 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 57 | return true; |
|
| 58 | } |
|
| 59 | ||
| 60 | return false; |
|
| 61 | } |
|
| 62 | } |
|
| @@ 65-74 (lines=10) @@ | ||
| 62 | * @return bool |
|
| 63 | * @throws \Exception |
|
| 64 | */ |
|
| 65 | public function checkFollowingUser(string $username): bool |
|
| 66 | { |
|
| 67 | $this->getApi()->request($this->getApi()->sprintf('/user/following/:username', $username)); |
|
| 68 | ||
| 69 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 70 | return true; |
|
| 71 | } |
|
| 72 | ||
| 73 | return false; |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Check if one user follows another |
|
| @@ 87-97 (lines=11) @@ | ||
| 84 | * @return bool |
|
| 85 | * @throws \Exception |
|
| 86 | */ |
|
| 87 | public function checkUserFollowsAnother(string $username, string $targetUser): bool |
|
| 88 | { |
|
| 89 | $this->getApi()->request($this->getApi() |
|
| 90 | ->sprintf('/users/:username/following/:target_user', $username, $targetUser)); |
|
| 91 | ||
| 92 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 93 | return true; |
|
| 94 | } |
|
| 95 | ||
| 96 | return false; |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Follow a user |
|
| @@ 109-118 (lines=10) @@ | ||
| 106 | * @return bool |
|
| 107 | * @throws \Exception |
|
| 108 | */ |
|
| 109 | public function followUser(string $username): bool |
|
| 110 | { |
|
| 111 | $this->getApi()->request($this->getApi()->sprintf('/user/following/:username', $username), Request::METHOD_PUT); |
|
| 112 | ||
| 113 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 114 | return true; |
|
| 115 | } |
|
| 116 | ||
| 117 | return false; |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * Unfollow a user |
|
| @@ 130-140 (lines=11) @@ | ||
| 127 | * @return bool |
|
| 128 | * @throws \Exception |
|
| 129 | */ |
|
| 130 | public function unfollowUser(string $username): bool |
|
| 131 | { |
|
| 132 | $this->getApi()->request($this->getApi()->sprintf('/user/following/:username', $username), |
|
| 133 | Request::METHOD_DELETE); |
|
| 134 | ||
| 135 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 136 | return true; |
|
| 137 | } |
|
| 138 | ||
| 139 | return false; |
|
| 140 | } |
|
| 141 | } |
|
| @@ 91-101 (lines=11) @@ | ||
| 88 | * |
|
| 89 | * @return bool |
|
| 90 | */ |
|
| 91 | public function deleteComment(string $gistId, int $id): bool |
|
| 92 | { |
|
| 93 | $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
| 94 | Request::METHOD_DELETE); |
|
| 95 | ||
| 96 | if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 97 | return true; |
|
| 98 | } |
|
| 99 | ||
| 100 | return false; |
|
| 101 | } |
|
| 102 | } |
|