pub struct MessageCreateReaction {
pub sender_id: String,
pub reaction_key: String,
pub event_id: String,
pub created_at: DateTime<Utc>,
}Expand description
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601::FORMAT;
use twitter_archive::structs::direct_message::MessageCreateReaction;
let created_at_string = "2020-01-20T21:42:09.068Z";
let created_at_native_time = NaiveDateTime::parse_from_str(&created_at_string, FORMAT).unwrap();
let created_at_date_time = DateTime::<Utc>::from_naive_utc_and_offset(created_at_native_time, Utc);
let json = format!(r#"{{
"senderId": "222222222",
"reactionKey": "excited",
"eventId": "1020304050607080901",
"createdAt": "{created_at_string}"
}}"#);
let data: MessageCreateReaction = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.sender_id, "222222222");
assert_eq!(data.reaction_key, "excited");
assert_eq!(data.event_id, "1020304050607080901");
assert_eq!(data.created_at, created_at_date_time);
// Re-serialize is equivalent to original data
assert_eq!(serde_json::to_string_pretty(&data).unwrap(), json);Fields§
§sender_id: String§reaction_key: String§event_id: StringPossibly unique ID across all conversations and messages
§Example JSON data
{ "eventId": "1020304050607080901" }created_at: DateTime<Utc>Trait Implementations§
Source§impl Clone for MessageCreateReaction
impl Clone for MessageCreateReaction
Source§fn clone(&self) -> MessageCreateReaction
fn clone(&self) -> MessageCreateReaction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageCreateReaction
impl Debug for MessageCreateReaction
Source§impl<'de> Deserialize<'de> for MessageCreateReaction
impl<'de> Deserialize<'de> for MessageCreateReaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MessageCreateReaction
impl Display for MessageCreateReaction
Auto Trait Implementations§
impl Freeze for MessageCreateReaction
impl RefUnwindSafe for MessageCreateReaction
impl Send for MessageCreateReaction
impl Sync for MessageCreateReaction
impl Unpin for MessageCreateReaction
impl UnwindSafe for MessageCreateReaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more