Event Reports¶
Endpoints¶
EventReports¶
Event Reports endpoint
Source code in matrix_admin_sdk/endpoints/v1/event_reports.py
class EventReports(Endpoint):
"""Event Reports endpoint"""
async def show_reported_events(
self,
limit: int = 100,
from_: int = 0,
dir_: str = "b",
user_id: Optional[str] = None,
room_id: Optional[str] = None,
) -> EventReportsModel:
"""
This API returns information about reported events
Args:
limit: used for pagination, denoting the maximum number of items to return in this call
from_: used for pagination, denoting the offset in the returned results.
This should be treated as an opaque value and not explicitly set
to anything other than the return value of
`next_token` from a previous call
dir_: Direction of event report order. Whether to fetch the most recent first (b) or the oldest first (f).
user_id: filters to only return users with user IDs that contain this value. This is the user who
reported the event and wrote the reason
room_id: filters to only return rooms with room IDs that contain this value.
Returns: list of event reports
"""
url = self.url("event_reports")
params = {
"limit": limit,
"from": from_,
"dir": dir_,
"user_id": user_id,
"room_id": room_id,
}
result = await self.request(RequestMethods.GET, url, params=params)
return EventReportsModel.from_dict(result)
async def show_details(self, report_id: str) -> EventDetails:
"""
This API returns information about a specific event report.
Args:
report_id: The ID of the event report
Returns: event details
"""
url = self.url(f"event_reports/{report_id}")
result = await self.request(RequestMethods.GET, url)
return EventDetails.from_dict(result)
show_details(self, report_id)
async
¶
This API returns information about a specific event report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_id |
str |
The ID of the event report |
required |
Source code in matrix_admin_sdk/endpoints/v1/event_reports.py
async def show_details(self, report_id: str) -> EventDetails:
"""
This API returns information about a specific event report.
Args:
report_id: The ID of the event report
Returns: event details
"""
url = self.url(f"event_reports/{report_id}")
result = await self.request(RequestMethods.GET, url)
return EventDetails.from_dict(result)
show_reported_events(self, limit=100, from_=0, dir_='b', user_id=None, room_id=None)
async
¶
This API returns information about reported events
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit |
int |
used for pagination, denoting the maximum number of items to return in this call |
100 |
from_ |
int |
used for pagination, denoting the offset in the returned results.
This should be treated as an opaque value and not explicitly set
to anything other than the return value of
|
0 |
dir_ |
str |
Direction of event report order. Whether to fetch the most recent first (b) or the oldest first (f). |
'b' |
user_id |
Optional[str] |
filters to only return users with user IDs that contain this value. This is the user who reported the event and wrote the reason |
None |
room_id |
Optional[str] |
filters to only return rooms with room IDs that contain this value. |
None |
Source code in matrix_admin_sdk/endpoints/v1/event_reports.py
async def show_reported_events(
self,
limit: int = 100,
from_: int = 0,
dir_: str = "b",
user_id: Optional[str] = None,
room_id: Optional[str] = None,
) -> EventReportsModel:
"""
This API returns information about reported events
Args:
limit: used for pagination, denoting the maximum number of items to return in this call
from_: used for pagination, denoting the offset in the returned results.
This should be treated as an opaque value and not explicitly set
to anything other than the return value of
`next_token` from a previous call
dir_: Direction of event report order. Whether to fetch the most recent first (b) or the oldest first (f).
user_id: filters to only return users with user IDs that contain this value. This is the user who
reported the event and wrote the reason
room_id: filters to only return rooms with room IDs that contain this value.
Returns: list of event reports
"""
url = self.url("event_reports")
params = {
"limit": limit,
"from": from_,
"dir": dir_,
"user_id": user_id,
"room_id": room_id,
}
result = await self.request(RequestMethods.GET, url, params=params)
return EventReportsModel.from_dict(result)
Models¶
EventDetails¶
Event details model.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int |
ID of event report. |
received_ts |
int |
The timestamp (in milliseconds since the unix epoch) when this report was sent. |
room_id |
str |
The ID of the room in which the event being reported is located. |
name |
str |
The name of the room. |
event_id |
str |
The ID of the reported event. |
user_id |
str |
This is the user who reported the event and wrote the reason. |
reason |
str |
Comment made by the user_id in this report. May be blank. |
score |
int |
Content is reported based upon a negative score, where -100 is "most offensive" and 0 is "inoffensive". |
sender |
str |
This is the ID of the user who sent the original message/event that was reported. |
canonical_alias |
str |
The canonical alias of the room. null if the room does not have a canonical alias set. |
event_json |
EventJson |
Details of the original event that was reported. |
Source code in matrix_admin_sdk/models/v1/event_reports.py
class EventDetails:
"""
Event details model.
Attributes:
id (int): ID of event report.
received_ts (int): The timestamp (in milliseconds since the unix epoch) when this report was sent.
room_id (str): The ID of the room in which the event being reported is located.
name (str): The name of the room.
event_id (str): The ID of the reported event.
user_id (str): This is the user who reported the event and wrote the reason.
reason (str): Comment made by the user_id in this report. May be blank.
score (int): Content is reported based upon a negative score, where -100 is "most offensive" and 0 is "inoffensive".
sender (str): This is the ID of the user who sent the original message/event that was reported.
canonical_alias (str): The canonical alias of the room. null if the room does not have a canonical alias set.
event_json (EventJson): Details of the original event that was reported.
"""
event_json: EventJson
id: int
received_ts: int
room_id: str
name: str
event_id: str
user_id: str
reason: str
score: int
sender: str
canonical_alias: str
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "EventDetails":
event_json = EventJson.from_dict(data["event_json"])
del data["event_json"]
return cls(**data, event_json=event_json)
EventJson¶
EventJson(auth_events: List[str], content: matrix_admin_sdk.models.v1.event_reports.EventContent, depth: int, hashes: Dict[str, str], origin: str, origin_server_ts: int, prev_events: List[str], prev_state: List[str], room_id: str, sender: str, signatures: Dict[str, Dict[str, str]], type: str, unsigned: Dict[str, int])
Source code in matrix_admin_sdk/models/v1/event_reports.py
class EventJson(BaseModel):
auth_events: List[str]
content: EventContent
depth: int
hashes: Dict[str, str]
origin: str
origin_server_ts: int
prev_events: List[str]
prev_state: List[str]
room_id: str
sender: str
signatures: Signatures
type: str
unsigned: Dict[str, int]
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "EventJson":
data = data.copy()
content = EventContent.from_dict(data["content"])
del data["content"]
return cls(**data, content=content)
EventContent¶
EventContent(body: str, format: str, formatted_body: str, msgtype: str)
Source code in matrix_admin_sdk/models/v1/event_reports.py
class EventContent(BaseModel):
body: str
format: str
formatted_body: str
msgtype: str
EventReports¶
List of Event Reports
Attributes:
| Name | Type | Description |
|---|---|---|
event_reports |
List[EventReport] |
List of Event Reports |
next_token |
int |
Indication for pagination |
total |
int |
Total number of event reports related to the query |
Source code in matrix_admin_sdk/models/v1/event_reports.py
class EventReports(BaseModel):
"""
List of Event Reports
Attributes:
event_reports (List[EventReport]): List of Event Reports
next_token (int): Indication for pagination
total (int): Total number of event reports related to the query
"""
event_reports: List[EventReport]
next_token: int
total: int
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "EventReports":
return cls(
next_token=data["next_token"],
total=data["total"],
event_reports=[EventReport.from_dict(i) for i in data["event_reports"]],
)
EventReport¶
Event report model.
Attributes:
| Name | Type | Description |
|---|---|---|
event_id |
str |
The ID of the reported event |
id |
int |
ID of event report |
reason |
str|None |
Comment made by the user_id in this report |
score |
int|None |
Content is reported based upon a negative score, where -100 is "most offensive" and 0 is "inoffensive" |
received_ts |
int |
The timestamp (in milliseconds since the unix epoch) when this report was sent |
canonical_alias |
str |
The canonical alias of the room. null if the room does not have a canonical alias set. |
room_id |
str |
The ID of the room in which the event being reported is located |
name |
str |
The name of the room |
sender |
str |
This is the ID of the user who sent the original message/event that was reported. |
user_id |
str |
This is the user who reported the event and wrote the reason |
Source code in matrix_admin_sdk/models/v1/event_reports.py
class EventReport(BaseModel):
"""
Event report model.
Attributes:
event_id (str): The ID of the reported event
id (int): ID of event report
reason (str|None): Comment made by the user_id in this report
score (int|None): Content is reported based upon a negative score, where -100 is "most offensive" and 0 is "inoffensive"
received_ts (int): The timestamp (in milliseconds since the unix epoch) when this report was sent
canonical_alias (str): The canonical alias of the room. null if the room does not have a canonical alias set.
room_id (str): The ID of the room in which the event being reported is located
name (str): The name of the room
sender (str): This is the ID of the user who sent the original message/event that was reported.
user_id (str): This is the user who reported the event and wrote the reason
"""
event_id: str
id: int
reason: Optional[str]
score: Optional[int]
received_ts: int
canonical_alias: str
room_id: str
name: str
sender: str
user_id: str