/** * @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); }
/** * @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); }