diff --git a/CHANGELOG.md b/CHANGELOG.md index 91135eb4e..b3bf65273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Removed ### Fixed ### Updated APIs +- Updated opensearch-php APIs to reflect [opensearch-api-specification@597ed8d](https://github.com/opensearch-project/opensearch-api-specification/commit/597ed8d73c0b72743ed90fd9694ad9ba511d5be7) - Updated opensearch-php APIs to reflect [opensearch-api-specification@ecf3921](https://github.com/opensearch-project/opensearch-api-specification/commit/ecf39215e18d9edeba1d048b2ba22a172844ae6c) ### Security ### Dependencies diff --git a/src/OpenSearch/Namespaces/SqlNamespace.php b/src/OpenSearch/Namespaces/SqlNamespace.php index 8265001a7..72a004121 100644 --- a/src/OpenSearch/Namespaces/SqlNamespace.php +++ b/src/OpenSearch/Namespaces/SqlNamespace.php @@ -169,13 +169,27 @@ public function settings(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } - /** + } /** * Proxy function to closeCursor() to prevent BC break. * This API will be removed in a future version. Use 'close' API instead. + * Note that the SQL close API takes the cursor in the body. + * + * $params['cursor'] = (string) The cursor given by the server + * + * @param array{'cursor': string} $params Associative array of parameters + * @return array */ - public function closeCursor(array $params = []) + public function closeCursor(array $params): array { - return $this->close($params); + $endpointBuilder = $this->endpoints; + + /** @var AbstractEndpoint $endpoint */ + $endpoint = $endpointBuilder('Sql\Close'); + $endpoint->setBody(array_filter([ + 'cursor' => $this->extractArgument($params, 'cursor'), + ])); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); } } diff --git a/util/EndpointProxies/sql/closeCursorProxy.php b/util/EndpointProxies/sql/closeCursorProxy.php index c0e7f0b1d..fa770c5c5 100644 --- a/util/EndpointProxies/sql/closeCursorProxy.php +++ b/util/EndpointProxies/sql/closeCursorProxy.php @@ -1,13 +1,27 @@ close($params); + $endpointBuilder = $this->endpoints; + + /** @var AbstractEndpoint $endpoint */ + $endpoint = $endpointBuilder('Sql\Close'); + $endpoint->setBody(array_filter([ + 'cursor' => $this->extractArgument($params, 'cursor'), + ])); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); } EOD;