client-api: add missing dir field on the relations endpoints

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-27 11:30:02 -04:00 committed by Kévin Commaille
parent 80d228ae45
commit 85ecb1b11b
3 changed files with 29 additions and 3 deletions

View File

@ -36,6 +36,8 @@ Improvements:
- Add support for recursion on the `get_relating_events` endpoints, according to
MSC3981 / Matrix 1.10
- Add server support discovery endpoint, according to MSC1929 / Matrix 1.10
- Add `dir` `Request` field on the `get_relating_events_with_rel_types` and
`get_relating_events_with_rel_type_and_event_type` endpoints
# 0.17.4

View File

@ -10,7 +10,7 @@ pub mod v1 {
use js_int::UInt;
use ruma_common::{
api::{request, response, Metadata},
api::{request, response, Direction, Metadata},
metadata,
serde::Raw,
OwnedEventId, OwnedRoomId,
@ -56,6 +56,13 @@ pub mod v1 {
#[ruma_api(query)]
pub from: Option<String>,
/// The direction to return events from.
///
/// Defaults to [`Direction::Backward`].
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
#[ruma_api(query)]
pub dir: Direction,
/// The pagination token to stop returning results at.
///
/// If `None`, results continue up to `limit` or until there are no more events.
@ -125,7 +132,16 @@ pub mod v1 {
impl Request {
/// Creates a new `Request` with the given room ID, parent event ID and relationship type.
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId, rel_type: RelationType) -> Self {
Self { room_id, event_id, rel_type, from: None, to: None, limit: None, recurse: false }
Self {
room_id,
event_id,
dir: Direction::default(),
rel_type,
from: None,
to: None,
limit: None,
recurse: false,
}
}
}

View File

@ -10,7 +10,7 @@ pub mod v1 {
use js_int::UInt;
use ruma_common::{
api::{request, response, Metadata},
api::{request, response, Direction, Metadata},
metadata,
serde::Raw,
OwnedEventId, OwnedRoomId,
@ -63,6 +63,13 @@ pub mod v1 {
#[ruma_api(query)]
pub from: Option<String>,
/// The direction to return events from.
///
/// Defaults to [`Direction::Backward`].
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
#[ruma_api(query)]
pub dir: Direction,
/// The pagination token to stop returning results at.
///
/// If `None`, results continue up to `limit` or until there are no more events.
@ -144,6 +151,7 @@ pub mod v1 {
rel_type,
event_type,
from: None,
dir: Direction::default(),
to: None,
limit: None,
recurse: false,