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