diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index 5c33c156..1b3425f0 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -18,6 +18,7 @@ Improvements: * Add support for the pagination direction parameter to `/relations` (MSC3715 / 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) +* Add support for read receipts for threads (MSC3771 / Matrix 1.4) # 0.15.1 diff --git a/crates/ruma-client-api/src/receipt/create_receipt.rs b/crates/ruma-client-api/src/receipt/create_receipt.rs index d84843fc..65b89f71 100644 --- a/crates/ruma-client-api/src/receipt/create_receipt.rs +++ b/crates/ruma-client-api/src/receipt/create_receipt.rs @@ -7,6 +7,7 @@ pub mod v3 { use ruma_common::{ api::ruma_api, + events::receipt::ReceiptThread, serde::{OrdAsRefStr, PartialEqAsRefStr, PartialOrdAsRefStr, StringEnum}, EventId, RoomId, }; @@ -37,6 +38,15 @@ pub mod v3 { /// The event ID to acknowledge up to. #[ruma_api(path)] 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)] @@ -48,7 +58,7 @@ pub mod v3 { impl<'a> Request<'a> { /// 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 { - Self { room_id, receipt_type, event_id } + Self { room_id, receipt_type, event_id, thread: ReceiptThread::default() } } }