prepare url
[pharext/pharext.org] / app / Github / Fetch / Hooks.php
1 <?php
2
3 namespace app\Github\Fetch;
4
5 use app\Github\Exception\HooksFetchFailed;
6 use app\Github\Fetch;
7
8 use http\Client\Request;
9
10 class Hooks extends Fetch
11 {
12 function getRequest() {
13 $url = $this->url->mod([
14 "path" => "/repos/" . $this->args["repo"] . "/hooks",
15 ]);
16 return new Request("GET", $url, [
17 "Accept" => "application/vnd.github.v3+json",
18 "Authorization" => "token " . $this->api->getToken(),
19 ]);
20 }
21
22 function getException($message, $code, $previous = null) {
23 return new HooksFetchFailed($message, $code, $previous);
24 }
25
26 function getCacheKey() {
27 return $this->api->getCacheKey(sprintf("hooks:%s", $this->args["repo"]));
28 }
29 }