Merge remote-tracking branch 'upstream/main' into conduwuit-changes

This commit is contained in:
strawberry 2024-03-27 13:24:52 -04:00
commit fd26b59718
4 changed files with 32 additions and 6 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

@ -120,7 +120,7 @@ pub mod v1 {
///
/// If `recurse` was not set, this field must be absent.
#[serde(skip_serializing_if = "Option::is_none")]
recursion_depth: Option<UInt>,
pub recursion_depth: Option<UInt>,
}
impl Request {

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.
@ -119,13 +126,22 @@ pub mod v1 {
///
/// If `recurse` was not set, this field must be absent.
#[serde(skip_serializing_if = "Option::is_none")]
recursion_depth: Option<UInt>,
pub recursion_depth: Option<UInt>,
}
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.
@ -126,7 +133,7 @@ pub mod v1 {
///
/// If `recurse` was not set, this field must be absent.
#[serde(skip_serializing_if = "Option::is_none")]
recursion_depth: Option<UInt>,
pub recursion_depth: Option<UInt>,
}
impl Request {
@ -144,6 +151,7 @@ pub mod v1 {
rel_type,
event_type,
from: None,
dir: Direction::default(),
to: None,
limit: None,
recurse: false,