getOneEvent method

  1. @deprecated
Future<MatrixEvent> getOneEvent(
  1. String eventId
)

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

This endpoint was deprecated in r0 of this specification. Clients should instead call the /rooms/{roomId}/event/{eventId} API or the /rooms/{roomId}/context/{eventId API.

eventId The event ID to get.

Implementation

@deprecated
Future<MatrixEvent> getOneEvent(String eventId) async {
  final requestUri =
      Uri(path: '_matrix/client/v3/events/${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 MatrixEvent.fromJson(json as Map<String, Object?>);
}