client-api: Add support for read receipts for threads

According to MSC3771
This commit is contained in:
Kévin Commaille 2022-10-02 12:08:46 +02:00 committed by Kévin Commaille
parent d3bd86a23e
commit f9958ae2e3
2 changed files with 12 additions and 1 deletions

View File

@ -18,6 +18,7 @@ Improvements:
* Add support for the pagination direction parameter to `/relations` (MSC3715 / Matrix 1.4) * Add support for the pagination direction parameter to `/relations` (MSC3715 / Matrix 1.4)
* Add support for notifications for threads (MSC3773 / Matrix 1.4) * Add support for notifications for threads (MSC3773 / Matrix 1.4)
* Send CORP headers by default for media responses (MSC3828 / Matrix 1.4) * Send CORP headers by default for media responses (MSC3828 / Matrix 1.4)
* Add support for read receipts for threads (MSC3771 / Matrix 1.4)
# 0.15.1 # 0.15.1

View File

@ -7,6 +7,7 @@ pub mod v3 {
use ruma_common::{ use ruma_common::{
api::ruma_api, api::ruma_api,
events::receipt::ReceiptThread,
serde::{OrdAsRefStr, PartialEqAsRefStr, PartialOrdAsRefStr, StringEnum}, serde::{OrdAsRefStr, PartialEqAsRefStr, PartialOrdAsRefStr, StringEnum},
EventId, RoomId, EventId, RoomId,
}; };
@ -37,6 +38,15 @@ pub mod v3 {
/// The event ID to acknowledge up to. /// The event ID to acknowledge up to.
#[ruma_api(path)] #[ruma_api(path)]
pub event_id: &'a EventId, pub event_id: &'a EventId,
/// The thread this receipt applies to.
///
/// *Note* that this must be the default value if used with
/// [`ReceiptType::FullyRead`].
///
/// Defaults to [`ReceiptThread::Unthreaded`].
#[serde(rename = "thread_id", skip_serializing_if = "ruma_common::serde::is_default")]
pub thread: ReceiptThread,
} }
#[derive(Default)] #[derive(Default)]
@ -48,7 +58,7 @@ pub mod v3 {
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given room ID, receipt type and event ID. /// Creates a new `Request` with the given room ID, receipt type and event ID.
pub fn new(room_id: &'a RoomId, receipt_type: ReceiptType, event_id: &'a EventId) -> Self { pub fn new(room_id: &'a RoomId, receipt_type: ReceiptType, event_id: &'a EventId) -> Self {
Self { room_id, receipt_type, event_id } Self { room_id, receipt_type, event_id, thread: ReceiptThread::default() }
} }
} }