From ef4db6ff8a41e5fed5c8cf6aa01a300344199cfc Mon Sep 17 00:00:00 2001 From: Piotr Pasich Date: Tue, 25 Oct 2016 10:58:19 +0200 Subject: [PATCH 1/2] some random fixed --- src/CL/Slack/Model/Attachment.php | 20 +++++- src/CL/Slack/Payload/ReactionsPayload.php | 70 +++++++++++++++++++ .../Payload/ReactionsPayloadResponse.php | 63 +++++++++++++++++ .../serializer/CL.Slack.Model.Attachment.yml | 11 +++ .../CL.Slack.Model.SimpleMessage.yml | 2 +- ...Slack.Payload.ReactionsPayloadResponse.yml | 6 ++ 6 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 src/CL/Slack/Payload/ReactionsPayload.php create mode 100644 src/CL/Slack/Payload/ReactionsPayloadResponse.php create mode 100644 src/CL/Slack/Resources/config/serializer/CL.Slack.Payload.ReactionsPayloadResponse.yml diff --git a/src/CL/Slack/Model/Attachment.php b/src/CL/Slack/Model/Attachment.php index 1307548b..8a76881c 100644 --- a/src/CL/Slack/Model/Attachment.php +++ b/src/CL/Slack/Model/Attachment.php @@ -74,7 +74,9 @@ class Attachment extends AbstractModel * @var AttachmentField[]|ArrayCollection */ private $fields; - + + private $footer; + /** * @var Array */ @@ -278,4 +280,20 @@ public function getMrkdwnIn() { return $this->mrkdwnIn; } + + /** + * @return mixed + */ + public function getFooter() + { + return $this->footer; + } + + /** + * @param mixed $footer + */ + public function setFooter($footer) + { + $this->footer = $footer; + } } diff --git a/src/CL/Slack/Payload/ReactionsPayload.php b/src/CL/Slack/Payload/ReactionsPayload.php new file mode 100644 index 00000000..e34172bd --- /dev/null +++ b/src/CL/Slack/Payload/ReactionsPayload.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace CL\Slack\Payload; + +/** + * @author Cas Leentfaar + * + * @link Official documentation at https://api.slack.com/methods/channels.archive + */ +class ReactionsPayload extends AbstractPayload +{ + /** + * @var string + */ + private $channel; + + /** + * @var string + */ + private $timestamp; + + /** + * @param string $channelId + */ + public function setChannelId($channelId) + { + $this->channel = $channelId; + } + + /** + * @return string + */ + public function getChannelId() + { + return $this->channel; + } + + /** + * @return string + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * @param string $timestamp + */ + public function setTimestamp($timestamp) + { + $this->timestamp = $timestamp; + } + + /** + * @return string + */ + public function getMethod() + { + return 'reactions.get'; + } +} diff --git a/src/CL/Slack/Payload/ReactionsPayloadResponse.php b/src/CL/Slack/Payload/ReactionsPayloadResponse.php new file mode 100644 index 00000000..2f63dddd --- /dev/null +++ b/src/CL/Slack/Payload/ReactionsPayloadResponse.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace CL\Slack\Payload; + +/** + * @author Cas Leentfaar + */ +class ReactionsPayloadResponse extends AbstractPayloadResponse +{ + private $message; + + private $channel; + + /** + * @return mixed + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param mixed $message + */ + public function setMessage($message) + { + $this->message = $message; + } + + /** + * @return mixed + */ + public function getChannel() + { + return $this->channel; + } + + /** + * @param mixed $channel + */ + public function setChannel($channel) + { + $this->channel = $channel; + } + + public function getReactions() + { + if (!isset($this->message['reactions'])) { + return []; + } + + return $this->message['reactions']; + } +} diff --git a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml index 89ffe5a3..7b379cab 100644 --- a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml +++ b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml @@ -1,5 +1,16 @@ CL\Slack\Model\Attachment: properties: + titleLink: + type: string + authorName: + type: string + authorLink: + type: string + authorIcon: + type: string + mrkdwnIn: + type: array + title: type: string fallback: diff --git a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.SimpleMessage.yml b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.SimpleMessage.yml index 3a888918..bf779af9 100644 --- a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.SimpleMessage.yml +++ b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.SimpleMessage.yml @@ -7,7 +7,7 @@ CL\Slack\Model\SimpleMessage: subtype: type: string channel: - type: CL\Slack\Model\SimpleChannel + type: string user: type: string username: diff --git a/src/CL/Slack/Resources/config/serializer/CL.Slack.Payload.ReactionsPayloadResponse.yml b/src/CL/Slack/Resources/config/serializer/CL.Slack.Payload.ReactionsPayloadResponse.yml new file mode 100644 index 00000000..97b328d6 --- /dev/null +++ b/src/CL/Slack/Resources/config/serializer/CL.Slack.Payload.ReactionsPayloadResponse.yml @@ -0,0 +1,6 @@ +CL\Slack\Payload\ReactionsPayloadResponse: + properties: + channel: + type: string + message: + type: array From b7bb64e6af4ae62f35a32da0c3397b7f1284f5eb Mon Sep 17 00:00:00 2001 From: Piotr Pasich Date: Wed, 26 Oct 2016 10:50:00 +0200 Subject: [PATCH 2/2] Attachment --- .../Resources/config/serializer/CL.Slack.Model.Attachment.yml | 2 ++ .../Slack/Resources/config/serializer/CL.Slack.Model.File.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml index 7b379cab..c561b41d 100644 --- a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml +++ b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.Attachment.yml @@ -23,5 +23,7 @@ CL\Slack\Model\Attachment: type: string color: type: string + footer: + type: string fields: type: ArrayCollection diff --git a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.File.yml b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.File.yml index bf91b456..1e48eb3b 100644 --- a/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.File.yml +++ b/src/CL/Slack/Resources/config/serializer/CL.Slack.Model.File.yml @@ -79,6 +79,6 @@ CL\Slack\Model\File: groups: type: array initialComment: - type: string + type: array numStars: type: integer