readme
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-01-11 14:23:45 +00:00
parent 4c2e559bab
commit 472a6da5a6
4 changed files with 60 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ namespace Nwb\MultiDownloaderClient;
class MultiDownloaderClient
{
private string $apiUrl = 'https://multi-dl.kub.nwb.fr';
private string $url;
private string $apiKey;
private array $files = [];
@@ -19,9 +19,13 @@ class MultiDownloaderClient
$this->apiKey = $apiKey;
if (!empty($options['apiUrl'])) {
$this->apiUrl = $options['apiUrl'];
$url = $options['url'] ?? getenv('MULTI_DOWNLOADER_URL');
if (!$url) {
throw new \InvalidArgumentException('API URL is required');
}
$this->url = $url;
}
public function setFiles(array $files)
@@ -82,7 +86,7 @@ class MultiDownloaderClient
$ch = curl_init();
$options = array_replace($options, [
CURLOPT_URL => $this->apiUrl . '/v2/zip',
CURLOPT_URL => $this->url . '/v2/zip',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($this->buildRequest()),