Skip to content

Commit

Permalink
collections & rm doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
derpoho committed Feb 21, 2024
1 parent cb3e2d8 commit ac6dd2c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 95 deletions.
20 changes: 2 additions & 18 deletions src/Requests/Control/ConfigureIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,21 @@ class ConfigureIndex extends Request
{
use HasJsonBody;

/**
* @var Method
*/
protected Method $method = Method::PATCH;

/**
* @param string $name
* @param int $replicas
* @param string $pod_type
*/

public function __construct(
protected string $name,
protected int $replicas,
protected string $pod_type
) {}

/**
* @return string
*/

public function resolveEndpoint(): string
{
return '/indexes/' . $this->name;
}

/**
* @return array
*/
protected function defaultBody(): array
{
return [
Expand All @@ -65,10 +53,6 @@ protected function defaultBody(): array
];
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 202;
Expand Down
15 changes: 1 addition & 14 deletions src/Requests/Control/CreateCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,17 @@ class CreateCollection extends Request
*/
protected Method $method = Method::POST;

/**
* @param string $name
* @param string $source
*/

public function __construct(
protected string $name,
protected string $source,
) {}

/**
* @return string
*/
public function resolveEndpoint(): string
{
return '/collections';
}

/**
* @return array
*/
protected function defaultBody(): array
{
return [
Expand All @@ -58,10 +49,6 @@ protected function defaultBody(): array
];
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 201;
Expand Down
14 changes: 1 addition & 13 deletions src/Requests/Control/DeleteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,18 @@
*/
class DeleteCollection extends Request
{
/**
* @var Method
*/

protected Method $method = Method::DELETE;

/**
* @param string $name
*/
public function __construct(
protected string $name
) {}

/**
* @return string
*/
public function resolveEndpoint(): string
{
return '/collections/' . $this->name;
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 202;
Expand Down
13 changes: 0 additions & 13 deletions src/Requests/Control/DeleteIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,17 @@
*/
class DeleteIndex extends Request
{
/**
* @var Method
*/
protected Method $method = Method::DELETE;

/**
* @param string $name
*/
public function __construct(
protected string $name,
) {}

/**
* @return string
*/
public function resolveEndpoint(): string
{
return '/indexes/' . $this->name;
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 202;
Expand Down
16 changes: 3 additions & 13 deletions src/Requests/Control/DescribeCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,20 @@
*/
class DescribeCollection extends Request
{
/**
* @var Method
*/

protected Method $method = Method::GET;

/**
* @param string $name
*/

public function __construct(
protected string $name
) {}

/**
* @return string
*/

public function resolveEndpoint(): string
{
return '/collections/' . $this->name;
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 200;
Expand Down
14 changes: 1 addition & 13 deletions src/Requests/Control/DescribeIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,18 @@
*/
class DescribeIndex extends Request
{
/**
* @var Method
*/

protected Method $method = Method::GET;

/**
* @param string $name
*/
public function __construct(
protected string $name,
) {}

/**
* @return string
*/
public function resolveEndpoint(): string
{
return '/indexes/' . $this->name;
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 200;
Expand Down
10 changes: 0 additions & 10 deletions src/Requests/Control/ListCollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,13 @@
*/
class ListCollections extends Request
{
/**
* @var Method
*/
protected Method $method = Method::GET;

/**
* @return string
*/
public function resolveEndpoint(): string
{
return '/collections';
}

/**
* @param Response $response
* @return bool|null
*/
public function hasRequestFailed(Response $response): ?bool
{
return $response->status() !== 200;
Expand Down
1 change: 0 additions & 1 deletion src/Requests/Control/ListIndexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ListIndexes extends Request

protected Method $method = Method::GET;


public function resolveEndpoint(): string
{
return '/indexes';
Expand Down

0 comments on commit ac6dd2c

Please sign in to comment.