tail-fin-twitter 0.5.1

Twitter/X adapter for tail-fin: timeline, search, profile, bookmarks, likes, thread, post, like, follow, block, bookmark, reply, trending, lists, article, download, notifications
Documentation
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Tweet {
    pub id: String,
    pub text: String,
    pub author: String,
    pub author_name: String,
    pub likes: u64,
    pub retweets: u64,
    pub replies: u64,
    pub views: Option<u64>,
    pub created_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimelineResponse {
    pub tweets: Vec<Tweet>,
    pub next_cursor: Option<String>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TimelineType {
    ForYou,
    Following,
}

impl TimelineType {
    pub fn endpoint(&self) -> &'static str {
        match self {
            Self::ForYou => "HomeTimeline",
            Self::Following => "HomeLatestTimeline",
        }
    }

    pub fn method(&self) -> &'static str {
        match self {
            Self::ForYou => "GET",
            Self::Following => "POST",
        }
    }

    pub fn fallback_query_id(&self) -> &'static str {
        match self {
            Self::ForYou => "HJFjzBgCs16TqxewQOeLNg",
            Self::Following => "DiTkXJgLqBBxCs7zaYsbtA",
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserProfile {
    pub screen_name: String,
    pub name: String,
    pub bio: String,
    pub location: String,
    pub url: String,
    pub followers: u64,
    pub following: u64,
    pub tweets: u64,
    pub likes: u64,
    pub verified: bool,
    pub created_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Trend {
    pub rank: u32,
    pub topic: String,
    pub tweets: String,
    pub category: String,
}

pub use tail_fin_common::ActionResult;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TwitterUser {
    pub screen_name: String,
    pub name: String,
    pub bio: String,
    pub followers: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Notification {
    pub id: String,
    pub action: String,
    pub author: String,
    pub text: String,
    pub url: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MediaItem {
    pub r#type: String,
    pub url: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TwitterList {
    pub id: String,
    pub name: String,
    pub member_count: u64,
    pub follower_count: u64,
    pub is_private: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Article {
    pub tweet_id: String,
    pub title: String,
    pub markdown: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DmResult {
    pub conversation: String,
    pub status: String,
    pub message: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AcceptResult {
    pub username: String,
    pub status: String,
    pub message: String,
}