feat: dev-docs out of office replacement

Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
This commit is contained in:
Hamza Mahjoubi
2024-06-27 01:25:50 +02:00
parent 27ec411dc3
commit 0228c19a77
2 changed files with 85 additions and 56 deletions

View File

@@ -27,21 +27,25 @@ Fetch data of the ongoing out-of-office period of a user.
+ ``404 Not Found`` If the user does not have an ongoing out-of-office period
- Data (is only sent if the status code is ``200 OK``):
+--------------+--------+---------------------------------------------------------------------+
| field | type | Description |
+--------------+--------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+--------------+--------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+--------------+--------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+--------------+--------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+--------------+--------+---------------------------------------------------------------------+
+---------------------------------+-------------+---------------------------------------------------------------------+
| field | type | Description |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserId`` | string/null | ID of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserDisplayName`` | string/null | Displayname of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
Fetch upcoming or ongoing data
------------------------------
@@ -57,21 +61,25 @@ ongoing or next upcoming out-of-office period of a user.
+ ``404 Not Found`` If the user did not schedule an out-of-office period
- Data (is only sent if the status code is ``200 OK``):
+--------------+--------+---------------------------------------------------------------------+
| field | type | Description |
+--------------+--------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+--------------+--------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+--------------+--------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+--------------+--------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+--------------+--------+---------------------------------------------------------------------+
+---------------------------------+-------------+---------------------------------------------------------------------+
| field | type | Description |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserId`` | string/null | ID of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserDisplayName`` | string/null | Displayname of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
Modify out-of-office data
-------------------------
@@ -82,40 +90,49 @@ It is only possible to modify out-of-office data of the currently logged in user
* Endpoint: ``/``
* Data:
+--------------+--------+---------------------------------------------------------------------+
| field | type | Description |
+--------------+--------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+--------------+--------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+--------------+--------+---------------------------------------------------------------------+
+---------------------------------+-------------+---------------------------------------------------------------------+
| field | type | Description |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserId`` | string/null | ID of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserDisplayName`` | string/null | Displayname of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
* Response:
- Status code:
+ ``200 OK`` Updated out-of-office data
+ ``400 Bad Request`` If the first day is not before the last day
+ ``404 Not Found`` If a replacement user ID is provided but no corresponding user is found
+ ``401 Unauthorized`` If the user is not logged in
- Data (is only sent if the status code is ``200 OK``):
+--------------+--------+---------------------------------------------------------------------+
| field | type | Description |
+--------------+--------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+--------------+--------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+--------------+--------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+--------------+--------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+--------------+--------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+--------------+--------+---------------------------------------------------------------------+
+---------------------------------+-------------+---------------------------------------------------------------------+
| field | type | Description |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``id`` | int | Database ID of the absence data entity |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``userId`` | string | ID of the user which the data belongs to |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``firstDay`` | string | First day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``lastDay`` | string | Last day of the absence in format ``YYYY-MM-DD`` |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``status`` | string | Short text that is set as user status during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``message`` | string | Longer multiline message that is shown to others during the absence |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserId`` | string/null | ID of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
| ``replacementUserDisplayName`` | string/null | Displayname of the replacement user |
+---------------------------------+-------------+---------------------------------------------------------------------+
Clear data and disable out-of-office
------------------------------------

View File

@@ -102,6 +102,16 @@ start and end dates are represented as UNIX timestamps.
* Get the long out-of-office message for auto responders and similar
*/
public function getMessage(): string;
/**
* Get the replacement user id for auto responders and similar
*/
public function getReplacementUserId(): ?string;
/**
* Get the replacement user displayName for auto responders and similar
*/
public function getReplacementUserDisplayName(): ?string;
}
It can be serialized to a JSON object with the following structure:
@@ -115,4 +125,6 @@ It can be serialized to a JSON object with the following structure:
endDate: int,
shortMessage: string,
message: string,
replacementUserId: string|null,
replacementUserDisplayName: string|null
}