summaryrefslogtreecommitdiffstats
path: root/docs/reaction.md
blob: 1373c249fbc84b30232ca24eea367b55f55c451e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Reaction API

Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1`: since Nextcloud 24

## React to a message

* Required capability: `reactions`
* Federation capability: `federation-v1`
* Method: `POST`
* Endpoint: `/reaction/{token}/{messageId}`
* Data:

| field      | type   | Description        |
|------------|--------|--------------------|
| `reaction` | string | the reaction emoji |

* Response:
    - Status code:
        + `200 OK` Reaction already exists
        + `201 Created` User reacted with a new reaction
        + `400 Bad Request` In case of no reaction support, message out of reactions context or any other error
        + `404 Not Found` When the conversation or message to react could not be found for the participant

    - Data:
        Array with data of reactions:

| field              | type   | Description                            |
|--------------------|--------|----------------------------------------|
| `actorType`        | string | `guests` or `users`                    |
| `actorId`          | string | Actor id of the reacting participant   |
| `actorDisplayName` | string | Display name of the reaction author    |
| `timestamp`        | int    | Timestamp in seconds and UTC time zone |

## Delete a reaction

* Required capability: `reactions`
* Federation capability: `federation-v1`
* Method: `DELETE`
* Endpoint: `/reaction/{token}/{messageId}`
* Data:

| field      | type   | Description        |
|------------|--------|--------------------|
| `reaction` | string | the reaction emoji |

* Response:
    - Status code:
        + `201 Created`
        + `400 Bad Request` In case of no reaction support, message out of reactions context or any other error
        + `404 Not Found` When the conversation or message to react or reaction could not be found for the participant

    - Data:
        Array with data of reactions:

| field              | type   | Description                            |
|--------------------|--------|----------------------------------------|
| `actorType`        | string | `guests` or `users`                    |
| `actorId`          | string | Actor id of the reacting participant   |
| `actorDisplayName` | string | Display name of the reaction author    |
| `timestamp`        | int    | Timestamp in seconds and UTC time zone |

## Retrieve reactions of a message by type

* Required capability: `reactions`
* Federation capability: `federation-v1`
* Method: `GET`
* Endpoint: `/reaction/{token}/{messageId}`
* Data:

| field      | type   | Description                      |
|------------|--------|----------------------------------|
| `reaction` | string | **Optional:** the reaction emoji |

* Response:
    - Status code:
        + `200 OK`
        + `400 Bad Request` In case of no reaction support, message out of reactions context or any other error
        + `404 Not Found` When the conversation or message to react could not be found for the participant

    - Data:
        Array with data of reactions:

| field              | type   | Description                            |
|--------------------|--------|----------------------------------------|
| `actorType`        | string | `guests` or `users`                    |
| `actorId`          | string | Actor id of the reacting participant   |
| `actorDisplayName` | string | Display name of the reaction author    |
| `timestamp`        | int    | Timestamp in seconds and UTC time zone |