prepare url
[pharext/pharext.org] / app / Github / Create / ReleaseAsset.php
1 <?php
2
3 namespace app\Github\Create;
4
5 use app\Github\Create;
6 use app\Github\Exception\ReleaseAssetCreateFailed;
7 use http\Client\Request;
8
9 class ReleaseAsset extends Create
10 {
11 function getRequest() {
12 $body = new \http\Message\Body(fopen($this->args["asset"], "rb"));
13 $request = new Request("POST", $this->args["url"], [
14 "Accept" => "application/vnd.github.v3+json",
15 "Content-Type" => $this->args["type"],
16 "Authorization" => "token ". $this->api->getToken()
17 ], $body);
18 return $request;
19 }
20
21 function getException($message, $code, $previous = null) {
22 return new ReleaseAssetCreateFailed($message, $code, $previous);
23 }
24 }