3 namespace app\Github\API\Releases
;
5 use app\Github\API\Call
;
6 use app\Github\Exception\RequestException
;
7 use http\Client\Request
;
8 use http\Client\Response
;
10 class PublishRelease
extends Call
13 $url = $this->url
->mod(uri_template("./repos/{+repo}/releases{/id}", $this->args
));
14 $request = new Request("PATCH", $url, [
15 "Authorization" => "token ". $this->api
->getToken(),
16 "Accept" => $this->config
->api
->accept
,
17 "Content-Type" => "application/json",
19 $request->getBody()->append(json_encode([
21 "tag_name" => $this->args
["tag"],
26 function response(Response
$response) {
27 if ($response->getResponseCode() >= 400 ||
null === ($json = json_decode($response->getBody()))) {
28 throw new RequestException($response);