3 namespace app\Github\Create
;
6 use app\Github\Exception\ReleaseAssetCreateFailed
;
7 use http\Client\Request
;
9 class ReleaseAsset
extends Create
11 function getRequest() {
12 // FIXME: use uri_template extension
13 $url = str_replace("{?name}", "?name=".urlencode(basename($this->args
["asset"])), $this->args
["url"]);
14 $body = new \http\Message\
Body(fopen($this->args
["asset"], "rb"));
15 $request = new Request("POST", $url, [
16 "Accept" => "application/vnd.github.v3+json",
17 "Content-Type" => $this->args
["type"],
18 "Authorization" => "token ". $this->api
->getToken()
23 function getException($message, $code, $previous = null) {
24 return new ReleaseAssetCreateFailed($message, $code, $previous);