getOneRoomEvent method

Future<SDNEvent> getOneRoomEvent(
  1. String roomId,
  2. String eventId
)
inherited

Get a single event based on roomId/eventId. You must have permission to retrieve this event e.g. by being a member in the room for this event.

roomId The ID of the room the event is in.

eventId The event ID to get.

Implementation

Future<SDNEvent> getOneRoomEvent(String roomId, String eventId) async {
  final requestUri = Uri(
      path:
          '_api/client/v3/rooms/${Uri.encodeComponent(roomId)}/event/${Uri.encodeComponent(eventId)}');
  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 SDNEvent.fromJson(json as Map<String, Object?>);
}