/** * @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); }
/** * @inheritdoc * * @param ImHistoryPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['channel' => $payload->getImId(), 'latest' => $payload->getLatest(), 'oldest' => $payload->getOldest(), 'count' => $payload->getCount()]; }
/** * @inheritdoc * * @param ChannelsKickPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['channel' => $payload->getChannelId(), 'user' => $payload->getUserId()]; }
/** * @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()]; }
/** * @inheritdoc * * @param ApiTestPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['error' => $payload->getError(), 'foo' => $payload->getArgument('foo')]; }
/** * {@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()]]]])]; }
/** * @inheritdoc * * @param ImListPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['exclude_archived' => $payload->isExcludeArchived()]; }
/** * @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()]; }
/** * {@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')]; }
/** * @inheritdoc * * @param UsersSetPresencePayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['presence' => $payload->getPresence()]; }
/** * @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()]; }
/** * {@inheritdoc} * * @param StarsListPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['count' => $payload->getCount(), 'page' => $payload->getPage(), 'user' => $payload->getUserId()]; }
/** * @inheritdoc * * @param ChannelsSetTopicPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['channel' => $payload->getChannelId(), 'topic' => $payload->getTopic()]; }
/** * {@inheritdoc} * * @param ChannelsSetPurposePayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['channel' => $payload->getChannelId(), 'purpose' => $payload->getPurpose()]; }
/** * {@inheritdoc} * * @param GroupsClosePayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['channel' => $payload->getGroupId()]; }
/** * {@inheritdoc} * * @param GroupsCreatePayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['name' => $payload->getName()]; }
/** * {@inheritdoc} * * @param ImMarkPayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['ts' => $payload->getSlackTimestamp(), 'channel' => $payload->getImId()]; }
/** * {@inheritdoc} * * @param UsersAdminInvitePayload $payload */ protected function getExpectedPayloadData(PayloadInterface $payload) { return ['email' => $payload->getEmail()]; }