aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/OutOfOfficeData.php11
-rw-r--r--lib/public/User/IOutOfOfficeData.php19
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/private/User/OutOfOfficeData.php b/lib/private/User/OutOfOfficeData.php
index 12b7e03a0ae..72e42afab6a 100644
--- a/lib/private/User/OutOfOfficeData.php
+++ b/lib/private/User/OutOfOfficeData.php
@@ -60,4 +60,15 @@ class OutOfOfficeData implements IOutOfOfficeData {
public function getMessage(): string {
return $this->message;
}
+
+ public function jsonSerialize(): array {
+ return [
+ 'id' => $this->getId(),
+ 'userId' => $this->getUser()->getUID(),
+ 'startDate' => $this->getStartDate(),
+ 'endDate' => $this->getEndDate(),
+ 'shortMessage' => $this->getShortMessage(),
+ 'message' => $this->getMessage(),
+ ];
+ }
}
diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php
index 03444449d58..31281104382 100644
--- a/lib/public/User/IOutOfOfficeData.php
+++ b/lib/public/User/IOutOfOfficeData.php
@@ -25,14 +25,24 @@ declare(strict_types=1);
namespace OCP\User;
+use JsonSerializable;
use OCP\IUser;
/**
* DTO to hold out-of-office information of a user
*
+ * @psalm-type OutOfOfficeData = array{
+ * id: string,
+ * userId: string,
+ * startDate: int,
+ * endDate: int,
+ * shortMessage: string,
+ * message: string,
+ * }
+ *
* @since 28.0.0
*/
-interface IOutOfOfficeData {
+interface IOutOfOfficeData extends JsonSerializable {
/**
* Get the unique token assigned to the current out-of-office event
*
@@ -74,4 +84,11 @@ interface IOutOfOfficeData {
* @since 28.0.0
*/
public function getMessage(): string;
+
+ /**
+ * @return OutOfOfficeData
+ *
+ * @since 28.0.0
+ */
+ public function jsonSerialize(): array;
}