From 9ecc7c11cfec58cd257a67225335ae5edbb443bd Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 3 Jul 2020 22:06:47 +0200 Subject: [PATCH] Add a constructor for get_message_events::Request --- ruma-client-api/CHANGELOG.md | 4 +++- ruma-client-api/src/r0/message/get_message_events.rs | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ruma-client-api/CHANGELOG.md b/ruma-client-api/CHANGELOG.md index ae47ab7d..8cf3f047 100644 --- a/ruma-client-api/CHANGELOG.md +++ b/ruma-client-api/CHANGELOG.md @@ -24,7 +24,9 @@ Improvements: * Add method `into_event_content` for `r0::room::create_room::CreationContent` * Add room visibility endpoints: `r0::directory::{get_room_visibility, set_room_visibility}`. * Add is_empty helpers for structs in `r0::sync::sync_events` -* Add a constructor for `r0::room::create_room::Request` +* Add a constructor for request structs of the followign endpoints + * `r0::room::create_room` + * `r0::message::get_message_events` Deprecations: diff --git a/ruma-client-api/src/r0/message/get_message_events.rs b/ruma-client-api/src/r0/message/get_message_events.rs index 1eeb9ac5..550b7135 100644 --- a/ruma-client-api/src/r0/message/get_message_events.rs +++ b/ruma-client-api/src/r0/message/get_message_events.rs @@ -82,6 +82,15 @@ ruma_api! { error: crate::Error } +impl Request { + /// Creates a `Request` with the given parameters. + /// + /// All other parameters will be defaulted. + pub fn new(room_id: RoomId, from: String, dir: Direction) -> Self { + Self { room_id, from, to: None, dir, limit: default_limit(), filter: None } + } +} + fn default_limit() -> UInt { uint!(10) }