Skip to content

Rooms

Endpoints

Rooms

Rooms Endpoints API

Source code in matrix_admin_sdk/endpoints/v1/rooms.py
class Rooms(Endpoint):
    """
    Rooms Endpoints API
    """

    async def list_rooms(
        self,
        from_: int = 0,
        limit: int = 100,
        order_by: Optional[OrderBy] = None,
        dir_: str = "f",
        search_term: Optional[str] = None,
    ) -> RoomsModel:
        """
        The List Room admin API allows server admins to get a list of rooms on
        their server. There are various parameters available that allow for
        filtering and sorting the returned list. This API supports pagination.

        Args:
            from_: Offset in the returned list. Defaults to 0
            limit: Maximum amount of rooms to return. Defaults to 100.
            order_by: The method in which to sort the returned list of rooms.
                Defaults to OrderBy.NAME.
            dir_: Direction of room order. Either f for forwards or b for backwards.
                Setting this value to b will reverse the above sort order. Defaults to f
            search_term: Filter rooms by their room name, canonical alias and
                room id. Specifically, rooms are selected if the search term is
                contained in: the room's name, the local part of the room's canonical alias,
                or the complete (local and server part) room's id (case sensitive).
                Defaults to no filtering.

        Returns:

        """
        if order_by is None:
            order_by = OrderBy.NAME
        if dir_ not in ("f", "b"):
            raise ValueError("dir_ must be either f or b")

        url = self.url("rooms")
        params = {
            "from": from_,
            "limit": limit,
            "order_by": order_by.value,
            "dir": dir_,
        }
        if search_term is not None:
            params["search_term"] = search_term

        result = await self.request(RequestMethods.GET, url, params=params)
        return RoomsModel.from_dict(result)

    async def room_details(self, room_id: str) -> RoomModel:
        """
        The Room Details admin API allows server admins to get all details of a room.
        Args:
            room_id: The room id to get details for.

        Returns:

        """
        url = self.url(f"rooms/{room_id}")
        result = await self.request(RequestMethods.GET, url)
        res: RoomModel = RoomModel.from_dict(result)
        return res

    async def room_members(self, room_id: str) -> RoomMembersModel:
        """
        The Room Members admin API allows server admins to get a list of all
        members of a room.
        Args:
            room_id: The room id to get details for.

        Returns: RoomMembersModel

        """
        url = self.url(f"rooms/{room_id}/members")
        result = await self.request(RequestMethods.GET, url)
        res: RoomMembersModel = RoomMembersModel.from_dict(result)
        return res

    async def room_state(self, room_id: str) -> List[RoomStateModel]:
        """
        The Room State admin API allows server admins to get a list of all state
        events in a room.
        Args:
            room_id: room id to get state for

        Returns: list of RoomStateModel

        """
        url = self.url(f"rooms/{room_id}/state")
        result = await self.request(RequestMethods.GET, url)
        res: List[RoomStateModel] = [
            RoomStateModel.from_dict(i) for i in result["state"]
        ]
        return res

    async def block_room(self, room_id: str, block: bool) -> Dict[str, bool]:
        """
        The Block Room admin API allows server admins to block and unblock rooms,
        and query to see if a given room is blocked. This API can be used to
        pre-emptively block a room, even if it's unknown to this homeserver.
        Users will be prevented from joining a blocked room.
        Args:
            room_id: The room id to block.
            block: If True the room will be blocked and if False the room will
                be unblocked.

        Returns: dictionary

        """
        url = self.url(f"rooms/{room_id}/block")
        data = {"block": block}
        result = await self.request(RequestMethods.PUT, url, json=data)
        return result

    async def get_block_status(self, room_id: str) -> BlockStatusModel:
        """
        Is room blocked
        Args:
            room_id: The room id to checking

        Returns: BlockStatusModel

        """
        url = self.url(f"rooms/{room_id}/block")
        result = await self.request(RequestMethods.GET, url)
        res: BlockStatusModel = BlockStatusModel.from_dict(result)
        return res

    async def delete_room(
        self,
        room_id: str,
        new_room_user_id: Optional[str] = None,
        room_name: str = "Content Violation Notification",
        message: str = "Sharing illegal content on this server is not permitted and rooms in violation will be blocked",
        block: bool = False,
        purge: bool = True,
        force_purge: bool = False,
    ) -> DeletedRoomModel:
        """
        The Delete Room admin API allows server admins to remove rooms from the
        server and block these rooms.

        Shuts down a room. Moves all local users and room aliases automatically
        to a new room if new_room_user_id is set. Otherwise local users only
        leave the room without any information.

        The new room will be created with the user specified by the new_room_user_id
        parameter as room administrator and will contain a message explaining
        what happened. Users invited to the new room will have power level -10
        by default, and thus be unable to speak.

        If block is true, users will be prevented from joining the old room.
        This option can in sync version also be used to pre-emptively block a room,
        even if it's unknown to this homeserver. In this case, the room will be
        blocked, and no further action will be taken. If block is false,
        attempting to delete an unknown room is invalid and will be rejected
        as a bad request.

        This API will remove all trace of the old room from your database after
        removing all local users. If purge is true (the default), all traces
        of the old room will be removed from your database after removing all
        local users. If you do not want this to happen, set purge to false.
        Depending on the amount of history being purged, a call to the API may
        take several minutes or longer.

        The local server will only have the power to move local user and room
        aliases to the new room. Users on other servers will be unaffected.

        This version works synchronously. That means you only get the response
        once the server has finished the action, which may take a long time.
        If you request the same action a second time, and the server has not
        finished the first one, the second request will block. This is fixed
        in version 2 of this API. The parameters are the same in both APIs.
        This API will become deprecated in the future.

        Args:
            room_id: The room id to delete
            new_room_user_id: If set, a new room will be created with this user
                ID as the creator and admin, and all users in the old room will be
                moved into that room. If not set, no new room will be created and
                the users will just be removed from the old room. The user ID must be
                on the local server, but does not necessarily have to belong to a
                registered user.
            room_name: A string representing the name of the room that new users
                will be invited to. Defaults to Content Violation Notification
            message: A string containing the first message that will be sent as
                new_room_user_id in the new room. Ideally this will clearly convey
                why the original room was shut down. Defaults to Sharing illegal
                content on this server is not permitted and rooms in violation will
                be blocked.
            block: If set to true, this room will be added to a blocking list,
                preventing future attempts to join the room. Rooms can be blocked
                even if they're not yet known to the homeserver (only with Version
                1 of the API). Defaults to false.
            purge: If set to true, it will remove all traces of the room from
                your database. Defaults to true.
            force_purge: Optional, and ignored unless purge is true. If set to
                true, it will force a purge to go ahead even if there are local
                users still in the room. Do not use this unless a regular purge
                operation fails, as it could leave those users' clients in a
                confused state.

        Returns:

        """
        url = self.url(f"rooms/{room_id}")
        data = {
            new_room_user_id: new_room_user_id,
            room_name: room_name,
            message: message,
            block: block,
            purge: purge,
            force_purge: force_purge,
        }
        result = await self.request(RequestMethods.DELETE, url, json=data)
        res: DeletedRoomModel = DeletedRoomModel.from_dict(result)
        return res

    async def make_room_admin(self, room_id_or_alias: str, user_id: str) -> None:
        """
        Grants another user the highest power available to a local user who is
        in the room. If the user is not in the room, and it is not publicly
        joinable, then invite the user.

        By default the server admin (the caller) is granted power, but another
        user can optionally be specified
        Args:
            room_id_or_alias: The room id or alias to make new admin
            user_id: The user id to make admin
        Returns:

        """
        url = self.url(f"rooms/{room_id_or_alias}/make_room_admin")
        data = {"user_id": user_id}
        await self.request(RequestMethods.POST, url, json=data)
        return None

    async def event_context(self, room_id: str, event_id: str) -> Dict[str, Any]:
        """
        This API lets a client find the context of an event. This is designed
        primarily to investigate abuse reports.
        Args:
            room_id:
            event_id:

        Returns:

        """
        raise NotImplementedError("This API is not yet implemented")

block_room(self, room_id, block) async

The Block Room admin API allows server admins to block and unblock rooms, and query to see if a given room is blocked. This API can be used to pre-emptively block a room, even if it's unknown to this homeserver. Users will be prevented from joining a blocked room.

Parameters:

Name Type Description Default
room_id str

The room id to block.

required
block bool

If True the room will be blocked and if False the room will be unblocked.

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def block_room(self, room_id: str, block: bool) -> Dict[str, bool]:
    """
    The Block Room admin API allows server admins to block and unblock rooms,
    and query to see if a given room is blocked. This API can be used to
    pre-emptively block a room, even if it's unknown to this homeserver.
    Users will be prevented from joining a blocked room.
    Args:
        room_id: The room id to block.
        block: If True the room will be blocked and if False the room will
            be unblocked.

    Returns: dictionary

    """
    url = self.url(f"rooms/{room_id}/block")
    data = {"block": block}
    result = await self.request(RequestMethods.PUT, url, json=data)
    return result

delete_room(self, room_id, new_room_user_id=None, room_name='Content Violation Notification', message='Sharing illegal content on this server is not permitted and rooms in violation will be blocked', block=False, purge=True, force_purge=False) async

The Delete Room admin API allows server admins to remove rooms from the server and block these rooms.

Shuts down a room. Moves all local users and room aliases automatically to a new room if new_room_user_id is set. Otherwise local users only leave the room without any information.

The new room will be created with the user specified by the new_room_user_id parameter as room administrator and will contain a message explaining what happened. Users invited to the new room will have power level -10 by default, and thus be unable to speak.

If block is true, users will be prevented from joining the old room. This option can in sync version also be used to pre-emptively block a room, even if it's unknown to this homeserver. In this case, the room will be blocked, and no further action will be taken. If block is false, attempting to delete an unknown room is invalid and will be rejected as a bad request.

This API will remove all trace of the old room from your database after removing all local users. If purge is true (the default), all traces of the old room will be removed from your database after removing all local users. If you do not want this to happen, set purge to false. Depending on the amount of history being purged, a call to the API may take several minutes or longer.

The local server will only have the power to move local user and room aliases to the new room. Users on other servers will be unaffected.

This version works synchronously. That means you only get the response once the server has finished the action, which may take a long time. If you request the same action a second time, and the server has not finished the first one, the second request will block. This is fixed in version 2 of this API. The parameters are the same in both APIs. This API will become deprecated in the future.

Parameters:

Name Type Description Default
room_id str

The room id to delete

required
new_room_user_id Optional[str]

If set, a new room will be created with this user ID as the creator and admin, and all users in the old room will be moved into that room. If not set, no new room will be created and the users will just be removed from the old room. The user ID must be on the local server, but does not necessarily have to belong to a registered user.

None
room_name str

A string representing the name of the room that new users will be invited to. Defaults to Content Violation Notification

'Content Violation Notification'
message str

A string containing the first message that will be sent as new_room_user_id in the new room. Ideally this will clearly convey why the original room was shut down. Defaults to Sharing illegal content on this server is not permitted and rooms in violation will be blocked.

'Sharing illegal content on this server is not permitted and rooms in violation will be blocked'
block bool

If set to true, this room will be added to a blocking list, preventing future attempts to join the room. Rooms can be blocked even if they're not yet known to the homeserver (only with Version 1 of the API). Defaults to false.

False
purge bool

If set to true, it will remove all traces of the room from your database. Defaults to true.

True
force_purge bool

Optional, and ignored unless purge is true. If set to true, it will force a purge to go ahead even if there are local users still in the room. Do not use this unless a regular purge operation fails, as it could leave those users' clients in a confused state.

False
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def delete_room(
    self,
    room_id: str,
    new_room_user_id: Optional[str] = None,
    room_name: str = "Content Violation Notification",
    message: str = "Sharing illegal content on this server is not permitted and rooms in violation will be blocked",
    block: bool = False,
    purge: bool = True,
    force_purge: bool = False,
) -> DeletedRoomModel:
    """
    The Delete Room admin API allows server admins to remove rooms from the
    server and block these rooms.

    Shuts down a room. Moves all local users and room aliases automatically
    to a new room if new_room_user_id is set. Otherwise local users only
    leave the room without any information.

    The new room will be created with the user specified by the new_room_user_id
    parameter as room administrator and will contain a message explaining
    what happened. Users invited to the new room will have power level -10
    by default, and thus be unable to speak.

    If block is true, users will be prevented from joining the old room.
    This option can in sync version also be used to pre-emptively block a room,
    even if it's unknown to this homeserver. In this case, the room will be
    blocked, and no further action will be taken. If block is false,
    attempting to delete an unknown room is invalid and will be rejected
    as a bad request.

    This API will remove all trace of the old room from your database after
    removing all local users. If purge is true (the default), all traces
    of the old room will be removed from your database after removing all
    local users. If you do not want this to happen, set purge to false.
    Depending on the amount of history being purged, a call to the API may
    take several minutes or longer.

    The local server will only have the power to move local user and room
    aliases to the new room. Users on other servers will be unaffected.

    This version works synchronously. That means you only get the response
    once the server has finished the action, which may take a long time.
    If you request the same action a second time, and the server has not
    finished the first one, the second request will block. This is fixed
    in version 2 of this API. The parameters are the same in both APIs.
    This API will become deprecated in the future.

    Args:
        room_id: The room id to delete
        new_room_user_id: If set, a new room will be created with this user
            ID as the creator and admin, and all users in the old room will be
            moved into that room. If not set, no new room will be created and
            the users will just be removed from the old room. The user ID must be
            on the local server, but does not necessarily have to belong to a
            registered user.
        room_name: A string representing the name of the room that new users
            will be invited to. Defaults to Content Violation Notification
        message: A string containing the first message that will be sent as
            new_room_user_id in the new room. Ideally this will clearly convey
            why the original room was shut down. Defaults to Sharing illegal
            content on this server is not permitted and rooms in violation will
            be blocked.
        block: If set to true, this room will be added to a blocking list,
            preventing future attempts to join the room. Rooms can be blocked
            even if they're not yet known to the homeserver (only with Version
            1 of the API). Defaults to false.
        purge: If set to true, it will remove all traces of the room from
            your database. Defaults to true.
        force_purge: Optional, and ignored unless purge is true. If set to
            true, it will force a purge to go ahead even if there are local
            users still in the room. Do not use this unless a regular purge
            operation fails, as it could leave those users' clients in a
            confused state.

    Returns:

    """
    url = self.url(f"rooms/{room_id}")
    data = {
        new_room_user_id: new_room_user_id,
        room_name: room_name,
        message: message,
        block: block,
        purge: purge,
        force_purge: force_purge,
    }
    result = await self.request(RequestMethods.DELETE, url, json=data)
    res: DeletedRoomModel = DeletedRoomModel.from_dict(result)
    return res

event_context(self, room_id, event_id) async

This API lets a client find the context of an event. This is designed primarily to investigate abuse reports.

Parameters:

Name Type Description Default
room_id str required
event_id str required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def event_context(self, room_id: str, event_id: str) -> Dict[str, Any]:
    """
    This API lets a client find the context of an event. This is designed
    primarily to investigate abuse reports.
    Args:
        room_id:
        event_id:

    Returns:

    """
    raise NotImplementedError("This API is not yet implemented")

get_block_status(self, room_id) async

Is room blocked

Parameters:

Name Type Description Default
room_id str

The room id to checking

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def get_block_status(self, room_id: str) -> BlockStatusModel:
    """
    Is room blocked
    Args:
        room_id: The room id to checking

    Returns: BlockStatusModel

    """
    url = self.url(f"rooms/{room_id}/block")
    result = await self.request(RequestMethods.GET, url)
    res: BlockStatusModel = BlockStatusModel.from_dict(result)
    return res

list_rooms(self, from_=0, limit=100, order_by=None, dir_='f', search_term=None) async

The List Room admin API allows server admins to get a list of rooms on their server. There are various parameters available that allow for filtering and sorting the returned list. This API supports pagination.

Parameters:

Name Type Description Default
from_ int

Offset in the returned list. Defaults to 0

0
limit int

Maximum amount of rooms to return. Defaults to 100.

100
order_by Optional[matrix_admin_sdk.endpoints.v1.rooms.OrderBy]

The method in which to sort the returned list of rooms. Defaults to OrderBy.NAME.

None
dir_ str

Direction of room order. Either f for forwards or b for backwards. Setting this value to b will reverse the above sort order. Defaults to f

'f'
search_term Optional[str]

Filter rooms by their room name, canonical alias and room id. Specifically, rooms are selected if the search term is contained in: the room's name, the local part of the room's canonical alias, or the complete (local and server part) room's id (case sensitive). Defaults to no filtering.

None
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def list_rooms(
    self,
    from_: int = 0,
    limit: int = 100,
    order_by: Optional[OrderBy] = None,
    dir_: str = "f",
    search_term: Optional[str] = None,
) -> RoomsModel:
    """
    The List Room admin API allows server admins to get a list of rooms on
    their server. There are various parameters available that allow for
    filtering and sorting the returned list. This API supports pagination.

    Args:
        from_: Offset in the returned list. Defaults to 0
        limit: Maximum amount of rooms to return. Defaults to 100.
        order_by: The method in which to sort the returned list of rooms.
            Defaults to OrderBy.NAME.
        dir_: Direction of room order. Either f for forwards or b for backwards.
            Setting this value to b will reverse the above sort order. Defaults to f
        search_term: Filter rooms by their room name, canonical alias and
            room id. Specifically, rooms are selected if the search term is
            contained in: the room's name, the local part of the room's canonical alias,
            or the complete (local and server part) room's id (case sensitive).
            Defaults to no filtering.

    Returns:

    """
    if order_by is None:
        order_by = OrderBy.NAME
    if dir_ not in ("f", "b"):
        raise ValueError("dir_ must be either f or b")

    url = self.url("rooms")
    params = {
        "from": from_,
        "limit": limit,
        "order_by": order_by.value,
        "dir": dir_,
    }
    if search_term is not None:
        params["search_term"] = search_term

    result = await self.request(RequestMethods.GET, url, params=params)
    return RoomsModel.from_dict(result)

make_room_admin(self, room_id_or_alias, user_id) async

Grants another user the highest power available to a local user who is in the room. If the user is not in the room, and it is not publicly joinable, then invite the user.

By default the server admin (the caller) is granted power, but another user can optionally be specified

Parameters:

Name Type Description Default
room_id_or_alias str

The room id or alias to make new admin

required
user_id str

The user id to make admin

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def make_room_admin(self, room_id_or_alias: str, user_id: str) -> None:
    """
    Grants another user the highest power available to a local user who is
    in the room. If the user is not in the room, and it is not publicly
    joinable, then invite the user.

    By default the server admin (the caller) is granted power, but another
    user can optionally be specified
    Args:
        room_id_or_alias: The room id or alias to make new admin
        user_id: The user id to make admin
    Returns:

    """
    url = self.url(f"rooms/{room_id_or_alias}/make_room_admin")
    data = {"user_id": user_id}
    await self.request(RequestMethods.POST, url, json=data)
    return None

room_details(self, room_id) async

The Room Details admin API allows server admins to get all details of a room.

Parameters:

Name Type Description Default
room_id str

The room id to get details for.

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def room_details(self, room_id: str) -> RoomModel:
    """
    The Room Details admin API allows server admins to get all details of a room.
    Args:
        room_id: The room id to get details for.

    Returns:

    """
    url = self.url(f"rooms/{room_id}")
    result = await self.request(RequestMethods.GET, url)
    res: RoomModel = RoomModel.from_dict(result)
    return res

room_members(self, room_id) async

The Room Members admin API allows server admins to get a list of all members of a room.

Parameters:

Name Type Description Default
room_id str

The room id to get details for.

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def room_members(self, room_id: str) -> RoomMembersModel:
    """
    The Room Members admin API allows server admins to get a list of all
    members of a room.
    Args:
        room_id: The room id to get details for.

    Returns: RoomMembersModel

    """
    url = self.url(f"rooms/{room_id}/members")
    result = await self.request(RequestMethods.GET, url)
    res: RoomMembersModel = RoomMembersModel.from_dict(result)
    return res

room_state(self, room_id) async

The Room State admin API allows server admins to get a list of all state events in a room.

Parameters:

Name Type Description Default
room_id str

room id to get state for

required
Source code in matrix_admin_sdk/endpoints/v1/rooms.py
async def room_state(self, room_id: str) -> List[RoomStateModel]:
    """
    The Room State admin API allows server admins to get a list of all state
    events in a room.
    Args:
        room_id: room id to get state for

    Returns: list of RoomStateModel

    """
    url = self.url(f"rooms/{room_id}/state")
    result = await self.request(RequestMethods.GET, url)
    res: List[RoomStateModel] = [
        RoomStateModel.from_dict(i) for i in result["state"]
    ]
    return res

Models

RoomsModel

Rooms model

Attributes:

Name Type Description
rooms list[Room]

An array of objects, each containing information about a room

offset int

The offset of the first room in the list.

total_rooms int

The total number of rooms.

next_batch str|None

The token to get the next batch of rooms.

prev_batch str|None

The token to get the previous batch of rooms.

Source code in matrix_admin_sdk/models/v1/rooms.py
class RoomsModel(BaseModel):
    """
    Rooms model
    Attributes:
        rooms (list[Room]): An array of objects, each containing information about a room
        offset (int): The offset of the first room in the list.
        total_rooms (int): The total number of rooms.
        next_batch (str|None): The token to get the next batch of rooms.
        prev_batch (str|None): The token to get the previous batch of rooms.
    """

    rooms: List[RoomModel]
    offset: int
    total_rooms: int
    next_batch: Optional[str] = None
    prev_batch: Optional[str] = None

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "RoomsModel":
        data = data.copy()
        rooms: List[RoomModel] = [RoomModel.from_dict(room) for room in data["rooms"]]
        del data["rooms"]
        return cls(**data, rooms=rooms)

RoomModel

Room model

Attributes:

Name Type Description
room_id str

The ID of the room.

name str
  • The name of the room.
canonical_alias str

The canonical (main) alias address of the room.

joined_members int

How many users are currently in the room.

joined_local_members int

How many local users are currently in the room.

version str

The version of the room as a string.

creator str

The user_id of the room creator.

encryption str|None

Algorithm of end-to-end encryption of messages. Is null if encryption is not active.

federatable bool

Whether users on other servers can join this room.

public bool

Whether the room is visible in room directory.

join_rules str

The type of rules used for users wishing to join this room. One of: ["public", "knock", "invite", "private"].

guest_access str|None

Whether guests can join the room. One of: ["can_join", "forbidden"].

history_visibility str

Who can see the room history. One of: ["invited", "joined", "shared", "world_readable"].

state_events int

Total number of state_events of a room. Complexity of the room.

Source code in matrix_admin_sdk/models/v1/rooms.py
class RoomModel(BaseModel):
    """
    Room model
    Attributes:
        room_id (str): The ID of the room.
        name (str): - The name of the room.
        canonical_alias (str): The canonical (main) alias address of the room.
        joined_members (int): How many users are currently in the room.
        joined_local_members (int): How many local users are currently in the room.
        version (str): The version of the room as a string.
        creator (str): The user_id of the room creator.
        encryption (str|None): Algorithm of end-to-end encryption of messages. Is null if encryption is not active.
        federatable (bool): Whether users on other servers can join this room.
        public (bool): Whether the room is visible in room directory.
        join_rules (str): The type of rules used for users wishing to join this room. One of: ["public", "knock", "invite", "private"].
        guest_access (str|None):  Whether guests can join the room. One of: ["can_join", "forbidden"].
        history_visibility (str): Who can see the room history. One of: ["invited", "joined", "shared", "world_readable"].
        state_events (int): Total number of state_events of a room. Complexity of the room.
    """

    room_id: str
    name: str
    canonical_alias: str
    joined_members: int
    joined_local_members: int
    version: str
    creator: str
    encryption: Optional[str]
    federatable: bool
    public: bool
    join_rules: str
    guest_access: Optional[str]
    history_visibility: str
    state_events: int

RoomMembersModel

RoomMembersModel(members: List[str], total: int)

Source code in matrix_admin_sdk/models/v1/rooms.py
class RoomMembersModel(BaseModel):
    members: List[str]
    total: int

RoomStateModel

Room state model Attributes type (str): state_key (str): etc (bool):

Source code in matrix_admin_sdk/models/v1/rooms.py
class RoomStateModel(BaseModel):
    """
    Room state model
    Attributes
        type (str):
        state_key (str):
        etc (bool):
    """

    type: str
    state_key: str
    etc: bool

BlockStatusModel

Block status model

Attributes:

Name Type Description
block bool

A boolean. True if the room is blocked, otherwise False

user_id str

An optional string. If the room is blocked (block is True) shows the user who has add the room to blocking list. Otherwise it is not displayed.

Source code in matrix_admin_sdk/models/v1/rooms.py
class BlockStatusModel(BaseModel):
    """
    Block status model
    Attributes:
        block (bool): A boolean. True if the room is blocked, otherwise False
        user_id (str): An optional string. If the room is blocked (block is True)
            shows the user who has add the room to blocking list. Otherwise it is
            not displayed.
    """

    block: bool
    user_id: Optional[str] = None

DeletedRoomModel

DeletedRoomModel(kicked_users: List[str], failed_to_kick_users: List[str], local_aliases: List[str], new_room_id: str)

Source code in matrix_admin_sdk/models/v1/rooms.py
class DeletedRoomModel(BaseModel):
    kicked_users: List[str]
    failed_to_kick_users: List[str]
    local_aliases: List[str]
    new_room_id: str

Other

OrderBy

Enum for the order by parameter

Attributes:

Name Type Description
NAME

Rooms are ordered alphabetically by room name. This is the default.

CANONICAL_ALIAS

Rooms are ordered alphabetically by main alias address of the room.

JOINED_LOCAL_MEMBERS

Rooms are ordered by the number of members. Largest to smallest.

JOINED_LOCAL_MEMBERS

Rooms are ordered by the number of local members. Largest to smallest.

VERSION

Rooms are ordered by room version. Largest to smallest.

CREATOR

Rooms are ordered alphabetically by creator of the room.

ENCRYPTION

Rooms are ordered alphabetically by the end-to-end encryption algorithm.

FEDERATABLE

Rooms are ordered by whether the room is federatable.

PUBLIC

Rooms are ordered by visibility in room list.

JOIN_RULES

Rooms are ordered alphabetically by join rules of the room.

GUEST_ACCESS

Rooms are ordered alphabetically by guest access option of the room.

HISTORY_VISIBILITY

Rooms are ordered alphabetically by visibility of history of the room.

STATE_EVENTS

Rooms are ordered by number of state events. Largest to smallest.

Source code in matrix_admin_sdk/endpoints/v1/rooms.py
class OrderBy(Enum):
    """
    Enum for the order by parameter

    Attributes:
        NAME: Rooms are ordered alphabetically by room name. This is the default.
        CANONICAL_ALIAS: Rooms are ordered alphabetically by main alias address of the room.
        JOINED_LOCAL_MEMBERS: Rooms are ordered by the number of members. Largest to smallest.
        JOINED_LOCAL_MEMBERS: Rooms are ordered by the number of local members. Largest to smallest.
        VERSION: Rooms are ordered by room version. Largest to smallest.
        CREATOR: Rooms are ordered alphabetically by creator of the room.
        ENCRYPTION: Rooms are ordered alphabetically by the end-to-end encryption algorithm.
        FEDERATABLE: Rooms are ordered by whether the room is federatable.
        PUBLIC: Rooms are ordered by visibility in room list.
        JOIN_RULES: Rooms are ordered alphabetically by join rules of the room.
        GUEST_ACCESS: Rooms are ordered alphabetically by guest access option of the room.
        HISTORY_VISIBILITY: Rooms are ordered alphabetically by visibility of history of the room.
        STATE_EVENTS: Rooms are ordered by number of state events. Largest to smallest.
    """

    NAME = "name"
    CANONICAL_ALIAS = "canonical_alias"
    JOINED_MEMBERS = "joined_members"
    JOINED_LOCAL_MEMBERS = "joined_local_members"
    VERSION = "version"
    CREATOR = "creator"
    ENCRYPTION = "encryption"
    FEDERATABLE = "federatable"
    PUBLIC = "public"
    JOIN_RULES = "join_rules"
    GUEST_ACCESS = "guest_access"
    HISTORY_VISIBILITY = "history_visibility"
    STATE_EVENTS = "state_events"