Exemple #1
0
    async def join_via(self, room_id: str) -> Union[JoinResponse, JoinError]:
        via = room_id.split(':')[1]
        print(f"joining {room_id} via {via}")

        path = Api._build_path(['join', room_id],
                               dict(access_token=self.client.access_token,
                                    server_name=via))
        response = await self.client._send(JoinResponse, 'POST', path,
                                           Api.to_json({}))
        print("join via response: ", response)
        return response
Exemple #2
0
async def community_invite(client, group, sender):
    if not group:
        return
    path = "groups/{}/admin/users/invite/{}".format(group, sender)
    data = {"user_id": sender}
    query_parameters = {"access_token": client.access_token}
    path = Api._build_path(path, query_parameters)
    logger.debug("community_invite path: %r", path)
    await client.send("PUT",
                      path,
                      Api.to_json(data),
                      headers={"Content-Type": "application/json"})
    return
Exemple #3
0
 def request_spaces(access_token: str, room_id: str) -> Tuple[str, str]:
     path = ["org.matrix.msc2946", "rooms", room_id, "spaces"]
     return "GET", Api._build_path(path,
                                   dict(access_token=access_token),
                                   base_path="/_matrix/client/unstable")