client-api: Update message::get_message_events::v3::Request
's constructors
This commit is contained in:
parent
f4a8a66bde
commit
da5def6731
@ -5,9 +5,12 @@ Breaking changes:
|
||||
* Remove `PartialEq` implementations for a number of types
|
||||
* If the lack of such an `impl` causes problems, please open a GitHub issue
|
||||
* Split `uiaa::UserIdentifier::ThirdParty` into two separate variants
|
||||
* 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
|
||||
* Update `message::get_message_events::v3::Request`'s constructors because the `from` field is now
|
||||
optional
|
||||
* `new` has no `from` parameter anymore
|
||||
* `backward` and `forward` now have `from` as an optional parameter
|
||||
* Constructors `backward_from` and `forward_from` have been added with the previous signatures of
|
||||
`backward` and `forward`
|
||||
* `receipt::create_receipt` uses its own `ReceiptType`
|
||||
|
||||
Improvements:
|
||||
|
@ -111,42 +111,56 @@ pub mod v3 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new `Request` with the given room ID and from token, and `dir` set to
|
||||
/// `Backward`.
|
||||
pub fn backward(room_id: &'a RoomId, from: &'a str) -> Self {
|
||||
assign!(Self::new(room_id, Direction::Backward), { from: Some(from) })
|
||||
/// Creates a new `Request` with the given room ID and optional `from` token, and `dir` set
|
||||
/// to `Backward`.
|
||||
///
|
||||
/// `Request::backward(room_id, Some(from))` can also be written as
|
||||
/// `Request::backward_from(room_id, from)`.\
|
||||
/// `Request::backward(room_id, None)` can also be written as `Request::from_end(room_id)`.
|
||||
pub fn backward(room_id: &'a RoomId, from: Option<&'a str>) -> Self {
|
||||
assign!(Self::new(room_id, Direction::Backward), { 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 optional `from` token, and `dir` set
|
||||
/// to `Forward`.
|
||||
///
|
||||
/// `Request::forward(room_id, Some(from))` can also be written as
|
||||
/// `Request::forward_from(room_id, from)`.\
|
||||
/// `Request::forward(room_id, None)` can also be written as `Request::from_start(room_id)`.
|
||||
pub fn forward(room_id: &'a RoomId, from: Option<&'a str>) -> Self {
|
||||
assign!(Self::new(room_id, Direction::Forward), { from })
|
||||
}
|
||||
|
||||
/// Creates a new `Request` with the given room ID and `from` token, and `dir` set to
|
||||
/// `Backward`.
|
||||
///
|
||||
/// Equivalent to `Request::backward(room_id, Some(from))`.
|
||||
pub fn backward_from(room_id: &'a RoomId, from: &'a str) -> Self {
|
||||
Self::backward(room_id, Some(from))
|
||||
}
|
||||
|
||||
/// Creates a new `Request` with the given room ID and `from` token, and `dir` set to
|
||||
/// `Forward`.
|
||||
pub fn forward(room_id: &'a RoomId, from: &'a str) -> Self {
|
||||
assign!(Self::new(room_id, Direction::Forward), { from: Some(from) })
|
||||
///
|
||||
/// Equivalent to `Request::forward(room_id, Some(from))`.
|
||||
pub fn forward_from(room_id: &'a RoomId, from: &'a str) -> Self {
|
||||
Self::forward(room_id, Some(from))
|
||||
}
|
||||
|
||||
/// Creates a new `Request` to fetch messages from the very start of the available history
|
||||
/// for a given room.
|
||||
///
|
||||
/// Equivalent to `Request::forward(room_id, None)`.
|
||||
pub fn from_start(room_id: &'a RoomId) -> Self {
|
||||
Self {
|
||||
room_id,
|
||||
from: None,
|
||||
to: None,
|
||||
dir: Direction::Forward,
|
||||
limit: default_limit(),
|
||||
filter: RoomEventFilter::default(),
|
||||
}
|
||||
Self::forward(room_id, None)
|
||||
}
|
||||
|
||||
/// Creates a new `Request` to fetch messages from the very end of the available history for
|
||||
/// a given room.
|
||||
///
|
||||
/// Equivalent to `Request::backward(room_id, None)`.
|
||||
pub fn from_end(room_id: &'a RoomId) -> Self {
|
||||
Self {
|
||||
room_id,
|
||||
from: None,
|
||||
to: None,
|
||||
dir: Direction::Backward,
|
||||
limit: default_limit(),
|
||||
filter: RoomEventFilter::default(),
|
||||
}
|
||||
Self::backward(room_id, None)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user