Link Search Menu Expand Document

Fetch

/api/v2/room/fetch

Post

rooms

jwt

pgn


Purpose

To allow a user to fetch chat rooms that he/she is a member of or to have some details about those that are public.

Body Content [input]

{
    uid: string
}

Returns if valid [output]

{
    rooms: {
        roomID: string,
        name: string,
        description: string,
        privacy: string,
        icon: string,
        members: {
            uid: string,
            is_admin: bool,
            status: string
        }[],
        messages: [],
        threads: []
    }[],
    error: 0,
    amount: int
}

What the API does

  • Finds all records from the rooms collection.
  • Filters out all records not having a uid in the members field corresponding to the one passed if they have a value of private for their privacy field.
  • Removes the has_muted field for each record in their members field.
  • Replaces the value of the message field in messages and threads by an empty string if the value in the is_deleted field is set to true.
  • Sets empty values for members if uid does not correspond to a record in the members field with a status of accepted.
  • Sets empty values for the messages and threads fields.