Add robo command for downloading WooCommerce

[MAILPOET-3482]
This commit is contained in:
Rostislav Wolny
2021-04-14 16:37:42 +02:00
committed by Veljko V
parent 17c0e26b02
commit ff806859cb
2 changed files with 27 additions and 12 deletions

View File

@@ -10,14 +10,17 @@ class GithubClient {
private const API_BASE_URI = 'https://api.github.com/repos';
public function __construct($username, $token, $repo) {
$this->httpClient = new Client([
'auth' => [$username, $token],
public function __construct($repo, $username = null, $token = null) {
$config = [
'headers' => [
'Accept' => 'application/vnd.github.v3+json',
],
'base_uri' => self::API_BASE_URI . "/$repo/",
]);
];
if ($username && $token) {
$config['auth'] = [$username, $token];
}
$this->httpClient = new Client($config);
}
public function downloadReleaseZip($zip, $downloadDir, $tag = null) {