Documentation: Add last_message to chat docs.
[akkoma] / docs / API / chats.md
index 26e83570e821bc095ae74df316df3bd0c4102617..1f6175f771c93673d50b827b6c0cdd551f79376f 100644 (file)
@@ -62,10 +62,32 @@ Returned data:
     ...
   },
   "id" : "1",
-  "unread" : 2
+  "unread" : 2,
+  "last_message" : {...} // The last message in that chat
 }
 ```
 
+### Marking a chat as read
+
+To set the `unread` count of a chat to 0, call
+
+`POST /api/v1/pleroma/chats/:id/read`
+
+Returned data:
+
+```json
+{
+  "account": {
+    "id": "someflakeid",
+    "username": "somenick",
+    ...
+  },
+  "id" : "1",
+  "unread" : 0
+}
+```
+
+
 ### Getting a list of Chats
 
 `GET /api/v1/pleroma/chats`
@@ -84,7 +106,8 @@ Returned data:
         ...
       },
       "id" : "1",
-      "unread" : 2
+      "unread" : 2,
+      "last_message" : {...} // The last message in that chat
    }
 ]
 ```
@@ -139,6 +162,7 @@ Posting a chat message for given Chat id works like this:
 
 Parameters:
 - content: The text content of the message
+- media_id: The id of an upload that will be attached to the message.
 
 Currently, no formatting beyond basic escaping and emoji is implemented, as well as no
 attachments. This will most probably change.