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
|
* 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
|
||||||
* Remove `message::get_message_events::v3::Request::new`'s `from` parameter
|
* Update `message::get_message_events::v3::Request`'s constructors because the `from` field is now
|
||||||
* This parameter is now optional, and can be set after initial construction, or by using one of
|
optional
|
||||||
the other constructors
|
* `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`
|
* `receipt::create_receipt` uses its own `ReceiptType`
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
@ -111,42 +111,56 @@ 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 optional `from` token, and `dir` set
|
||||||
/// `Backward`.
|
/// to `Backward`.
|
||||||
pub fn backward(room_id: &'a RoomId, from: &'a str) -> Self {
|
///
|
||||||
assign!(Self::new(room_id, Direction::Backward), { from: Some(from) })
|
/// `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`.
|
/// `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
|
/// Creates a new `Request` to fetch messages from the very start of the available history
|
||||||
/// for a given room.
|
/// for a given room.
|
||||||
|
///
|
||||||
|
/// Equivalent to `Request::forward(room_id, None)`.
|
||||||
pub fn from_start(room_id: &'a RoomId) -> Self {
|
pub fn from_start(room_id: &'a RoomId) -> Self {
|
||||||
Self {
|
Self::forward(room_id, None)
|
||||||
room_id,
|
|
||||||
from: None,
|
|
||||||
to: None,
|
|
||||||
dir: Direction::Forward,
|
|
||||||
limit: default_limit(),
|
|
||||||
filter: RoomEventFilter::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `Request` to fetch messages from the very end of the available history for
|
/// Creates a new `Request` to fetch messages from the very end of the available history for
|
||||||
/// a given room.
|
/// a given room.
|
||||||
|
///
|
||||||
|
/// Equivalent to `Request::backward(room_id, None)`.
|
||||||
pub fn from_end(room_id: &'a RoomId) -> Self {
|
pub fn from_end(room_id: &'a RoomId) -> Self {
|
||||||
Self {
|
Self::backward(room_id, None)
|
||||||
room_id,
|
|
||||||
from: None,
|
|
||||||
to: None,
|
|
||||||
dir: Direction::Backward,
|
|
||||||
limit: default_limit(),
|
|
||||||
filter: RoomEventFilter::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user