| @@ 45-57 (lines=13) @@ | ||
| 42 | * |
|
| 43 | * @return ValidateResponse|ResponseInterface |
|
| 44 | */ |
|
| 45 | public function validate(string $address, bool $mailboxVerification = false) |
|
| 46 | { |
|
| 47 | Assert::stringNotEmpty($address); |
|
| 48 | ||
| 49 | $params = [ |
|
| 50 | 'address' => $address, |
|
| 51 | 'mailbox_verification' => $mailboxVerification, |
|
| 52 | ]; |
|
| 53 | ||
| 54 | $response = $this->httpGet('/address/private/validate', $params); |
|
| 55 | ||
| 56 | return $this->hydrateResponse($response, ValidateResponse::class); |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Parses a delimiter-separated list of email addresses into two lists: parsed addresses and unparsable portions. |
|
| @@ 83-96 (lines=14) @@ | ||
| 80 | * |
|
| 81 | * @return ParseResponse|ResponseInterface |
|
| 82 | */ |
|
| 83 | public function parse(string $addresses, bool $syntaxOnly = true) |
|
| 84 | { |
|
| 85 | Assert::stringNotEmpty($addresses); |
|
| 86 | Assert::maxLength($addresses, 8000); |
|
| 87 | ||
| 88 | $params = [ |
|
| 89 | 'addresses' => $addresses, |
|
| 90 | 'syntax_only' => $syntaxOnly, |
|
| 91 | ]; |
|
| 92 | ||
| 93 | $response = $this->httpGet('/address/private/parse', $params); |
|
| 94 | ||
| 95 | return $this->hydrateResponse($response, ParseResponse::class); |
|
| 96 | } |
|
| 97 | } |
|
| 98 | ||
| @@ 44-55 (lines=12) @@ | ||
| 41 | * |
|
| 42 | * @throws \Exception |
|
| 43 | */ |
|
| 44 | public function pages(int $limit = 100) |
|
| 45 | { |
|
| 46 | Assert::range($limit, 1, 1000); |
|
| 47 | ||
| 48 | $params = [ |
|
| 49 | 'limit' => $limit, |
|
| 50 | ]; |
|
| 51 | ||
| 52 | $response = $this->httpGet('/v3/lists/pages', $params); |
|
| 53 | ||
| 54 | return $this->hydrateResponse($response, PagesResponse::class); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * Creates a new mailing list on the current domain. |
|
| @@ 42-54 (lines=13) @@ | ||
| 39 | * |
|
| 40 | * @throws Exception Thrown when we don't catch a Client or Server side Exception |
|
| 41 | */ |
|
| 42 | public function validate(string $address, bool $providerLookup = true) |
|
| 43 | { |
|
| 44 | Assert::stringNotEmpty($address); |
|
| 45 | ||
| 46 | $params = [ |
|
| 47 | 'address' => $address, |
|
| 48 | 'provider_lookup' => $providerLookup, |
|
| 49 | ]; |
|
| 50 | ||
| 51 | $response = $this->httpGet('/v4/address/validate', $params); |
|
| 52 | ||
| 53 | return $this->hydrateResponse($response, ValidateResponse::class); |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @param string $listId ID given when the list created |
|