3 namespace app\Github\Fetch
;
5 use app\Github\Exception\ReleasesFetchFailed
;
8 use http\Client\Request
;
11 class Releases
extends Fetch
13 function getRequest() {
14 $url = $this->url
->mod([
15 "path" => "/repos/" . $this->args
["repo"] . "/releases",
16 "query" => new QueryString([
17 "page" => $this->getPage(),
20 return new Request("GET", $url, [
21 "Accept" => "application/vnd.github.v3+json",
22 "Authorization" => "token " . $this->api
->getToken(),
26 function getException($message, $code, $previous = null) {
27 return new ReleasesFetchFailed($message, $code, $previous);
30 function getCacheKey() {
31 return $this->api
->getCacheKey(sprintf("releases:%s", $this->args
["repo"]));