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