getRoomSummary method
Retrieves a summary for a room.
Clients should note that requests for rooms where the user's membership
is invite or knock might yield outdated, partial or even no data
since the server may not have access to the current state of the room.
Servers MAY allow unauthenticated access to this API if at least one of the following conditions holds true:
- The room has a join rule of
public,knockorknock_restricted. - The room has a
world_readablehistory visibility.
Servers should consider rate limiting requests that require a federation request more heavily if the client is unauthenticated.
roomIdOrAlias The room identifier or alias to summarise.
via The servers to attempt to request the summary from when
the local server cannot generate it (for instance, because
it has no local user in the room).
Implementation
Future<GetRoomSummaryResponse$3> getRoomSummary(
String roomIdOrAlias, {
List<String>? via,
}) async {
final requestUri = Uri(
path:
'_matrix/client/v1/room_summary/${Uri.encodeComponent(roomIdOrAlias)}',
queryParameters: {
if (via != null) 'via': via,
},
);
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return GetRoomSummaryResponse$3.fromJson(json as Map<String, Object?>);
}