client-api: Use fine-grained event type enums
This commit is contained in:
parent
88477f2ad5
commit
26ffa5e5c8
@ -7,7 +7,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::ruma_api,
|
||||||
events::{AnyStateEventContent, EventType},
|
events::{AnyStateEventContent, StateEventType},
|
||||||
serde::{Outgoing, Raw},
|
serde::{Outgoing, Raw},
|
||||||
RoomId,
|
RoomId,
|
||||||
};
|
};
|
||||||
@ -47,7 +47,7 @@ pub mod v3 {
|
|||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
|
|
||||||
/// The type of state to look up.
|
/// The type of state to look up.
|
||||||
pub event_type: EventType,
|
pub event_type: StateEventType,
|
||||||
|
|
||||||
/// The key of the state to look up.
|
/// The key of the state to look up.
|
||||||
pub state_key: &'a str,
|
pub state_key: &'a str,
|
||||||
@ -55,7 +55,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID, event type and state key.
|
/// Creates a new `Request` with the given room ID, event type and state key.
|
||||||
pub fn new(room_id: &'a RoomId, event_type: EventType, state_key: &'a str) -> Self {
|
pub fn new(room_id: &'a RoomId, event_type: StateEventType, state_key: &'a str) -> Self {
|
||||||
Self { room_id, event_type, state_key }
|
Self { room_id, event_type, state_key }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ pub mod v3 {
|
|||||||
{
|
{
|
||||||
// FIXME: find a way to make this if-else collapse with serde recognizing trailing
|
// FIXME: find a way to make this if-else collapse with serde recognizing trailing
|
||||||
// Option
|
// Option
|
||||||
let (room_id, event_type, state_key): (Box<RoomId>, EventType, String) =
|
let (room_id, event_type, state_key): (Box<RoomId>, StateEventType, String) =
|
||||||
if path_args.len() == 3 {
|
if path_args.len() == 3 {
|
||||||
serde::Deserialize::deserialize(serde::de::value::SeqDeserializer::<
|
serde::Deserialize::deserialize(serde::de::value::SeqDeserializer::<
|
||||||
_,
|
_,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user