many small updates
[pharext/pharext.org] / app / Github / Fetch / User.php
diff --git a/app/Github/Fetch/User.php b/app/Github/Fetch/User.php
new file mode 100644 (file)
index 0000000..010fb5e
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace app\Github\Fetch;
+
+use app\Github\Exeption\UserFetchFailed;
+use app\Github\Fetch;
+use http\Client\Request;
+
+class User extends Fetch
+{
+       function getRequest() {
+               $url = $this->url->mod("/user");
+               return new Request("GET", $url, [
+                       "Accept" => "application/vnd.github.v3+json",
+                       "Authorization" => "token " . $this->api->getToken()
+               ]);
+       }
+       
+       function getException($message, $code, $previous = null) {
+               return new UserFetchFailed($message, $code, $previous);
+       }
+       
+       function getCacheKey() {
+               return $this->api->getCacheKey("user");
+       }
+}