View
/api/v2/message/view
Post
rooms
jwt
Purpose
To allow a user to mark a sent message as being seen in a chat room that he/she is a member of.
Body Content [input]
{
uid: string,
roomID: string,
messagesID: string[]
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Finds the record from the
rooms
collection corresponding to theroomID
passed [404]. - Ensures that
uid
corresponds to a record in themembers
field of that record with astatus
ofaccepted
[403]. - Loop through all
messages
andthreads
in theroom
and appendsuid
to theirviews
field if theirmessageID
orthreadID
is among the values of themessagesID
field passed and ifuid
is not already appended and ifuid
does not have the same value as that of thesenderID
field of that object.