diff --git a/src/Api/Templates.php b/src/Api/Templates.php index 120098c3..b3a87cb9 100644 --- a/src/Api/Templates.php +++ b/src/Api/Templates.php @@ -14,7 +14,6 @@ use Exception; use Mailgun\Assert; use Mailgun\Model\Domain\CreateResponse; -use Mailgun\Model\Domain\IndexResponse; use Mailgun\Model\Templates\GetResponse; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Message\ResponseInterface; @@ -37,8 +36,9 @@ class Templates extends HttpApi * @param string $page * @param string $pivot * @param array $requestHeaders - * @return mixed|ResponseInterface + * @return GetResponse|ResponseInterface * @throws ClientExceptionInterface + * @throws Exception */ public function get(string $domain, int $limit, string $page, string $pivot, array $requestHeaders = []) { diff --git a/src/Model/Templates/GetResponse.php b/src/Model/Templates/GetResponse.php index bf82e355..84f6da78 100644 --- a/src/Model/Templates/GetResponse.php +++ b/src/Model/Templates/GetResponse.php @@ -34,6 +34,10 @@ private function __construct() { } + /** + * @param array $data + * @return static + */ public static function create(array $data): self { $items = []; diff --git a/src/Model/Templates/Template.php b/src/Model/Templates/Template.php index 6bb27072..f48972b6 100644 --- a/src/Model/Templates/Template.php +++ b/src/Model/Templates/Template.php @@ -13,20 +13,118 @@ class Template { - private $tag; + /** @var string $id */ + private $id; + /** @var string $id */ + private $name; + /** @var string $id */ private $description; - private $firstSeen; - private $lastSeen; + /** @var string $id */ + private $createdAt; + /** @var string $id */ + private $createdBy; + /** + * + */ private function __construct() { } + /** + * @param array $data + * @return static + */ public static function create(array $data): self { $model = new self(); - print_r($data); + $model->setId($data['id']); + $model->setName($data['name']); + $model->setDescription($data['description'] ?? ''); + $model->setCreatedAt($data['createdAt'] ?? ''); + $model->setCreatedBy($data['createdBy'] ?? ''); + return $model; } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * @return string + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription(string $description): void + { + $this->description = $description; + } + + /** + * @return string + */ + public function getCreatedAt(): string + { + return $this->createdAt; + } + + /** + * @param string $createdAt + */ + public function setCreatedAt(string $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return string + */ + public function getCreatedBy(): string + { + return $this->createdBy; + } + + /** + * @param string $createdBy + */ + public function setCreatedBy(string $createdBy): void + { + $this->createdBy = $createdBy; + } }