public function getMessagesFromAllChannels($sinceTimestamp = null)
 {
     $allMessages = [];
     $payload = new ChannelsListPayload();
     $channels = $this->apiClient->send($payload)->getChannels();
     foreach ($channels as $channel) {
         $channelPayload = new ChannelsHistoryPayload();
         $channelPayload->setChannelId($channel->getId());
         $channelPayload->setCount(100000);
         if (null !== $sinceTimestamp) {
             $channelPayload->setOldest($sinceTimestamp);
         }
         $messages = $this->apiClient->send($channelPayload)->getMessages();
         $allMessages = array_merge($allMessages, array_map(function (SimpleMessage $message) use($channel) {
             return $this->messageBuilder->getMessage(new SimpleMessageAdapter($message, $channel));
         }, $messages));
     }
     return $allMessages;
 }
 /**
  * {@inheritdoc}
  */
 protected function createPayload()
 {
     $payload = new ChannelsHistoryPayload();
     $payload->setChannelId('C1234567');
     $payload->setCount(123);
     $payload->setOldest('12345678.12345678');
     $payload->setLatest('12345678.12345678');
     return $payload;
 }
 /**
  * @return ChannelsHistoryPayload
  */
 protected function createPayload()
 {
     $payload = new ChannelsHistoryPayload();
     $payload->setChannelId($this->input->getArgument('channel-id'));
     $payload->setLatest($this->input->getOption('latest'));
     $payload->setOldest($this->input->getOption('oldest'));
     $payload->setCount($this->input->getOption('count'));
     return $payload;
 }