1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use super::ReferenceRelation;
use crate::OwnedEventId;
#[derive(Clone, Debug, Serialize, Deserialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "org.matrix.msc3381.poll.response", alias = "m.poll.response", kind = MessageLike)]
pub struct PollResponseEventContent {
#[serde(rename = "org.matrix.msc3381.poll.response", alias = "m.poll.response")]
pub poll_response: PollResponseContent,
#[serde(rename = "m.relates_to")]
pub relates_to: ReferenceRelation,
}
impl PollResponseEventContent {
pub fn new(poll_response: PollResponseContent, poll_start_id: OwnedEventId) -> Self {
Self { poll_response, relates_to: ReferenceRelation::new(poll_start_id) }
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct PollResponseContent {
pub answers: Vec<String>,
}
impl PollResponseContent {
pub fn new(answers: Vec<String>) -> Self {
Self { answers }
}
}