client-api: Use ToDeviceEventType in send_event_to_device

This commit is contained in:
Kévin Commaille 2023-01-04 15:52:28 +01:00 committed by Kévin Commaille
parent 6b31f66afc
commit 89e06adecf
2 changed files with 8 additions and 3 deletions

View File

@ -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:

View File

@ -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 }
}
}