Skip to content

Commit

Permalink
Merge pull request #7 from emonical/main
Browse files Browse the repository at this point in the history
Support Spaces in room creation API
  • Loading branch information
KnugiHK authored Aug 12, 2023
2 parents 7e24309 + eb2a2ad commit 94816be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion synapse_admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def client_create_room(
name: str = None,
invite: Union[str, list] = None,
federation: bool = True,
encrypted: bool = True
encrypted: bool = True,
room_type: str = None
) -> str:
"""Create a room as a client
Expand All @@ -77,6 +78,7 @@ def client_create_room(
invite (Union[str, list], optional): list of members. Defaults to None. # noqa: E501
federation (bool, optional): allow federation. Defaults to True.
encrypted (bool, optional): create encrypted room or not. Defaults to True
room_type: (str, optional): type of room to create
Returns:
str: created room id
Expand All @@ -101,6 +103,8 @@ def client_create_room(
raise TypeError("Argument invite must be str or list.")
data["invite"] = validated_invite
data["creation_content"] = {"m.federate": federation}
if room_type is not None:
data["creation_content"]["type"] = room_type
if encrypted:
data["initial_state"] = [{
"type": "m.room.encryption",
Expand Down
7 changes: 5 additions & 2 deletions synapse_admin/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def create(
members: list = None,
federation: bool = True,
leave: bool = False,
encrypted: bool = True
encrypted: bool = True,
room_type: str = None
) -> RoomInformation:
"""Create a room and force users to be a member
Expand All @@ -222,6 +223,7 @@ def create(
members (list, optional): a list of user that should be the members of the room. Defaults to None. # noqa: E501
federation (bool, optional): can the room be federated. Defaults to True.
leave (bool, optional): whether to leave the room yourself after the creation. Defaults to False.
room_type (str, optional): the type of room. Defaults to None.
Returns:
RoomInformation: roomid: room id, joined: a list of joined users
Expand All @@ -238,7 +240,8 @@ def create(
alias,
name,
federation=federation,
encrypted=encrypted
encrypted=encrypted,
room_type=room_type
)
joined = []
if members is not None:
Expand Down
Empty file modified testing_env.sh
100644 → 100755
Empty file.

0 comments on commit 94816be

Please sign in to comment.