| @@ 86-105 (lines=20) @@ | ||
| 83 | * |
|
| 84 | * @return CreateResponse|array|ResponseInterface |
|
| 85 | */ |
|
| 86 | public function create($domain, $smtpPass = null, $spamAction = null, $wildcard = null) |
|
| 87 | { |
|
| 88 | Assert::stringNotEmpty($domain); |
|
| 89 | ||
| 90 | $params['name'] = $domain; |
|
| 91 | ||
| 92 | // If at least smtpPass available, check for the fields spamAction wildcard |
|
| 93 | if (!empty($smtpPass)) { |
|
| 94 | // TODO(sean.johnson): Extended spam filter input validation. |
|
| 95 | Assert::stringNotEmpty($spamAction); |
|
| 96 | Assert::boolean($wildcard); |
|
| 97 | ||
| 98 | $params['smtp_password'] = $smtpPass; |
|
| 99 | $params['spam_action'] = $spamAction; |
|
| 100 | } |
|
| 101 | ||
| 102 | $response = $this->httpPost('/v3/domains', $params); |
|
| 103 | ||
| 104 | return $this->hydrateResponse($response, CreateResponse::class); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * Removes a domain from the account. |
|
| @@ 71-85 (lines=15) @@ | ||
| 68 | * |
|
| 69 | * @return CreateResponse |
|
| 70 | */ |
|
| 71 | public function create($domain, $address, $createdAt = null) |
|
| 72 | { |
|
| 73 | Assert::stringNotEmpty($domain); |
|
| 74 | Assert::stringNotEmpty($address); |
|
| 75 | Assert::stringNotEmpty($createdAt); |
|
| 76 | ||
| 77 | $params['address'] = $address; |
|
| 78 | if (null !== $createdAt) { |
|
| 79 | $params['created_at'] = $createdAt; |
|
| 80 | } |
|
| 81 | ||
| 82 | $response = $this->httpPost(sprintf('/v3/%s/complaints', $domain), $params); |
|
| 83 | ||
| 84 | return $this->hydrateResponse($response, CreateResponse::class); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * @param string $domain Domain to delete complaint for |
|