diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index d5c168f4..fccee448 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -17,6 +17,7 @@ Breaking changes: `ruma-common`); the previous fields are in the `Standard` variant * Use `GlobalAccountDataEventType` for `event_type` in `config::get_global_account_data` * Use `RoomAccountDataEventType` for `event_type` in `config::get_room_account_data` +* Use `ToDeviceEventType` for `event_type` in `to_device::send_event_to_device` Improvements: diff --git a/crates/ruma-client-api/src/to_device/send_event_to_device.rs b/crates/ruma-client-api/src/to_device/send_event_to_device.rs index 2e6d9dbd..04c96f05 100644 --- a/crates/ruma-client-api/src/to_device/send_event_to_device.rs +++ b/crates/ruma-client-api/src/to_device/send_event_to_device.rs @@ -11,7 +11,7 @@ pub mod v3 { use ruma_common::{ api::{request, response, Metadata}, - events::AnyToDeviceEventContent, + events::{AnyToDeviceEventContent, ToDeviceEventType}, metadata, serde::Raw, to_device::DeviceIdOrAllDevices, @@ -33,7 +33,7 @@ pub mod v3 { pub struct Request { /// Type of event being sent to each device. #[ruma_api(path)] - pub event_type: String, + pub event_type: ToDeviceEventType, /// The transaction ID for this event. /// @@ -61,7 +61,11 @@ pub mod v3 { impl Request { /// Creates a new `Request` with the given event type, transaction ID and raw messages. - pub fn new_raw(event_type: String, txn_id: OwnedTransactionId, messages: Messages) -> Self { + pub fn new_raw( + event_type: ToDeviceEventType, + txn_id: OwnedTransactionId, + messages: Messages, + ) -> Self { Self { event_type, txn_id, messages } } }