client-api: Remove get_message_events::Request::new's from parameter

This commit is contained in:
Jonas Platte 2022-07-18 18:50:28 +02:00
parent 7ec599e83d
commit f4a8a66bde
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
2 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,9 @@ Breaking changes:
* Remove `PartialEq` implementations for a number of types * Remove `PartialEq` implementations for a number of types
* If the lack of such an `impl` causes problems, please open a GitHub issue * If the lack of such an `impl` causes problems, please open a GitHub issue
* Split `uiaa::UserIdentifier::ThirdParty` into two separate variants * Split `uiaa::UserIdentifier::ThirdParty` into two separate variants
* Make `message::get_message_events::v3::Request::new`'s `from` parameter optional * Remove `message::get_message_events::v3::Request::new`'s `from` parameter
* This parameter is now optional, and can be set after initial construction, or by using one of
the other constructors
* `receipt::create_receipt` uses its own `ReceiptType` * `receipt::create_receipt` uses its own `ReceiptType`
Improvements: Improvements:

View File

@ -5,6 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3roomsroomidmessages //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3roomsroomidmessages
use assign::assign;
use js_int::{uint, UInt}; use js_int::{uint, UInt};
use ruma_common::{ use ruma_common::{
api::ruma_api, api::ruma_api,
@ -96,13 +97,13 @@ pub mod v3 {
} }
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given parameters. /// Creates a new `Request` with the given room ID and direction.
/// ///
/// All other parameters will be defaulted. /// All other parameters will be defaulted.
pub fn new(room_id: &'a RoomId, from: Option<&'a str>, dir: Direction) -> Self { pub fn new(room_id: &'a RoomId, dir: Direction) -> Self {
Self { Self {
room_id, room_id,
from, from: None,
to: None, to: None,
dir, dir,
limit: default_limit(), limit: default_limit(),
@ -113,13 +114,13 @@ pub mod v3 {
/// Creates a new `Request` with the given room ID and from token, and `dir` set to /// Creates a new `Request` with the given room ID and from token, and `dir` set to
/// `Backward`. /// `Backward`.
pub fn backward(room_id: &'a RoomId, from: &'a str) -> Self { pub fn backward(room_id: &'a RoomId, from: &'a str) -> Self {
Self::new(room_id, Some(from), Direction::Backward) assign!(Self::new(room_id, Direction::Backward), { from: Some(from) })
} }
/// Creates a new `Request` with the given room ID and from token, and `dir` set to /// Creates a new `Request` with the given room ID and from token, and `dir` set to
/// `Forward`. /// `Forward`.
pub fn forward(room_id: &'a RoomId, from: &'a str) -> Self { pub fn forward(room_id: &'a RoomId, from: &'a str) -> Self {
Self::new(room_id, Some(from), Direction::Forward) assign!(Self::new(room_id, Direction::Forward), { from: Some(from) })
} }
/// Creates a new `Request` to fetch messages from the very start of the available history /// Creates a new `Request` to fetch messages from the very start of the available history