-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
414: Changes related to the next Meilisearch release (v0.30.0) r=brunoocasali a=meili-bot Related to this issue: meilisearch/integration-guides#221 This PR: - gathers the changes related to the next Meilisearch release (v0.30.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v0.30.0 is out.⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.30.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: Bruno Casali <[email protected]>
- Loading branch information
Showing
17 changed files
with
494 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MeiliSearch\Contracts; | ||
|
||
use MeiliSearch\Delegates\TasksQueryTrait; | ||
|
||
class CancelTasksQuery | ||
{ | ||
use TasksQueryTrait; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MeiliSearch\Contracts; | ||
|
||
use MeiliSearch\Delegates\TasksQueryTrait; | ||
|
||
class DeleteTasksQuery | ||
{ | ||
use TasksQueryTrait; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MeiliSearch\Delegates; | ||
|
||
trait TasksQueryTrait | ||
{ | ||
private int $next; | ||
private array $types; | ||
private array $statuses; | ||
private array $indexUids; | ||
private array $uids; | ||
private array $canceledBy; | ||
private \DateTime $beforeEnqueuedAt; | ||
private \DateTime $afterEnqueuedAt; | ||
private \DateTime $beforeStartedAt; | ||
private \DateTime $afterStartedAt; | ||
private \DateTime $beforeFinishedAt; | ||
private \DateTime $afterFinishedAt; | ||
|
||
public function setNext(int $next) | ||
{ | ||
$this->next = $next; | ||
|
||
return $this; | ||
} | ||
|
||
public function setTypes(array $types) | ||
{ | ||
$this->types = $types; | ||
|
||
return $this; | ||
} | ||
|
||
public function setStatuses(array $statuses) | ||
{ | ||
$this->statuses = $statuses; | ||
|
||
return $this; | ||
} | ||
|
||
public function setIndexUids(array $indexUids) | ||
{ | ||
$this->indexUids = $indexUids; | ||
|
||
return $this; | ||
} | ||
|
||
public function getIndexUids(): array | ||
{ | ||
return $this->indexUids ?? []; | ||
} | ||
|
||
public function setUids(array $uids) | ||
{ | ||
$this->uids = $uids; | ||
|
||
return $this; | ||
} | ||
|
||
public function setCanceledBy(array $canceledBy) | ||
{ | ||
$this->canceledBy = $canceledBy; | ||
|
||
return $this; | ||
} | ||
|
||
public function setBeforeEnqueuedAt(\DateTime $date) | ||
{ | ||
$this->beforeEnqueuedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function setAfterEnqueuedAt(\DateTime $date) | ||
{ | ||
$this->afterEnqueuedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function setBeforeStartedAt(\DateTime $date) | ||
{ | ||
$this->beforeStartedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function setAfterStartedAt(\DateTime $date) | ||
{ | ||
$this->afterStartedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function setBeforeFinishedAt(\DateTime $date) | ||
{ | ||
$this->beforeFinishedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function setAfterFinishedAt(\DateTime $date) | ||
{ | ||
$this->afterFinishedAt = $date; | ||
|
||
return $this; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return array_filter([ | ||
'next' => $this->next ?? null, | ||
'beforeEnqueuedAt' => $this->formatDate($this->beforeEnqueuedAt ?? null), | ||
'afterEnqueuedAt' => $this->formatDate($this->afterEnqueuedAt ?? null), | ||
'beforeStartedAt' => $this->formatDate($this->beforeStartedAt ?? null), | ||
'afterStartedAt' => $this->formatDate($this->afterStartedAt ?? null), | ||
'beforeFinishedAt' => $this->formatDate($this->beforeFinishedAt ?? null), | ||
'afterFinishedAt' => $this->formatDate($this->afterFinishedAt ?? null), | ||
'statuses' => $this->formatArray($this->statuses ?? null), | ||
'uids' => $this->formatArray($this->uids ?? null), | ||
'canceledBy' => $this->formatArray($this->canceledBy ?? null), | ||
'types' => $this->formatArray($this->types ?? null), | ||
'indexUids' => $this->formatArray($this->indexUids ?? null), | ||
], function ($item) { return null != $item || is_numeric($item); }); | ||
} | ||
|
||
private function formatDate(?\DateTime $date) | ||
{ | ||
return isset($date) ? $date->format(\DateTime::RFC3339) : null; | ||
} | ||
|
||
private function formatArray(?array $arr) | ||
{ | ||
return isset($arr) ? implode(',', $arr) : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.