mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-25 22:36:06 +03:00
Update POST domain/create with optional params (#399)
According to issue #397 the stmp params are optionals in the creation of a domain
This commit is contained in:
parent
fa02dd4fdb
commit
1fd4f222e6
@ -74,6 +74,8 @@ class Domain extends HttpApi
|
|||||||
* See below for spam filtering parameter information.
|
* See below for spam filtering parameter information.
|
||||||
* {@link https://documentation.mailgun.com/user_manual.html#um-spam-filter}.
|
* {@link https://documentation.mailgun.com/user_manual.html#um-spam-filter}.
|
||||||
*
|
*
|
||||||
|
* @see https://documentation.mailgun.com/en/latest/api-domains.html#domains
|
||||||
|
*
|
||||||
* @param string $domain Name of the domain.
|
* @param string $domain Name of the domain.
|
||||||
* @param string $smtpPass Password for SMTP authentication.
|
* @param string $smtpPass Password for SMTP authentication.
|
||||||
* @param string $spamAction `disable` or `tag` - inbound spam filtering.
|
* @param string $spamAction `disable` or `tag` - inbound spam filtering.
|
||||||
@ -81,20 +83,22 @@ class Domain extends HttpApi
|
|||||||
*
|
*
|
||||||
* @return CreateResponse|array|ResponseInterface
|
* @return CreateResponse|array|ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function create($domain, $smtpPass, $spamAction, $wildcard)
|
public function create($domain, $smtpPass = NULL, $spamAction = NULL, $wildcard = NULL)
|
||||||
{
|
{
|
||||||
Assert::stringNotEmpty($domain);
|
Assert::stringNotEmpty($domain);
|
||||||
Assert::stringNotEmpty($smtpPass);
|
|
||||||
|
$params = ['name'] = $domain;
|
||||||
|
|
||||||
|
// If at least smtpPass available, check for the fields spamAction wildcard
|
||||||
|
if(!empty($smtpPass) {
|
||||||
|
|
||||||
// TODO(sean.johnson): Extended spam filter input validation.
|
// TODO(sean.johnson): Extended spam filter input validation.
|
||||||
Assert::stringNotEmpty($spamAction);
|
Assert::stringNotEmpty($spamAction);
|
||||||
Assert::boolean($wildcard);
|
Assert::boolean($wildcard);
|
||||||
|
|
||||||
$params = [
|
$params['smtp_password'] = $smtpPass;
|
||||||
'name' => $domain,
|
$params['spam_action'] = $spamAction;
|
||||||
'smtp_password' => $smtpPass,
|
}
|
||||||
'spam_action' => $spamAction,
|
|
||||||
'wildcard' => $wildcard,
|
|
||||||
];
|
|
||||||
|
|
||||||
$response = $this->httpPost('/v3/domains', $params);
|
$response = $this->httpPost('/v3/domains', $params);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user