Change get_message_events Request limit field from Option<UInt> to UInt
This commit is contained in:
parent
1aed6ab52b
commit
4abcc4c0bd
@ -47,9 +47,9 @@ ruma_api! {
|
|||||||
/// The maximum number of events to return.
|
/// The maximum number of events to return.
|
||||||
///
|
///
|
||||||
/// Default: 10.
|
/// Default: 10.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub limit: Option<UInt>,
|
#[serde(default = "default_limit", skip_serializing_if = "is_default_limit")]
|
||||||
|
pub limit: UInt,
|
||||||
|
|
||||||
/// A RoomEventFilter to filter returned events with.
|
/// A RoomEventFilter to filter returned events with.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
@ -82,6 +82,15 @@ ruma_api! {
|
|||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_limit() -> UInt {
|
||||||
|
UInt::from(10u32)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
|
fn is_default_limit(val: &UInt) -> bool {
|
||||||
|
*val == default_limit()
|
||||||
|
}
|
||||||
|
|
||||||
/// The direction to return events from.
|
/// The direction to return events from.
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||||
pub enum Direction {
|
pub enum Direction {
|
||||||
@ -120,7 +129,7 @@ mod tests {
|
|||||||
from: "token".into(),
|
from: "token".into(),
|
||||||
to: Some("token2".into()),
|
to: Some("token2".into()),
|
||||||
dir: Direction::Backward,
|
dir: Direction::Backward,
|
||||||
limit: Some(UInt::from(0u32)),
|
limit: UInt::from(0u32),
|
||||||
filter: Some(filter),
|
filter: Some(filter),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,7 +148,7 @@ mod tests {
|
|||||||
from: "token".into(),
|
from: "token".into(),
|
||||||
to: Some("token2".into()),
|
to: Some("token2".into()),
|
||||||
dir: Direction::Backward,
|
dir: Direction::Backward,
|
||||||
limit: Some(UInt::from(0u32)),
|
limit: UInt::from(0u32),
|
||||||
filter: None,
|
filter: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,7 +164,7 @@ mod tests {
|
|||||||
from: "token".into(),
|
from: "token".into(),
|
||||||
to: Some("token2".into()),
|
to: Some("token2".into()),
|
||||||
dir: Direction::Backward,
|
dir: Direction::Backward,
|
||||||
limit: Some(UInt::from(0u32)),
|
limit: UInt::from(0u32),
|
||||||
filter: Some(RoomEventFilter::default()),
|
filter: Some(RoomEventFilter::default()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
|
||||||
|
* Change `get_message_events` limit field type from `Option<UInt>` to `UInt`
|
||||||
* Add `alt_aliases` to `CanonicalAliasEventContent`
|
* Add `alt_aliases` to `CanonicalAliasEventContent`
|
||||||
* Replace `format` and `formatted_body` fields in `TextMessagEventContent`,
|
* Replace `format` and `formatted_body` fields in `TextMessagEventContent`,
|
||||||
`NoticeMessageEventContent` and `EmoteMessageEventContent` with `formatted: FormattedBody`
|
`NoticeMessageEventContent` and `EmoteMessageEventContent` with `formatted: FormattedBody`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user