X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI%2FHooks%2FDeleteHook.php;h=3635f6e65ae274f0a9fcab727483ef0852f160a3;hb=ee3977104c9ea0984c76f75f965c528bc4b3b64e;hp=a94f2855c086bfc7d28ec92629c03db85478beb6;hpb=2198c781a021d85ee845f2f4b2f5c322f73e6bd5;p=pharext%2Fpharext.org diff --git a/app/Github/API/Hooks/DeleteHook.php b/app/Github/API/Hooks/DeleteHook.php index a94f285..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(); - return true; - }); + return $request; + } + + function response(Response $response) { + if ($response->getResponseCode() >= 400) { + throw new RequestException($response); + } } }