| @@ 73-87 (lines=15) @@ | ||
| 70 | * |
|
| 71 | * @return CreateResponse |
|
| 72 | */ |
|
| 73 | public function create(string $domain, string $address, string $createdAt = null) |
|
| 74 | { |
|
| 75 | Assert::stringNotEmpty($domain); |
|
| 76 | Assert::stringNotEmpty($address); |
|
| 77 | ||
| 78 | $params['address'] = $address; |
|
| 79 | if (null !== $createdAt) { |
|
| 80 | Assert::stringNotEmpty($createdAt); |
|
| 81 | $params['created_at'] = $createdAt; |
|
| 82 | } |
|
| 83 | ||
| 84 | $response = $this->httpPost(sprintf('/v3/%s/complaints', $domain), $params); |
|
| 85 | ||
| 86 | return $this->hydrateResponse($response, CreateResponse::class); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * @param string $domain Domain to delete complaint for |
|
| @@ 93-107 (lines=15) @@ | ||
| 90 | * |
|
| 91 | * @return DeleteResponse |
|
| 92 | */ |
|
| 93 | public function delete(string $domain, string $address, string $tag = null) |
|
| 94 | { |
|
| 95 | Assert::stringNotEmpty($domain); |
|
| 96 | Assert::stringNotEmpty($address); |
|
| 97 | Assert::nullOrStringNotEmpty($tag); |
|
| 98 | ||
| 99 | $params = []; |
|
| 100 | if (!is_null($tag)) { |
|
| 101 | $params['tag'] = $tag; |
|
| 102 | } |
|
| 103 | ||
| 104 | $response = $this->httpDelete(sprintf('/v3/%s/unsubscribes/%s', $domain, $address), $params); |
|
| 105 | ||
| 106 | return $this->hydrateResponse($response, DeleteResponse::class); |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * @param string $domain Domain to delete all unsubscribes for |
|