pub struct MessageCreate {
pub reactions: Vec<MessageCreateReaction>,
pub urls: Vec<MessageCreateUrl>,
pub text: String,
pub media_urls: Vec<String>,
pub sender_id: String,
pub id: String,
pub created_at: DateTime<Utc>,
}Expand description
Note, other than the lack of a recipient_id (recipientId) key, this is identical to
MessageCreate from twitter_archive::structs::direct_messages
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601::FORMAT;
use twitter_archive::structs::direct_messages_group::MessageCreate;
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#"{{
"reactions": [],
"urls": [],
"text": "Salutations!",
"mediaUrls": [],
"senderId": "111111111",
"id": "3333333333333333333",
"createdAt": "{created_at_string}"
}}"#);
let data: MessageCreate = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.reactions.len(), 0);
assert_eq!(data.urls.len(), 0);
assert_eq!(data.media_urls.len(), 0);
assert_eq!(data.sender_id, "111111111");
assert_eq!(data.id, "3333333333333333333");
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§
§reactions: Vec<MessageCreateReaction>List data about who, when, and what reactions were had about a given message
§Example JSON data
{ "reactions": [] }urls: Vec<MessageCreateUrl>List of mangled/tracking URL data that includes originally written link too
§Example JSON data
{ "urls": [] }text: StringContent of message with embedded newlines \n where applicable
§Example JSON data
{ "text": "Salutations!" }media_urls: Vec<String>Finally a simple array of strings without unnecessary modifications or parsing required!
§Example JSON data
{ "mediaUrls": [] }sender_id: StringURL formats;
- Desktop: https://twitter.com/i/user/{sender_id}
Note; does not work if not logged-in. Thanks be to Mr. Musk !-D
§Example JSON data
{ "senderId": "111111111" }id: StringPossibly unique ID across all conversations and messages
Report url maybe built via; https://twitter.com/i/report/dm_message/{id}
§Example JSON data
{ "id": "3333333333333333333" }created_at: DateTime<Utc>Date time-stamp of when message was originally sent
§Example JSON data
{ "createdAt": "2020-01-20T21:42:09.068Z" }Trait Implementations§
Source§impl Clone for MessageCreate
impl Clone for MessageCreate
Source§fn clone(&self) -> MessageCreate
fn clone(&self) -> MessageCreate
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 MessageCreate
impl Debug for MessageCreate
Source§impl<'de> Deserialize<'de> for MessageCreate
impl<'de> Deserialize<'de> for MessageCreate
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 MessageCreate
impl Display for MessageCreate
Auto Trait Implementations§
impl Freeze for MessageCreate
impl RefUnwindSafe for MessageCreate
impl Send for MessageCreate
impl Sync for MessageCreate
impl Unpin for MessageCreate
impl UnwindSafe for MessageCreate
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