From b991e21b76ee3889abeb51856e4939c09c915b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.eu> Date: Fri, 8 May 2020 16:58:58 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9veloppement=20des=20interfaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/CategoryWidgetRepositoryInterface.php | 60 +++++++++ Api/Data/CategoryWidgetInterface.php | 127 ++++++++++++++++++ .../CategoryWidgetSearchResultsInterface.php | 31 +++++ ...GetCategoryWidgetByIdentifierInterface.php | 25 ++++ 4 files changed, 243 insertions(+) create mode 100755 Api/CategoryWidgetRepositoryInterface.php create mode 100755 Api/Data/CategoryWidgetInterface.php create mode 100755 Api/Data/CategoryWidgetSearchResultsInterface.php create mode 100755 Api/GetCategoryWidgetByIdentifierInterface.php diff --git a/Api/CategoryWidgetRepositoryInterface.php b/Api/CategoryWidgetRepositoryInterface.php new file mode 100755 index 0000000..151798d --- /dev/null +++ b/Api/CategoryWidgetRepositoryInterface.php @@ -0,0 +1,60 @@ +<?php +namespace NicolasBejean\CategoryWidget\Api; + +/** + * Interface CategoryWidgetRepositoryInterface + * + * @category PHP + * @package NicolasBejean\CategoryWidget\Api + * @author Nicolas Béjean <nicolas@bejean.eu> + * @license https://github.com/nicolasbejean/category-widget/blob/master/licence.txt BSD Licence + * @link https://www.bejean.eu + */ +interface CategoryWidgetRepositoryInterface +{ + /** + * Save Category Widget + * + * @param \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface $imageSlider + * @return \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function save(Data\CategoryWidgetInterface $imageSlider); + + /** + * Get Category Widget by ID + * + * @param int $id + * @return \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getById($id); + + /** + * Get Category Widget by list + * + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetSearchResultsInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); + + /** + * Delete Category Widget + * + * @param \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface $imageSlider + * @return bool true on success + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function delete(Data\CategoryWidgetInterface $imageSlider); + + /** + * Delete Category Widget by ID + * + * @param int $id + * @return bool true on success + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function deleteById($id); +} diff --git a/Api/Data/CategoryWidgetInterface.php b/Api/Data/CategoryWidgetInterface.php new file mode 100755 index 0000000..c775dd2 --- /dev/null +++ b/Api/Data/CategoryWidgetInterface.php @@ -0,0 +1,127 @@ +<?php +namespace NicolasBejean\CategoryWidget\Api\Data; + +/** + * Interface CategoryWidgetInterface + * + * @category PHP + * @package NicolasBejean\CategoryWidget\Api\Data + * @author Nicolas Béjean <nicolas@bejean.eu> + * @license https://github.com/nicolasbejean/category-widget/blob/master/licence.txt BSD Licence + * @link https://www.bejean.eu + */ +interface CategoryWidgetInterface +{ + const ENTITY_ID = 'entity_id'; + const TITLE = 'title'; + const IDENTIFIER = 'identifier'; + const CONTENT = 'content'; + const IS_ACTIVE = 'is_active'; + const CREATION_TIME = 'created_at'; + const UPDATE_TIME = 'updated_at'; + + /** + * Get Category Widget ID + * + * @return mixed + */ + public function getId(); + + /** + * Get Category Widget Title + * + * @return mixed + */ + public function getTitle(); + + /** + * Get Category Widget Identifier + * + * @return mixed + */ + public function getIdentifier(); + + /** + * Get Category Widget Content + * + * @return mixed + */ + public function getContent(); + + /** + * Get Category Widget Creation Time + * + * @return mixed + */ + public function getCreationTime(); + + /** + * Get Category Widget Update Time + * + * @return mixed + */ + public function getUpdateTime(); + + /** + * Get Category Widget Is Active + * + * @return mixed + */ + public function isActive(); + + /** + * Set Category Widget ID + * + * @param $id + * @return mixed + */ + public function setId($id); + + /** + * Set Category Widget Title + * + * @param $title + * @return mixed + */ + public function setTitle($title); + + /** + * Set Category Widget Identifier + * + * @param $identifier + * @return mixed + */ + public function setIdentifier($identifier); + + /** + * Set Category Widget Content + * + * @param $content + * @return mixed + */ + public function setContent($content); + + /** + * Set Category Widget Creation Time + * + * @param $creationTime + * @return mixed + */ + public function setCreationTime($creationTime); + + /** + * Set Category Widget Update Time + * + * @param $updateTime + * @return mixed + */ + public function setUpdateTime($updateTime); + + /** + * Set Category Widget is Active + * + * @param $isActive + * @return mixed + */ + public function setIsActive($isActive); +} diff --git a/Api/Data/CategoryWidgetSearchResultsInterface.php b/Api/Data/CategoryWidgetSearchResultsInterface.php new file mode 100755 index 0000000..86c1be7 --- /dev/null +++ b/Api/Data/CategoryWidgetSearchResultsInterface.php @@ -0,0 +1,31 @@ +<?php +namespace NicolasBejean\CategoryWidget\Api\Data; + +use \Magento\Framework\Api\SearchResultsInterface; + +/** + * Interface CategoryWidgetSearchResultsInterface + * + * @category PHP + * @package NicolasBejean\CategoryWidget\Api\Data + * @author Nicolas Béjean <nicolas@bejean.eu> + * @license https://github.com/nicolasbejean/category-widget/blob/master/licence.txt BSD Licence + * @link https://www.bejean.eu + */ +interface CategoryWidgetSearchResultsInterface extends SearchResultsInterface +{ + /** + * Get Category Widget Items + * + * @return \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface[] + */ + public function getItems(); + + /** + * Set Category Widget Items + * + * @param \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface[] $items + * @return $this + */ + public function setItems(array $items); +} diff --git a/Api/GetCategoryWidgetByIdentifierInterface.php b/Api/GetCategoryWidgetByIdentifierInterface.php new file mode 100755 index 0000000..3aa06aa --- /dev/null +++ b/Api/GetCategoryWidgetByIdentifierInterface.php @@ -0,0 +1,25 @@ +<?php +namespace NicolasBejean\CategoryWidget\Api; + +use \NicolasBejean\CategoryWidget\Api\Data\CategoryWidgetInterface; + +/** + * Interface GetCategoryWidgetByIdentifierInterface + * + * @category PHP + * @package NicolasBejean\CategoryWidget\Api + * @author Nicolas Béjean <nicolas@bejean.eu> + * @license https://github.com/nicolasbejean/category-widget/blob/master/licence.txt BSD Licence + * @link https://www.bejean.eu + */ +interface GetCategoryWidgetByIdentifierInterface +{ + /** + * Load Category Widget data by given Item Identifier. + * + * @param string $identifier + * @param int $storeId + * @return CategoryWidgetInterface + */ + public function execute(string $identifier, int $storeId) : CategoryWidgetInterface; +} -- GitLab