twapi_v2/responses/
note_tweet.rs1use crate::responses::entities::Entities;
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
5pub struct NoteTweet {
6 #[serde(skip_serializing_if = "Option::is_none")]
7 pub text: Option<String>,
8 #[serde(skip_serializing_if = "Option::is_none")]
9 pub entities: Option<Entities>,
10 #[serde(flatten)]
11 pub extra: std::collections::HashMap<String, serde_json::Value>,
12}
13
14impl NoteTweet {
15 pub fn is_empty_extra(&self) -> bool {
16 let res = self.extra.is_empty()
17 && self
18 .entities
19 .as_ref()
20 .map(|it| it.is_empty_extra())
21 .unwrap_or(true);
22 if !res {
23 println!("NoteTweet {:?}", self.extra);
24 }
25 res
26 }
27}