-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c6a409b
Showing
11 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
/** | ||
* Automatically created by MageSpecialist CodeMonkey | ||
* https://github.com/magespecialist/m2-MSP_CodeMonkey | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierTemplateApi\Api\Data; | ||
|
||
use Magento\Framework\Api\ExtensibleDataInterface; | ||
|
||
interface DatabaseTemplateInterface extends ExtensibleDataInterface | ||
{ | ||
const ID = 'template_id'; | ||
const CODE = 'code'; | ||
const ADAPTER_CODE = 'adapter_code'; | ||
const NAME = 'name'; | ||
const TEMPLATE = 'template'; | ||
|
||
/** | ||
* Get value for rule_id | ||
* @return int | ||
*/ | ||
public function getId(); | ||
|
||
/** | ||
* Set value for rule_id | ||
* @param int $value | ||
* @return void | ||
*/ | ||
public function setId($value); | ||
|
||
/** | ||
* Get value for code | ||
* @return string | ||
*/ | ||
public function getCode(); | ||
|
||
/** | ||
* Set value for code | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setCode($value); | ||
|
||
/** | ||
* Get value for adapter_code | ||
* @return string | ||
*/ | ||
public function getAdapterCode(); | ||
|
||
/** | ||
* Set value for adapter_code | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setAdapterCode($value); | ||
|
||
/** | ||
* Get value for name | ||
* @return string | ||
*/ | ||
public function getName(); | ||
|
||
/** | ||
* Set value for name | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setName($value); | ||
|
||
/** | ||
* Get value for template | ||
* @return string | ||
*/ | ||
public function getTemplate(); | ||
|
||
/** | ||
* Set value for template | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setTemplate($value); | ||
|
||
/** | ||
* Retrieve existing extension attributes object or create a new one | ||
* @return \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateExtensionInterface|null | ||
*/ | ||
public function getExtensionAttributes(); | ||
|
||
/** | ||
* Set an extension attributes object | ||
* @param \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateExtensionInterface $extensionAttributes | ||
* @return $this | ||
*/ | ||
public function setExtensionAttributes( | ||
\MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateExtensionInterface $extensionAttributes | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Automatically created by MageSpecialist CodeMonkey | ||
* https://github.com/magespecialist/m2-MSP_CodeMonkey | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierTemplateApi\Api; | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD.ShortVariable) | ||
*/ | ||
interface DatabaseTemplateRepositoryInterface | ||
{ | ||
/** | ||
* Save DatabaseTemplate | ||
* @param \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface $databaseTemplate | ||
* @return int | ||
*/ | ||
public function save(\MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface $databaseTemplate): int; | ||
|
||
/** | ||
* Get DatabaseTemplate by id | ||
* @param int $databaseTemplateIid | ||
* @return \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface | ||
*/ | ||
public function get(int $databaseTemplateIid): \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface; | ||
|
||
/** | ||
* Get by Code value | ||
* @param string $code | ||
* @return \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function getByCode(string $code): \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface; | ||
|
||
/** | ||
* Get by AdapterCode value | ||
* @param string $adapterCode | ||
* @return \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function getByAdapterCode(string $adapterCode): \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface; | ||
|
||
/** | ||
* Delete DatabaseTemplate | ||
* @param int $databaseTemplateIid | ||
* @return void | ||
*/ | ||
public function deleteById(int $databaseTemplateIid); | ||
|
||
/** | ||
* Get a list of DatabaseTemplate | ||
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria | ||
* @return \MSP\NotifierTemplateApi\Api\DatabaseTemplateSearchResultsInterface | ||
*/ | ||
public function getList( | ||
\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null | ||
): \MSP\NotifierTemplateApi\Api\DatabaseTemplateSearchResultsInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Automatically created by MageSpecialist CodeMonkey | ||
* https://github.com/magespecialist/m2-MSP_CodeMonkey | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierTemplateApi\Api; | ||
|
||
interface DatabaseTemplateSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface | ||
{ | ||
/** | ||
* Get an array of objects | ||
* @return \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface[] | ||
*/ | ||
public function getItems(); | ||
|
||
/** | ||
* Set objects list | ||
* @param \MSP\NotifierTemplateApi\Api\Data\DatabaseTemplateInterface[] $items | ||
* @return $this | ||
*/ | ||
public function setItems(array $items); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MSP\NotifierTemplateApi\Api; | ||
|
||
interface SendMessageInterface | ||
{ | ||
/** | ||
* Send a template formatted message | ||
* @param string $channelCode | ||
* @param string $template | ||
* @param array $params | ||
* @return bool | ||
*/ | ||
public function execute(string $channelCode, string $template, array $params = []): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* MageSpecialist | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to info@magespecialist.it so we can send you a copy immediately. | ||
* | ||
* @copyright Copyright (c) 2018 Skeeller srl (http://www.magespecialist.it) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# notifier-template-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "msp/module-notifier-template-api", | ||
"description": "Twig template manager for notifier API", | ||
"require": { | ||
"php": "^7.0|^7.1|^7.2" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Riccardo Tempesta", | ||
"email": "riccardo.tempesta@magespecialist.it" | ||
}, | ||
{ | ||
"name": "Giacomo Mirabassi", | ||
"email": "giacomo.mirabassi@magespecialist.it" | ||
} | ||
], | ||
"type": "magento2-module", | ||
"license": "OSL-3.0", | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
"MSP\\NotifierTemplateApi\\": "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> | ||
<acl> | ||
<resources> | ||
<resource id="Magento_Backend::admin"> | ||
<resource id="Magento_Backend::system"> | ||
<resource id="MSP_NotifierApi::notifier"> | ||
<resource id="MSP_NotifierTemplateApi::general" | ||
title="Messages template" | ||
translate="title" | ||
sortOrder="40"> | ||
<resource id="MSP_NotifierTemplateApi::template" | ||
title="Template" | ||
translate="title" | ||
sortOrder="10"> | ||
<resource id="MSP_NotifierTemplateApi::template_edit" | ||
title="Edit" | ||
translate="title" | ||
sortOrder="10" /> | ||
</resource> | ||
<resource id="MSP_NotifierTemplateApi::send" | ||
title="Send messages" | ||
translate="title" | ||
sortOrder="10" /> | ||
</resource> | ||
</resource> | ||
</resource> | ||
</resource> | ||
</resources> | ||
</acl> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="MSP_NotifierTemplateApi" setup_version="0.1.0"> | ||
</module> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> | ||
|
||
<route url="/V1/msp-notifier-template/database" method="GET"> | ||
<service class="MSP\NotifierTemplateApi\Api\DatabaseTemplateRepositoryInterface" method="getList"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::template"/> | ||
</resources> | ||
</route> | ||
|
||
<route url="/V1/msp-notifier-template/database/:code" method="GET"> | ||
<service class="MSP\NotifierTemplateApi\Api\DatabaseTemplateRepositoryInterface" method="getByCode"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::template"/> | ||
</resources> | ||
</route> | ||
|
||
<route url="/V1/msp-notifier-template/database/:databaseTemplateIid" method="DELETE"> | ||
<service class="MSP\NotifierTemplateApi\Api\DatabaseTemplateRepositoryInterface" method="deleteById"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::template_edit"/> | ||
</resources> | ||
</route> | ||
|
||
<route url="/V1/msp-notifier-template/database" method="PUT"> | ||
<service class="MSP\NotifierTemplateApi\Api\DatabaseTemplateRepositoryInterface" method="save"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::template_edit"/> | ||
</resources> | ||
</route> | ||
<route url="/V1/msp-notifier-template/database" method="POST"> | ||
<service class="MSP\NotifierTemplateApi\Api\DatabaseTemplateRepositoryInterface" method="save"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::template_edit"/> | ||
</resources> | ||
</route> | ||
|
||
<route url="/V1/msp-notifier-template/send" method="POST"> | ||
<service class="MSP\NotifierTemplateApi\Api\SendMessageInterface" method="execute"/> | ||
<resources> | ||
<resource ref="MSP_NotifierTemplateApi::send"/> | ||
</resources> | ||
</route> | ||
</routes> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* Copyright © MageSpecialist - Skeeller srl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'MSP_NotifierTemplateApi', | ||
__DIR__ | ||
); |