Add room event endpoint

This commit is contained in:
iinuwa 2019-12-24 13:45:16 -08:00 committed by Jonas Platte
parent aa9b3178d2
commit 0a31182e59
3 changed files with 34 additions and 0 deletions

View File

@ -20,3 +20,4 @@ Improvements:
* Update `r0::account::change_password` from r0.3.0 to r0.6.0 * Update `r0::account::change_password` from r0.3.0 to r0.6.0
* Add optional `auth` field * Add optional `auth` field
* Add `r0::device` endpoints * Add `r0::device` endpoints
* Add `r0::room::get_room_event` (introduced in r0.4.0)

View File

@ -1,6 +1,7 @@
//! Endpoints for room creation. //! Endpoints for room creation.
pub mod create_room; pub mod create_room;
pub mod get_room_event;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@ -0,0 +1,32 @@
//! [GET /_matrix/client/r0/rooms/{roomId}/event/{eventId}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-event-eventid)
use ruma_api::ruma_api;
use ruma_events::{collections::all, EventResult};
use ruma_identifiers::{EventId, RoomId};
use serde::Deserialize;
ruma_api! {
metadata {
description: "Get a single event based on roomId/eventId",
method: GET,
name: "get_room_event",
path: "/_matrix/client/r0/rooms/:room_id/event/:event_id",
rate_limited: false,
requires_authentication: true,
}
request {
/// The ID of the room the event is in.
#[ruma_api(path)]
pub room_id: RoomId,
/// The ID of the event.
#[ruma_api(path)]
pub event_id: EventId,
}
response {
/// Arbitrary JSON of the event body. Returns both room and state events.
#[wrap_incoming(with EventResult)]
pub event: all::RoomEvent,
}
}