Support federation in the new spaces summary API (MSC2946). (#10569)

This commit is contained in:
Patrick Cloke 2021-08-16 08:06:17 -04:00 committed by GitHub
parent a3a7514570
commit 7de445161f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 518 additions and 165 deletions

View file

@ -1177,6 +1177,28 @@ class TransportLayerClient:
destination=destination, path=path, data=params
)
async def get_room_hierarchy(
self,
destination: str,
room_id: str,
suggested_only: bool,
) -> JsonDict:
"""
Args:
destination: The remote server
room_id: The room ID to ask about.
suggested_only: if True, only suggested rooms will be returned
"""
path = _create_path(
FEDERATION_UNSTABLE_PREFIX, "/org.matrix.msc2946/hierarchy/%s", room_id
)
return await self.client.get_json(
destination=destination,
path=path,
args={"suggested_only": "true" if suggested_only else "false"},
)
def _create_path(federation_prefix: str, path: str, *args: str) -> str:
"""