3 namespace app\Github\API\Repos
;
5 use app\Github\API\Call
;
6 use app\Github\Exception\RequestException
;
8 use http\Client\Request
;
9 use http\Client\Response
;
11 class ListRepos
extends Call
14 $url = $this->url
->mod(uri_template("./user/repos{?page,per_page}", $this->args
));
15 $request = new Request("GET", $url, [
16 "Authorization" => "token ". $this->api
->getToken(),
17 "Accept" => $this->config
->api
->accept
,
22 function response(Response
$response) {
23 if ($response->getResponseCode() >= 400 ||
null === ($json = json_decode($response->getBody()))) {
24 throw new RequestException($response);
26 $links = new Links($response->getHeader("Link"));
27 $result = [$json, $links];
28 $this->saveToCache($result);