Fetch One
/api/v2/room/fetch/one
Post
rooms
jwt
Purpose
To allow a user to fetch a chat room that he/she is a member of or to have some details it if it is otherwise public.
Body Content [input]
{
uid: string,
roomID: string
}
Returns if valid [output]
{
roomID: string,
name: string,
description: string,
privacy: string,
icon: string,
members: {
uid: string,
is_admin: bool,
status: string
}[],
messages: [],
threads: [],
error: 0
}
What the API does
- Finds all records from the
roomscollection. - Filters out all records not having a
uidin themembersfield corresponding to the one passed if they have a value ofprivatefor theirprivacyfield. - Finds the
roombeing referenced using the value of theroomIDfield passed [404]. - Removes the
has_mutedfield for each record in theirmembersfield. - Replaces the value of the
messagefield inmessagesandthreadsby an empty string if the value in theis_deletedfield is set totrue. - Sets empty values for
membersifuiddoes not correspond to a record in themembersfield with astatusofaccepted. - Sets empty values for the
messagesandthreadsfields.