Пример #1
0
 /**
  * @param null|string $entityId
  *
  * @return mixed
  */
 public function get($entityId = null)
 {
     if (null !== $entityId) {
         $entityId = '/' . $entityId;
     }
     $response = $this->client->get(sprintf('/entities%s', $entityId));
     return $this->decodeResponse($response);
 }
Пример #2
0
 /**
  * @param string $text
  * @param Context|null $context
  * @param array $queryParams
  *
  * @return mixed
  */
 public function extractMeaning($text, Context $context = null, array $queryParams = [])
 {
     $query = array_merge($queryParams, ['q' => $text]);
     if (null !== $context && !$context->isEmpty()) {
         $query['context'] = json_encode($context);
     }
     $response = $this->client->get('/message', $query);
     return $this->decodeResponse($response);
 }