From 9ee72633cf78a777756d2d4afe707f2539521ccc Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 20 Oct 2023 13:54:36 +0200 Subject: enh(Text2Image): Expose expected completion time Signed-off-by: Marcel Klehr --- lib/public/TextToImage/Task.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/public/TextToImage/Task.php') diff --git a/lib/public/TextToImage/Task.php b/lib/public/TextToImage/Task.php index 2f9869bc55a..20ae32e0f6b 100644 --- a/lib/public/TextToImage/Task.php +++ b/lib/public/TextToImage/Task.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OCP\TextToImage; +use DateTime; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; @@ -39,6 +40,8 @@ use OCP\Image; final class Task implements \JsonSerializable { protected ?int $id = null; + protected DateTime $completionExpectedAt; + /** * @since 28.0.0 */ @@ -124,6 +127,22 @@ final class Task implements \JsonSerializable { $this->status = $status; } + /** + * @param DateTime $at + * @since 28.0.0 + */ + final public function setCompletionExpectedAt(DateTime $at): void { + $this->completionExpectedAt = $at; + } + + /** + * @return DateTime + * @since 28.0.0 + */ + final public function getCompletionExpectedAt(): DateTime { + return $this->completionExpectedAt; + } + /** * @return int|null * @since 28.0.0 @@ -173,7 +192,7 @@ final class Task implements \JsonSerializable { } /** - * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int} + * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int, completionExpectedAt: int} * @since 28.0.0 */ public function jsonSerialize(): array { @@ -185,6 +204,7 @@ final class Task implements \JsonSerializable { 'numberOfImages' => $this->getNumberOfImages(), 'input' => $this->getInput(), 'identifier' => $this->getIdentifier(), + 'completionExpectedAt' => $this->getCompletionExpectedAt()->getTimestamp(), ]; } } -- cgit v1.2.3