aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/TextToImage/Task.php
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-10-20 13:54:36 +0200
committerMarcel Klehr <mklehr@gmx.net>2023-10-20 13:54:36 +0200
commit9ee72633cf78a777756d2d4afe707f2539521ccc (patch)
tree68a524cfb385a63311cf71003ad433e2b6a76a9f /lib/public/TextToImage/Task.php
parent4c58edc1b7fcc042c1cff1f1123732d8526565be (diff)
downloadnextcloud-server-9ee72633cf78a777756d2d4afe707f2539521ccc.tar.gz
nextcloud-server-9ee72633cf78a777756d2d4afe707f2539521ccc.zip
enh(Text2Image): Expose expected completion time
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/public/TextToImage/Task.php')
-rw-r--r--lib/public/TextToImage/Task.php22
1 files changed, 21 insertions, 1 deletions
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
*/
@@ -125,6 +128,22 @@ final class Task implements \JsonSerializable {
}
/**
+ * @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(),
];
}
}