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 CreateRelease
extends Call
13 $url = $this->url
->mod("/repos/". $this->args
["repo"] ."/releases");
14 $request = new Request("POST", $url, [
15 "Authorization" => "token ". $this->api
->getToken(),
16 "Accept" => $this->config
->api
->accept
,
17 "Content-Type" => "application/json",
19 $request->getBody()->append(json_encode([
20 "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);