diff --git a/src/Api/Domain.php b/src/Api/Domain.php index ba73fe5..0c24c3b 100644 --- a/src/Api/Domain.php +++ b/src/Api/Domain.php @@ -84,10 +84,11 @@ class Domain extends HttpApi * @param bool $wildcard domain will accept email for subdomains * @param bool $forceDkimAuthority force DKIM authority * @param string[] $ips an array of ips to be assigned to the domain + * @param ?string $pool_id pool id to assign to the domain * * @return CreateResponse|array|ResponseInterface */ - public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null) + public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null, ?string $pool_id = null) { Assert::stringNotEmpty($domain); @@ -125,6 +126,12 @@ class Domain extends HttpApi $params['ips'] = join(',', $ips); } + if (null !== $pool_id) { + Assert::stringNotEmpty($pool_id); + + $params['pool_id'] = $pool_id; + } + $response = $this->httpPost('/v3/domains', $params); return $this->hydrateResponse($response, CreateResponse::class); diff --git a/tests/Api/DomainTest.php b/tests/Api/DomainTest.php index b81c168..4beaa18 100644 --- a/tests/Api/DomainTest.php +++ b/tests/Api/DomainTest.php @@ -103,6 +103,21 @@ JSON $api->create('example.com', 'foo'); } + public function testCreateWithPoolId() + { + $this->setRequestMethod('POST'); + $this->setRequestUri('/v3/domains'); + $this->setRequestBody([ + 'name' => 'example.com', + 'smtp_password' => 'foo', + 'pool_id' => '123', + ]); + $this->setHydrateClass(CreateResponse::class); + + $api = $this->getApiInstance(); + $api->create('example.com', 'foo', null, null, null, null, '123'); + } + public function testCreateWithPasswordSpamAction() { $this->setRequestMethod('POST');