mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-18 05:43:15 +03:00
Allow assigning a domain to a list of ips during creation
This commit is contained in:
parent
ff8c9c31b7
commit
086afb49b7
@ -74,15 +74,16 @@ class Domain extends HttpApi
|
||||
*
|
||||
* @see https://documentation.mailgun.com/en/latest/api-domains.html#domains
|
||||
*
|
||||
* @param string $domain name of the domain
|
||||
* @param string $smtpPass password for SMTP authentication
|
||||
* @param string $spamAction `disable` or `tag` - inbound spam filtering
|
||||
* @param bool $wildcard domain will accept email for subdomains
|
||||
* @param bool $forceDkimAuthority force DKIM authority
|
||||
* @param string $domain name of the domain
|
||||
* @param string $smtpPass password for SMTP authentication
|
||||
* @param string $spamAction `disable` or `tag` - inbound spam filtering
|
||||
* @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
|
||||
*
|
||||
* @return CreateResponse|array|ResponseInterface
|
||||
*/
|
||||
public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null)
|
||||
public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null)
|
||||
{
|
||||
Assert::stringNotEmpty($domain);
|
||||
|
||||
@ -113,6 +114,12 @@ class Domain extends HttpApi
|
||||
$params['force_dkim_authority'] = $forceDkimAuthority ? 'true' : 'false';
|
||||
}
|
||||
|
||||
if (null !== $ips) {
|
||||
Assert::isList($ips);
|
||||
|
||||
$params['ips'] = join(',', $ips);
|
||||
}
|
||||
|
||||
$response = $this->httpPost('/v3/domains', $params);
|
||||
|
||||
return $this->hydrateResponse($response, CreateResponse::class);
|
||||
|
@ -241,4 +241,19 @@ JSON
|
||||
$api = $this->getApiInstance();
|
||||
$api->verify('example.com');
|
||||
}
|
||||
|
||||
public function testCreateWithIps()
|
||||
{
|
||||
$this->setRequestMethod('POST');
|
||||
$this->setRequestUri('/v3/domains');
|
||||
$this->setRequestBody([
|
||||
'name' => 'example.com',
|
||||
'smtp_password' => 'foo',
|
||||
'ips' => "127.0.0.1,127.0.0.2",
|
||||
]);
|
||||
$this->setHydrateClass(CreateResponse::class);
|
||||
|
||||
$api = $this->getApiInstance();
|
||||
$api->create('example.com', 'foo', null, null, null, ["127.0.0.1", "127.0.0.2"]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user