mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: get supported tlds by namecheap
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Service\Connector;
|
||||
|
||||
use App\Entity\Domain;
|
||||
use Psr\Cache\CacheItemInterface;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
@@ -14,8 +15,9 @@ class NamecheapConnector extends AbstractProvider
|
||||
|
||||
public const SANDBOX_BASE_URL = 'http://api.sandbox.namecheap.com/xml.response';
|
||||
|
||||
public function __construct(private HttpClientInterface $client, private readonly string $outgoingIp)
|
||||
public function __construct(CacheItemPoolInterface $cacheItemPool, private HttpClientInterface $client, private readonly string $outgoingIp)
|
||||
{
|
||||
parent::__construct($cacheItemPool);
|
||||
}
|
||||
|
||||
public function orderDomain(Domain $domain, $dryRun): void
|
||||
@@ -86,11 +88,19 @@ class NamecheapConnector extends AbstractProvider
|
||||
|
||||
protected function getCachedTldList(): CacheItemInterface
|
||||
{
|
||||
// TODO: Implement getCachedTldList() method.
|
||||
return $this->cacheItemPool->getItem('app.provider.namecheap.supported-tld');
|
||||
}
|
||||
|
||||
protected function getSupportedTldList(): array
|
||||
{
|
||||
// TODO: Implement getSupportedTldList() method.
|
||||
$supported = [];
|
||||
|
||||
$tlds = $this->call('namecheap.domains.gettldlist', [], false)->Tlds->Tld;
|
||||
|
||||
for ($i = 0; $i < $tlds->count(); ++$i) {
|
||||
$supported[] = (string) $tlds[$i]['Name'];
|
||||
}
|
||||
|
||||
return $supported;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user