summaryrefslogtreecommitdiffstats
path: root/docs/avatar.md
blob: 8b748e38fd8fe69c7bfbf918548cc5d4d9df4c8b (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
# Conversation avatar API

* API v1: Base endpoint `/ocs/v2.php/apps/spreed/api/v1`: since Nextcloud 27

## Set conversations avatar

* Required capability: `avatar`
* Method: `POST`
* Endpoint: `/room/{token}/avatar`
* Data:

| field  | type   | Description                                                                                                                         |
|--------|--------|-------------------------------------------------------------------------------------------------------------------------------------|
| `file` | string | Blob of image in a multipart/form-data request. Only accept images with mimetype equal to PNG or JPEG and need to be squared image. |

* Response:
    - Status code:
        + `200 OK`
        + `400 Bad Request` When: is one-to-one, no image, file is too big, invalid mimetype or resource, isn't square, unknown error
        + `403 Forbidden` When the current user is not a moderator, owner or guest moderator
        + `404 Not Found` When the conversation could not be found for the participant

    - Data: See array definition in `Get user´s conversations`

## Delete conversations avatar

* Required capability: `avatar`
* Method: `DELETE`
* Endpoint: `/room/{token}/avatar`

* Response:
    - Status code:
        + `200 OK`
        + `403 Forbidden` When the current user is not a moderator, owner or guest moderator
        + `404 Not Found` When the conversation could not be found for the participant

    - Data: See array definition in `Get user´s conversations`

## Get conversations avatar (binary)

* Required capability: `avatar`
* Method: `GET`
* Endpoint: `/room/{token}/avatar`

* Response:
    - Status code:
        + `200 OK`
        + `404 Not Found` When the conversation could not be found for the participant
    - Header:

| field               | type   | Description                                                       |
| ------------------- | ------ | ----------------------------------------------------------------- |
| X-NC-IsCustomAvatar | string | Return 1 when is custom avatar and 0 when is not a custom a vatar |

    - Body: the image file

## Get dark mode conversations avatar (binary)

* Required capability: `avatar`
* Method: `GET`
* Endpoint: `/room/{token}/avatar/dark`

* Response:
    - Status code:
        + `200 OK`
        + `404 Not Found` When the conversation could not be found for the participant
    - Body: the image file