Skip to content

Commit

Permalink
Merge pull request #10 from faouzic/feature/23330
Browse files Browse the repository at this point in the history
[FEATURE#23330] fetchUnread
  • Loading branch information
gdubost committed Dec 9, 2015
2 parents b784758 + 7195255 commit da8ce23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ConversationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function findByQueryString($query, $from = 0, $size = 99999)
$response = $this->fireRequest($request, $this->app["cookies.authenticator"]);

$response["hits"] = array_map(
function($hit) {
function ($hit) {
$conversation = new Conversation();
$conversation->fromArray($hit);
return $conversation;
Expand All @@ -39,6 +39,16 @@ function($hit) {
return $response;
}

public function findUnreadByQueryString($query, $from = 0, $size = 99999)
{
$query = urlencode($query);
$request = $this->app["conversation_proxy"]
->get("/fetch_unread?q={$query}&from={$from}&size={$size}");
$unread = $this->fireRequest($request, $this->app["cookies.authenticator"]);

return $unread;
}

public function findOneByQueryString($query)
{
$matching = $this->findByQueryString($query, 0, 1);
Expand Down

0 comments on commit da8ce23

Please sign in to comment.