Forward Extremities¶
Endpoints¶
ForwardExtremities¶
Enables querying and deleting forward extremities from rooms. When a lot of forward extremities accumulate in a room, performance can become degraded. For details, see https://github.com/matrix-org/synapse/issues/1760
Source code in matrix_admin_sdk/endpoints/v1/forward_extremities.py
class ForwardExtremities(Endpoint):
"""
Enables querying and deleting forward extremities from rooms.
When a lot of forward extremities accumulate in a room, performance
can become degraded. For details, see https://github.com/matrix-org/synapse/issues/1760
"""
async def check_for_forward_extremities(
self, room_id_or_alias: str
) -> List[ForwardExtremitiesModel]:
"""
To check the status of forward extremities for a room
Args:
room_id_or_alias: The room id or alias to check
Returns: list of ForwardExtremitiesModel
"""
url = self.url(f"rooms/{room_id_or_alias}/forward_extremities")
result = await self.request(RequestMethods.GET, url)
res: List[ForwardExtremitiesModel] = [
ForwardExtremitiesModel.from_dict(item) for item in result["results"]
]
return res
async def deleting_forward_extremities(
self, room_id_or_alias: str
) -> Dict[str, int]:
"""
**WARNING**: Please ensure you know what you're doing and have read the related
issue #1760. Under no situations should this API be executed as an automated
maintenance task!
Args:
room_id_or_alias: The room id or alias to delete
Returns: {"deleted": 1}
"""
url = f"rooms/{room_id_or_alias}/forward_extremities"
result = await self.request(RequestMethods.DELETE, url)
return result
check_for_forward_extremities(self, room_id_or_alias)
async
¶
To check the status of forward extremities for a room
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
room_id_or_alias |
str |
The room id or alias to check |
required |
Source code in matrix_admin_sdk/endpoints/v1/forward_extremities.py
async def check_for_forward_extremities(
self, room_id_or_alias: str
) -> List[ForwardExtremitiesModel]:
"""
To check the status of forward extremities for a room
Args:
room_id_or_alias: The room id or alias to check
Returns: list of ForwardExtremitiesModel
"""
url = self.url(f"rooms/{room_id_or_alias}/forward_extremities")
result = await self.request(RequestMethods.GET, url)
res: List[ForwardExtremitiesModel] = [
ForwardExtremitiesModel.from_dict(item) for item in result["results"]
]
return res
deleting_forward_extremities(self, room_id_or_alias)
async
¶
WARNING: Please ensure you know what you're doing and have read the related issue #1760. Under no situations should this API be executed as an automated maintenance task!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
room_id_or_alias |
str |
The room id or alias to delete |
required |
Source code in matrix_admin_sdk/endpoints/v1/forward_extremities.py
async def deleting_forward_extremities(
self, room_id_or_alias: str
) -> Dict[str, int]:
"""
**WARNING**: Please ensure you know what you're doing and have read the related
issue #1760. Under no situations should this API be executed as an automated
maintenance task!
Args:
room_id_or_alias: The room id or alias to delete
Returns: {"deleted": 1}
"""
url = f"rooms/{room_id_or_alias}/forward_extremities"
result = await self.request(RequestMethods.DELETE, url)
return result