3 namespace app\Github\Fetch
;
5 use app\Github\Exception\HooksFetchFailed
;
8 use http\Client\Request
;
10 class Hooks
extends Fetch
12 function getRequest() {
13 $url = $this->url
->mod([
14 "path" => "/repos/" . $this->args
["repo"] . "/hooks",
16 return new Request("GET", $url, [
17 "Accept" => "application/vnd.github.v3+json",
18 "Authorization" => "token " . $this->api
->getToken(),
22 function getException($message, $code, $previous = null) {
23 return new HooksFetchFailed($message, $code, $previous);
26 function getCacheKey() {
27 return $this->api
->getCacheKey(sprintf("hooks:%s", $this->args
["repo"]));