Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kimpepper committed Nov 20, 2024
1 parent 03f5549 commit 2d83a39
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 35 deletions.
13 changes: 7 additions & 6 deletions src/OpenSearch/Endpoints/AbstractEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ abstract class AbstractEndpoint implements EndpointInterface
/**
* @var array
*/
protected array $params = [];
protected $params = [];

/**
* @var string|null
*/
protected ?string $index = null;
protected $index = null;

/**
* @var string|int|null
*/
protected string|int|null $id = null;
protected $id = null;

/**
* @var string|null
Expand All @@ -52,17 +52,17 @@ abstract class AbstractEndpoint implements EndpointInterface
/**
* @var string|array|null
*/
protected string|array|null $body = null;
protected $body = null;

/**
* @var array
*/
private array $options = [];
private $options = [];

/**
* @var SerializerInterface
*/
protected SerializerInterface $serializer;
protected $serializer;

/**
* @return string[]
Expand All @@ -84,6 +84,7 @@ abstract public function getMethod(): string;
* Set the parameters for this endpoint
*
* @param mixed[] $params Array of parameters
* @return $this
*/
public function setParams(array $params): static
{
Expand Down
3 changes: 2 additions & 1 deletion src/OpenSearch/LegacyTransportWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function sendRequest(
array $headers = [],
): array|string|null {
$promise = $this->transport->performRequest($method, $uri, $params, $body);
return $this->transport->resultOrFuture($promise);
$futureArray = $this->transport->resultOrFuture($promise);
return $futureArray->_value;
}

}
2 changes: 0 additions & 2 deletions src/OpenSearch/Namespaces/AbstractNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ abstract class AbstractNamespace

protected EndpointFactoryInterface $endpointFactory;

protected bool $isAsync = false;

/**
* @var callable
*
Expand Down
12 changes: 6 additions & 6 deletions src/OpenSearch/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
*/
class TransportFactory
{
protected ?PsrRequestFactoryInterface $psrRequestFactory = null;
private ?PsrRequestFactoryInterface $psrRequestFactory = null;

protected ?StreamFactoryInterface $streamFactory = null;
private ?StreamFactoryInterface $streamFactory = null;

protected ?UriFactoryInterface $uriFactory = null;
private ?UriFactoryInterface $uriFactory = null;

protected ?SerializerInterface $serializer = null;
private ?SerializerInterface $serializer = null;

protected ?RequestFactoryInterface $requestFactory = null;
private ?RequestFactoryInterface $requestFactory = null;

protected ?ClientInterface $httpClient = null;
private ?ClientInterface $httpClient = null;

protected function getHttpClient(): ?ClientInterface
{
Expand Down
20 changes: 0 additions & 20 deletions util/template/client-class
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,6 @@ class Client
}
}

/**
* Check if the client is running in async mode.
*/
public function isAsync(): bool
{
return $this->isAsync;
}

/**
* Set the client to run in async mode.
*/
public function setAsync(bool $isAsync): static
{
$this->isAsync = $isAsync;
return $this;
}

/**
* Sends a raw request to the cluster
* @return callable|array
Expand All @@ -172,9 +155,6 @@ class Client
return $this->httpTransport->sendRequest($method, $uri, $params, $body, $options['headers'] ?? []);
}

/**
* @return callable|array
*/
private function performRequest(AbstractEndpoint $endpoint): array|string|null
{
return $this->httpTransport->sendRequest(
Expand Down

0 comments on commit 2d83a39

Please sign in to comment.