Skip to content

Commit

Permalink
Do not send q param when text is empty (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgallice authored Aug 10, 2016
1 parent a4f9c11 commit 63d9997
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/ConverseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ public function __construct(Client $client)
$this->client = $client;
}

public function converse($sessionId, $text, Context $context = null)
/**
* @param string $sessionId
* @param string|null $text
* @param Context|null $context
*
* @return array
*/
public function converse($sessionId, $text = null, Context $context = null)
{
$query = [
'session_id' => $sessionId,
'q' => $text,
];

if (!empty($text)) {
$query['q'] = $text;
}

$response = $this->client->send('POST', '/converse', $context, $query);

return $this->decodeResponse($response);
Expand Down

0 comments on commit 63d9997

Please sign in to comment.