Struct matrix_sdk_crypto::requests::ToDeviceRequest
source · pub struct ToDeviceRequest {
pub event_type: ToDeviceEventType,
pub txn_id: OwnedTransactionId,
pub messages: BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>,
}
Expand description
Customized version of
ruma_client_api::to_device::send_event_to_device::v3::Request
Fields§
§event_type: ToDeviceEventType
Type of event being sent to each device.
txn_id: OwnedTransactionId
A request identifier unique to the access token used to send the request.
messages: BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>
A map of users to devices to a content for a message event to be
sent to the user’s device. Individual message events can be sent
to devices, but all events must be of the same type.
The content’s type for this field will be updated in a future
release, until then you can create a value using
serde_json::value::to_raw_value
.
Implementations§
source§impl ToDeviceRequest
impl ToDeviceRequest
sourcepub fn new(
recipient: &UserId,
recipient_device: impl Into<DeviceIdOrAllDevices>,
event_type: &str,
content: Raw<AnyToDeviceEventContent>
) -> Self
pub fn new( recipient: &UserId, recipient_device: impl Into<DeviceIdOrAllDevices>, event_type: &str, content: Raw<AnyToDeviceEventContent> ) -> Self
Create a new owned to-device request
Arguments
-
recipient
- The ID of the user that should receive this to-device event. -
recipient_device
- The device that should receive this to-device event, or all devices. -
event_type
- The type of the event content that is getting sent out. -
content
- The content of the to-device event.
sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of unique messages this request contains.
Note: A single message may be sent to multiple devices, so this may or may not be the number of devices that will receive the messages as well.
Trait Implementations§
source§impl Clone for ToDeviceRequest
impl Clone for ToDeviceRequest
source§fn clone(&self) -> ToDeviceRequest
fn clone(&self) -> ToDeviceRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more