webhook create&delete
[pharext/pharext.org] / app / Github / Delete / Webhook.php
1 <?php
2
3 namespace app\Github\Delete;
4
5 use app\Github\Delete;
6 use app\Github\Exception\WebhookDeleteFailed;
7 use http\Client\Request;
8
9 class Webhook extends Delete
10 {
11 function getRequest() {
12 $url = $this->url->mod("./repos/". $this->args["repo"] ."/hooks/". $this->args["id"]);
13 $request = new Request("DELETE", $url, [
14 "Accept" => "application/vnd.github.v3+json",
15 "Authorization" => "token " . $this->api->getToken(),
16 ]);
17 return $request;
18 }
19
20 function getException($message, $code, $previous = null) {
21 return new WebhookDeleteFailed($message, $code, $previous);
22 }
23 }