コード例 #1
0
 /**
  * @param PayloadInterface $payload
  *
  * @return array The serialized payload data
  */
 public function serialize(PayloadInterface $payload)
 {
     if ($payload instanceof AdvancedSerializeInterface) {
         $payload->beforeSerialize($this->serializer);
     }
     $serializedPayload = $this->serializer->serialize($payload, 'json');
     if (!$serializedPayload || !is_string($serializedPayload)) {
         throw new \RuntimeException(sprintf('Failed to serialize payload; expected it to be a string, got: %s', var_export($serializedPayload, true)));
     }
     return json_decode($serializedPayload, true);
 }
コード例 #2
0
 /**
  * @inheritdoc
  *
  * @param ImHistoryPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getImId(), 'latest' => $payload->getLatest(), 'oldest' => $payload->getOldest(), 'count' => $payload->getCount()];
 }
コード例 #3
0
 /**
  * @inheritdoc
  *
  * @param ChannelsKickPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'user' => $payload->getUserId()];
 }
コード例 #4
0
 /**
  * @inheritdoc
  *
  * @param OauthAccessPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['client_id' => $payload->getClientId(), 'client_secret' => $payload->getClientSecret(), 'code' => $payload->getCode(), 'redirect_uri' => $payload->getRedirectUri()];
 }
コード例 #5
0
 /**
  * @inheritdoc
  *
  * @param ApiTestPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['error' => $payload->getError(), 'foo' => $payload->getArgument('foo')];
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  *
  * @param ChatPostMessagePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     /** @var Attachment $attachment */
     $attachment = $payload->getAttachments()->first();
     /** @var AttachmentField $attachmentField */
     $attachmentField = $attachment->getFields()->first();
     return ['channel' => $payload->getChannel(), 'text' => $payload->getText(), 'username' => $payload->getUsername(), 'icon_emoji' => $payload->getIconEmoji(), 'icon_url' => $payload->getIconUrl(), 'unfurl_media' => $payload->getUnfurlMedia(), 'unfurl_links' => $payload->getUnfurlLinks(), 'link_names' => $payload->getLinkNames(), 'parse' => $payload->getParse(), 'attachments' => json_encode([['title' => $attachment->getTitle(), 'title_link' => $attachment->getTitleLink(), 'image_url' => $attachment->getImageUrl(), 'author_name' => $attachment->getAuthorName(), 'author_link' => $attachment->getAuthorLink(), 'author_icon' => $attachment->getAuthorIcon(), 'pre_text' => $attachment->getPreText(), 'text' => $attachment->getText(), 'color' => $attachment->getColor(), 'fallback' => $attachment->getFallback(), 'fields' => [['title' => $attachmentField->getTitle(), 'value' => $attachmentField->getValue(), 'short' => $attachmentField->isShort()]]]])];
 }
コード例 #7
0
ファイル: ImListPayloadTest.php プロジェクト: salt-lick/slack
 /**
  * @inheritdoc
  *
  * @param ImListPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['exclude_archived' => $payload->isExcludeArchived()];
 }
コード例 #8
0
 /**
  * @inheritdoc
  *
  * @param AbstractSearchPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['query' => $payload->getQuery(), 'page' => $payload->getPage(), 'count' => $payload->getCount(), 'highlight' => $payload->getHighlight(), 'sort' => $payload->getSort(), 'sort_dir' => $payload->getSortDir()];
 }
コード例 #9
0
 /**
  * {@inheritdoc}
  *
  * @param FilesListPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['page' => $payload->getPage(), 'count' => $payload->getCount(), 'types' => $payload->getTypes(), 'user' => $payload->getUserId(), 'ts_from' => $payload->getTimestampFrom()->format('U'), 'ts_to' => $payload->getTimestampTo()->format('U')];
 }
コード例 #10
0
 /**
  * @inheritdoc
  *
  * @param UsersSetPresencePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['presence' => $payload->getPresence()];
 }
コード例 #11
0
 /**
  * @inheritdoc
  *
  * @param FilesUploadPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['title' => $payload->getTitle(), 'content' => $payload->getContent(), 'filename' => $payload->getFilename(), 'file_type' => $payload->getFileType(), 'channels' => $payload->getChannelsAsString()];
 }
コード例 #12
0
 /**
  * {@inheritdoc}
  *
  * @param StarsListPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['count' => $payload->getCount(), 'page' => $payload->getPage(), 'user' => $payload->getUserId()];
 }
コード例 #13
0
 /**
  * @inheritdoc
  *
  * @param ChannelsSetTopicPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'topic' => $payload->getTopic()];
 }
コード例 #14
0
 /**
  * {@inheritdoc}
  *
  * @param ChannelsSetPurposePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'purpose' => $payload->getPurpose()];
 }
コード例 #15
0
 /**
  * {@inheritdoc}
  *
  * @param GroupsClosePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getGroupId()];
 }
コード例 #16
0
 /**
  * {@inheritdoc}
  *
  * @param GroupsCreatePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['name' => $payload->getName()];
 }
コード例 #17
0
ファイル: ImMarkPayloadTest.php プロジェクト: wogsland/slack
 /**
  * {@inheritdoc}
  *
  * @param ImMarkPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['ts' => $payload->getSlackTimestamp(), 'channel' => $payload->getImId()];
 }
コード例 #18
0
 /**
  * {@inheritdoc}
  *
  * @param UsersAdminInvitePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['email' => $payload->getEmail()];
 }