예제 #1
0
 /**
  * @param int $from  offset from
  * @param int $count
  *
  * @throws CommunicationException
  *
  * @return Inbox
  */
 public function receive($from = 0, $count = Inbox::PAGE_LIMIT)
 {
     $query = [];
     if ($from) {
         $query['from'] = $from;
     }
     if ($count) {
         $query['count'] = $count;
     }
     $options = ['query' => Out::attachAuth($this->account, $query)];
     if ($this->clientVersion == '5') {
         $request = $this->client->createRequest('GET', 'recieve', $options);
         $response = Out::send($this->client, $request);
     } else {
         $request = new Request('GET', 'recieve');
         $response = Out::send($this->client, $request, $options);
     }
     return Parser::prepareInbox($response);
 }