| @@ 20-38 (lines=19) @@ | ||
| 17 | * |
|
| 18 | * @author Tobias Nyholm <[email protected]> |
|
| 19 | */ |
|
| 20 | class Event extends HttpApi |
|
| 21 | { |
|
| 22 | use Pagination; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @param string $domain |
|
| 26 | * @param array $params |
|
| 27 | * |
|
| 28 | * @return EventResponse |
|
| 29 | */ |
|
| 30 | public function get(string $domain, array $params = []) |
|
| 31 | { |
|
| 32 | Assert::stringNotEmpty($domain); |
|
| 33 | ||
| 34 | $response = $this->httpGet(sprintf('/v3/%s/events', $domain), $params); |
|
| 35 | ||
| 36 | return $this->hydrateResponse($response, EventResponse::class); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 19-36 (lines=18) @@ | ||
| 16 | /** |
|
| 17 | * @author Tobias Nyholm <[email protected]> |
|
| 18 | */ |
|
| 19 | class Attachment extends HttpApi |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @return Model|ResponseInterface |
|
| 23 | */ |
|
| 24 | public function show(string $url) |
|
| 25 | { |
|
| 26 | Assert::stringNotEmpty($url); |
|
| 27 | Assert::regex($url, '@https://.*mailgun\.(net|org)/v.+@'); |
|
| 28 | Assert::regex($url, '|/attachments/[0-9]+|'); |
|
| 29 | ||
| 30 | $response = $this->httpGet($url); |
|
| 31 | ||
| 32 | return $this->hydrateResponse($response, Model::class); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||