Skip to main content

xmtp_mls/groups/
send_message_opts.rs

1use derive_builder::Builder;
2
3// Options to apply when sending a message
4#[derive(Debug, Clone, Builder, Default)]
5pub struct SendMessageOpts {
6    pub should_push: bool,
7    /// Optional caller-supplied idempotency key. The message id is derived from
8    /// this key, so re-sending identical content with the same key yields the
9    /// same id and is deduplicated. When `None`, the client creates a random key.
10    #[builder(default)]
11    pub idempotency_key: Option<String>,
12}
13
14#[cfg(test)]
15mod tests {
16    use super::*;
17
18    #[test]
19    fn test_send_message_opts_builder() {
20        let opts = SendMessageOptsBuilder::default()
21            .should_push(true)
22            .build()
23            .unwrap();
24
25        assert!(opts.should_push);
26    }
27}