use std::fmt::Display;
use serde::{Serialize, Deserialize};
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
pub enum NewsStatus {
#[default]
ACTIVE,
INACTIVE,
}
impl Display for NewsStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ACTIVE => write!(f, "ACTIVE"),
Self::INACTIVE => write!(f, "INACTIVE")
}
}
}
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
pub enum NewsLang {
#[default]
EN,
ES,
TR,
FR,
JP,
PT,
}
impl Display for NewsLang {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::EN => write!(f, "EN"),
Self::ES => write!(f, "ES"),
Self::TR => write!(f, "TR"),
Self::FR => write!(f, "FR"),
Self::JP => write!(f, "JP"),
Self::PT => write!(f, "PT"),
}
}
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum NewsSourceID {
CoinDesk,
CoinTelegraph,
BitcoinMagazine,
CryptoGlobe,
CoinGape,
Blockworks,
TheDailyHodl,
CryptoSlate,
CryptoPotato,
Decrypt,
CryptoBriefing,
TheBlock,
BitcoinDotCom,
NewsBTC,
UToday,
Bitcoinist,
Coinpedia,
Cryptonomist,
CryptoNewsReview,
CCData,
Cryptoknowmics,
CCN,
FinanceMagnates,
ETHNewsDotCom,
CryptoVest,
CryptoInsider,
HuobiBlog,
CoinSpeaker,
CoinJoker,
NintyNineBitcoins,
Cointelligence,
OKXInsights,
CryptoCoreMedia,
Bitcoinerx,
AMBCrypto,
Coinpaprika,
LiveBitcoinNews,
CryptoCompare,
BitDegree,
TheCoinRepublic,
Chaindd,
Chaintimes,
TheCoinRise,
CryptoNewsZ,
YahooFinanceBitcoin,
VauldInsights,
ZyCrypto,
KrakenBlog,
Coincu,
DailyCoin,
TrustNodes,
Coinnounce,
CoinEdition,
BitcoinSistemi,
TheNewsCrypto,
ForbesDigitalAssets,
Cryptonews,
TimesNext,
EthereumWorldNews,
CryptoCoinDotNews,
BTCPulse,
BloombergCrypto,
CoinOtag,
CryptoDotNews,
Chainwire,
CryptoIntelligence,
Coinpaper,
BitfinexBlog,
TheCryptoBasic,
NFTDotNews,
Blokt,
BitcoinWorld,
CryptoDaily,
TimesTabloid,
CoinTurkNews,
Invezz,
SeekingAlpha,
Finbold,
FinancialTimesCrypto,
Cryptopolitan,
NullTx,
TipRanks,
TheDefiant,
}
impl Display for NewsSourceID {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::CoinDesk => write!(f, "coindesk"),
Self::CoinTelegraph => write!(f, "cointelegraph"),
Self::BitcoinMagazine => write!(f, "bitcoinmagazine"),
Self::CryptoGlobe => write!(f, "cryptoglobe"),
Self::CoinGape => write!(f, "coingape"),
Self::Blockworks => write!(f, "blockworks"),
Self::TheDailyHodl => write!(f, "dailyhodl"),
Self::CryptoSlate => write!(f, "cryptoslate"),
Self::CryptoPotato => write!(f, "cryptopotato"),
Self::Decrypt => write!(f, "decrypt"),
Self::CryptoBriefing => write!(f, "cryptobriefing"),
Self::TheBlock => write!(f, "theblock"),
Self::BitcoinDotCom => write!(f, "bitcoin.com"),
Self::NewsBTC => write!(f, "newsbtc"),
Self::UToday => write!(f, "utoday"),
Self::Bitcoinist => write!(f, "bitcoinist"),
Self::Coinpedia => write!(f, "coinpedia"),
Self::Cryptonomist => write!(f, "cryptonomist"),
Self::CryptoNewsReview => write!(f, "cryptonewsreview"),
Self::CCData => write!(f, "ccdata"),
Self::Cryptoknowmics => write!(f, "cryptokowmics"),
Self::CCN => write!(f, "ccn"),
Self::FinanceMagnates => write!(f, "financemagnates"),
Self::ETHNewsDotCom => write!(f, "ethnews.com"),
Self::CryptoVest => write!(f, "cryptovest"),
Self::CryptoInsider => write!(f, "cryptoinsider"),
Self::HuobiBlog => write!(f, "huobi"),
Self::CoinSpeaker => write!(f, "coinspeaker"),
Self::CoinJoker => write!(f, "coinjoker"),
Self::NintyNineBitcoins => write!(f, "99bitcoins"),
Self::Cointelligence => write!(f, "cointelligence"),
Self::OKXInsights => write!(f, "okexinsights"),
Self::CryptoCoreMedia => write!(f, "cryptocoremedia"),
Self::Bitcoinerx => write!(f, "bitcoinerx"),
Self::AMBCrypto => write!(f, "ambcrypto"),
Self::Coinpaprika => write!(f, "coinpaprika"),
Self::LiveBitcoinNews => write!(f, "livebitcoinnews"),
Self::CryptoCompare => write!(f, "cryptocompare"),
Self::BitDegree => write!(f, "bitdegree"),
Self::TheCoinRepublic => write!(f, "coinrepublic"),
Self::Chaindd => write!(f, "chaindd"),
Self::Chaintimes => write!(f, "chaintimes"),
Self::TheCoinRise => write!(f, "thecoinrise"),
Self::CryptoNewsZ => write!(f, "cryptonewsz"),
Self::YahooFinanceBitcoin => write!(f, "yahoofinance"),
Self::VauldInsights => write!(f, "vauld_insights"),
Self::ZyCrypto => write!(f, "zycrypto"),
Self::KrakenBlog => write!(f, "krakenblog"),
Self::Coincu => write!(f, "coincu"),
Self::DailyCoin => write!(f, "dailycoin"),
Self::TrustNodes => write!(f, "trustnodes"),
Self::Coinnounce => write!(f, "coinnounce"),
Self::CoinEdition => write!(f, "coinquora"),
Self::BitcoinSistemi => write!(f, "bitcoinsistemi"),
Self::TheNewsCrypto => write!(f, "thenewscrypto"),
Self::ForbesDigitalAssets => write!(f, "forbes"),
Self::Cryptonews => write!(f, "cryptonews"),
Self::TimesNext => write!(f, "timesnext"),
Self::EthereumWorldNews => write!(f, "ethereumworldnews"),
Self::CryptoCoinDotNews => write!(f, "cryptocoinnews"),
Self::BTCPulse => write!(f, "btcpulse"),
Self::BloombergCrypto => write!(f, "bloomberg_crypto_"),
Self::CoinOtag => write!(f, "coinotag"),
Self::CryptoDotNews => write!(f, "crypto_news"),
Self::Chainwire => write!(f, "chainwire"),
Self::CryptoIntelligence => write!(f, "cryptointelligence"),
Self::Coinpaper => write!(f, "coinpaper"),
Self::BitfinexBlog => write!(f, "bitfinexblog"),
Self::TheCryptoBasic => write!(f, "thecryptobasic"),
Self::NFTDotNews => write!(f, "nft_news"),
Self::Blokt => write!(f, "blokt"),
Self::BitcoinWorld => write!(f, "bitcoinworld"),
Self::CryptoDaily => write!(f, "cryptodaily"),
Self::TimesTabloid => write!(f, "timestabloid"),
Self::CoinTurkNews => write!(f, "cointurken"),
Self::Invezz => write!(f, "invezz"),
Self::SeekingAlpha => write!(f, "seekingalpha"),
Self::Finbold => write!(f, "finbold"),
Self::FinancialTimesCrypto => write!(f, "financial_times_"),
Self::Cryptopolitan => write!(f, "cryptopolitan"),
Self::NullTx => write!(f, "themerkle"),
Self::TipRanks => write!(f, "tipranks"),
Self::TheDefiant => write!(f, "thedefiant"),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CategoryData {
#[serde(rename = "TYPE")]
pub type_: String,
#[serde(rename = "ID")]
pub id: i32,
#[serde(rename = "NAME")]
pub name: String,
#[serde(rename = "CATEGORY")]
pub category: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NewsLatestArticle {
#[serde(rename = "TYPE")]
pub type_: String,
#[serde(rename = "ID")]
pub id: i32,
#[serde(rename = "GUID")]
pub guid: String,
#[serde(rename = "PUBLISHED_ON")]
pub published_on: i64,
#[serde(rename = "IMAGE_URL")]
pub image_url: String,
#[serde(rename = "TITLE")]
pub title: String,
#[serde(rename = "URL")]
pub url: String,
#[serde(rename = "SOURCE_ID")]
pub source_id: i32,
#[serde(rename = "BODY")]
pub body: String,
#[serde(rename = "KEYWORDS")]
pub keywords: String,
#[serde(rename = "LANG")]
pub lang: String,
#[serde(rename = "UPVOTES")]
pub upvotes: i32,
#[serde(rename = "DOWNVOTES")]
pub downvotes: i32,
#[serde(rename = "SCORE")]
pub score: i32,
#[serde(rename = "SENTIMENT")]
pub sentiment: String,
#[serde(rename = "STATUS")]
pub status: String,
#[serde(rename = "CREATED_ON")]
pub created_on: i64,
#[serde(rename = "UPDATED_ON")]
pub updated_on: Option<i64>,
#[serde(rename = "SOURCE_DATA")]
pub source_data: NewsSource,
#[serde(rename = "CATEGORY_DATA")]
pub category_date: Vec<CategoryData>,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub enum NewsSourceType {
RSS,
API,
TWITTER,
}
impl Display for NewsSourceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::RSS => write!(f, "RSS"),
Self::API => write!(f, "API"),
Self::TWITTER => write!(f, "TWITTER"),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NewsSource {
#[serde(rename = "TYPE")]
pub type_: String,
#[serde(rename = "ID")]
pub id: i32,
#[serde(rename = "SOURCE_KEY")]
pub source_key: String,
#[serde(rename = "NAME")]
pub name: String,
#[serde(rename = "IMAGE_URL")]
pub image_url: Option<String>,
#[serde(rename = "URL")]
pub url: String,
#[serde(rename = "LANG")]
pub lang: String,
#[serde(rename = "SOURCE_TYPE")]
pub source_type: String,
#[serde(rename = "LAUNCH_DATE")]
pub launch_date: Option<i64>,
#[serde(rename = "SORT_ORDER")]
pub sort_order: i32,
#[serde(rename = "BENCHMARK_SCORE")]
pub benchmark_score: i32,
#[serde(rename = "STATUS")]
pub status: String,
#[serde(rename = "LAST_UPDATED_TS")]
pub last_updated_ts: i64,
#[serde(rename = "CREATED_ON")]
pub created_on: i64,
#[serde(rename = "UPDATED_ON")]
pub updated_on: Option<i64>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CategoryFilter {
#[serde(rename = "INCLUDED_WORDS")]
pub included_words: Option<Vec<String>>,
#[serde(rename = "INCLUDED_PHRASES")]
pub included_phrases: Option<Vec<String>>,
#[serde(rename = "EXCLUDED_PHRASES")]
pub excluded_phrases: Option<Vec<String>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NewsCategory {
#[serde(rename = "TYPE")]
pub type_: String,
#[serde(rename = "ID")]
pub id: i32,
#[serde(rename = "NAME")]
pub name: String,
#[serde(rename = "FILTER")]
pub filter: Option<CategoryFilter>,
#[serde(rename = "STATUS")]
pub status: String,
#[serde(rename = "CREATED_ON")]
pub created_on: i64,
#[serde(rename = "UPDATED_ON")]
pub updated_on: Option<i64>,
}