X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI%2FHooks%2FDeleteHook.php;h=3635f6e65ae274f0a9fcab727483ef0852f160a3;hb=5664731d8825ce074a5232190f2f8ec61d921782;hp=311e64dabbff05f45d71fb4eabf3533daf8d120a;hpb=07b87ac26f62bc3c069bb16983fe7500272e19b4;p=pharext%2Fpharext.org diff --git a/app/Github/API/Hooks/DeleteHook.php b/app/Github/API/Hooks/DeleteHook.php index 311e64d..3635f6e 100644 --- a/app/Github/API/Hooks/DeleteHook.php +++ b/app/Github/API/Hooks/DeleteHook.php @@ -5,21 +5,22 @@ namespace app\Github\API\Hooks; use app\Github\API\Call; use app\Github\Exception\RequestException; use http\Client\Request; +use http\Client\Response; class DeleteHook extends Call { - function enqueue(callable $callback) { + function request() { $url = $this->url->mod(uri_template("./repos/{+repo}/hooks{/id}", $this->args)); $request = new Request("DELETE", $url, [ "Authorization" => "token " . $this->api->getToken(), "Accept" => $this->config->api->accept, ]); - $this->api->getClient()->enqueue($request, function($response) use($callback) { - if ($response->getResponseCode() >= 400) { - throw new RequestException($response); - } - $callback($json); - return true; - }); + return $request; + } + + function response(Response $response) { + if ($response->getResponseCode() >= 400) { + throw new RequestException($response); + } } }