Skip to content

Commit

Permalink
Return static from fluid setters
Browse files Browse the repository at this point in the history
  • Loading branch information
kimpepper committed Nov 2, 2024
1 parent 2b2d7de commit 30789e4
Show file tree
Hide file tree
Showing 222 changed files with 663 additions and 270 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fixed PHP 8.4 deprecations
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@07e329e](https://github.com/opensearch-project/opensearch-api-specification/commit/07e329e8d01fd0576de6a0a3c35412fd5a9163db)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@1db1840](https://github.com/opensearch-project/opensearch-api-specification/commit/1db184063a463c5180a2cc824b1efc1aeebfd5eb)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722)
### Security
Expand Down
14 changes: 14 additions & 0 deletions src/OpenSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use OpenSearch\Namespaces\SslNamespace;
use OpenSearch\Namespaces\TasksNamespace;
use OpenSearch\Namespaces\TransformsNamespace;
use OpenSearch\Namespaces\WlmNamespace;

/**
* Class Client
Expand Down Expand Up @@ -230,6 +231,11 @@ class Client
*/
protected $transforms;

/**
* @var WlmNamespace
*/
protected $wlm;


/**
* Client constructor
Expand Down Expand Up @@ -271,6 +277,7 @@ public function __construct(Transport $transport, callable $endpoint, array $reg
$this->ssl = new SslNamespace($transport, $endpoint);
$this->tasks = new TasksNamespace($transport, $endpoint);
$this->transforms = new TransformsNamespace($transport, $endpoint);
$this->wlm = new WlmNamespace($transport, $endpoint);

$this->registeredNamespaces = $registeredNamespaces;
}
Expand Down Expand Up @@ -1942,6 +1949,13 @@ public function transforms(): TransformsNamespace
{
return $this->transforms;
}
/**
* Returns the wlm namespace
*/
public function wlm(): WlmNamespace
{
return $this->wlm;
}

/**
* Catchall for registered namespaces
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/AsynchronousSearch/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getMethod(): string
return 'POST';
}

public function setBody($body): Search
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
3 changes: 2 additions & 1 deletion src/OpenSearch/Endpoints/Bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getMethod(): string
return 'POST';
}

public function setBody($body): Bulk
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand All @@ -89,4 +89,5 @@ public function setBody($body): Bulk
}
return $this;
}

}
3 changes: 2 additions & 1 deletion src/OpenSearch/Endpoints/BulkStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getMethod(): string
return 'PUT';
}

public function setBody($body): BulkStream
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand All @@ -85,4 +85,5 @@ public function setBody($body): BulkStream
}
return $this;
}

}
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getMethod(): string
return 'GET';
}

public function setName($name): Aliases
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/Allocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getMethod(): string
return 'GET';
}

public function setNodeId($node_id): Allocation
public function setNodeId($node_id): static
{
if (isset($node_id) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/Fielddata.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getMethod(): string
return 'GET';
}

public function setFields($fields): Fielddata
public function setFields($fields): static
{
if (isset($fields) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/PitSegments.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getMethod(): string
return 'GET';
}

public function setBody($body): PitSegments
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/Snapshots.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getMethod(): string
return 'GET';
}

public function setRepository($repository): Snapshots
public function setRepository($repository): static
{
if (isset($repository) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/Templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getMethod(): string
return 'GET';
}

public function setName($name): Templates
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cat/ThreadPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getMethod(): string
return 'GET';
}

public function setThreadPoolPatterns($thread_pool_patterns): ThreadPool
public function setThreadPoolPatterns($thread_pool_patterns): static
{
if (isset($thread_pool_patterns) !== true) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/Endpoints/ClearScroll.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getMethod(): string
return 'DELETE';
}

public function setBody($body): ClearScroll
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand All @@ -69,7 +69,7 @@ public function setBody($body): ClearScroll
return $this;
}

public function setScrollId($scroll_id): ClearScroll
public function setScrollId($scroll_id): static
{
if (isset($scroll_id) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/AllocationExplain.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getMethod(): string
return isset($this->body) ? 'POST' : 'GET';
}

public function setBody($body): AllocationExplain
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getMethod(): string
return 'DELETE';
}

public function setName($name): DeleteComponentTemplate
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/DeleteWeightedRouting.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getMethod(): string
return 'DELETE';
}

public function setBody($body): DeleteWeightedRouting
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getMethod(): string
return 'HEAD';
}

public function setName($name): ExistsComponentTemplate
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getMethod(): string
return 'GET';
}

public function setName($name): GetComponentTemplate
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getMethod(): string
return 'GET';
}

public function setAwarenessAttributeName($awareness_attribute_name): GetDecommissionAwareness
public function setAwarenessAttributeName($awareness_attribute_name): static
{
if (isset($awareness_attribute_name) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getMethod(): string
return 'GET';
}

public function setAttribute($attribute): GetWeightedRouting
public function setAttribute($attribute): static
{
if (isset($attribute) !== true) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getMethod(): string
return 'PUT';
}

public function setBody($body): PutComponentTemplate
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand All @@ -70,7 +70,7 @@ public function setBody($body): PutComponentTemplate
return $this;
}

public function setName($name): PutComponentTemplate
public function setName($name): static
{
if (isset($name) !== true) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getMethod(): string
return 'PUT';
}

public function setAwarenessAttributeName($awareness_attribute_name): PutDecommissionAwareness
public function setAwarenessAttributeName($awareness_attribute_name): static
{
if (isset($awareness_attribute_name) !== true) {
return $this;
Expand All @@ -62,7 +62,7 @@ public function setAwarenessAttributeName($awareness_attribute_name): PutDecommi
return $this;
}

public function setAwarenessAttributeValue($awareness_attribute_value): PutDecommissionAwareness
public function setAwarenessAttributeValue($awareness_attribute_value): static
{
if (isset($awareness_attribute_value) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/PutSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getMethod(): string
return 'PUT';
}

public function setBody($body): PutSettings
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getMethod(): string
return 'PUT';
}

public function setBody($body): PutWeightedRouting
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand All @@ -60,7 +60,7 @@ public function setBody($body): PutWeightedRouting
return $this;
}

public function setAttribute($attribute): PutWeightedRouting
public function setAttribute($attribute): static
{
if (isset($attribute) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/Reroute.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getMethod(): string
return 'POST';
}

public function setBody($body): Reroute
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getMethod(): string
return 'GET';
}

public function setMetric($metric): State
public function setMetric($metric): static
{
if (isset($metric) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Cluster/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getMethod(): string
return 'GET';
}

public function setNodeId($node_id): Stats
public function setNodeId($node_id): static
{
if (isset($node_id) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getMethod(): string
return isset($this->body) ? 'POST' : 'GET';
}

public function setBody($body): Count
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getMethod(): string
return 'PUT';
}

public function setBody($body): Create
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getMethod(): string
return 'DELETE';
}

public function setIndexUuid($index_uuid): DeleteDanglingIndex
public function setIndexUuid($index_uuid): static
{
if (isset($index_uuid) !== true) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getMethod(): string
return 'POST';
}

public function setIndexUuid($index_uuid): ImportDanglingIndex
public function setIndexUuid($index_uuid): static
{
if (isset($index_uuid) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/DeleteByQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getMethod(): string
return 'POST';
}

public function setBody($body): DeleteByQuery
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getMethod(): string
return 'POST';
}

public function setTaskId($task_id): DeleteByQueryRethrottle
public function setTaskId($task_id): static
{
if (isset($task_id) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/DeletePit.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getMethod(): string
return 'DELETE';
}

public function setBody($body): DeletePit
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Explain.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getMethod(): string
return isset($this->body) ? 'POST' : 'GET';
}

public function setBody($body): Explain
public function setBody($body): static
{
if (isset($body) !== true) {
return $this;
Expand Down
Loading

0 comments on commit 30789e4

Please sign in to comment.