1use std::fmt::Display;
2use serde::{Serialize, Deserialize};
3
4
5#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
6pub enum NewsStatus {
11 #[default]
12 ACTIVE,
13 INACTIVE,
14}
15
16impl Display for NewsStatus {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 match self {
19 Self::ACTIVE => write!(f, "ACTIVE"),
20 Self::INACTIVE => write!(f, "INACTIVE")
21 }
22 }
23}
24
25
26#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
27pub enum NewsLang {
29 #[default]
30 EN,
31 ES,
32 TR,
33 FR,
34 JP,
35 PT,
36}
37
38impl Display for NewsLang {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40 match self {
41 Self::EN => write!(f, "EN"),
42 Self::ES => write!(f, "ES"),
43 Self::TR => write!(f, "TR"),
44 Self::FR => write!(f, "FR"),
45 Self::JP => write!(f, "JP"),
46 Self::PT => write!(f, "PT"),
47 }
48 }
49}
50
51
52#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
56pub enum NewsSourceID {
59 CoinDesk,
60 CoinTelegraph,
61 BitcoinMagazine,
62 CryptoGlobe,
63 CoinGape,
64 Blockworks,
65 TheDailyHodl,
66 CryptoSlate,
67 CryptoPotato,
68 Decrypt,
69 CryptoBriefing,
70 TheBlock,
71 BitcoinDotCom,
72 NewsBTC,
73 UToday,
74 Bitcoinist,
75 Coinpedia,
76 Cryptonomist,
77 CryptoNewsReview,
78 CCData,
79 Cryptoknowmics,
80 CCN,
81 FinanceMagnates,
82 ETHNewsDotCom,
83 CryptoVest,
84 CryptoInsider,
85 HuobiBlog,
86 CoinSpeaker,
87 CoinJoker,
88 NintyNineBitcoins,
89 Cointelligence,
90 OKXInsights,
91 CryptoCoreMedia,
92 Bitcoinerx,
93 AMBCrypto,
94 Coinpaprika,
95 LiveBitcoinNews,
96 CryptoCompare,
97 BitDegree,
98 TheCoinRepublic,
99 Chaindd,
100 Chaintimes,
101 TheCoinRise,
102 CryptoNewsZ,
103 YahooFinanceBitcoin,
104 VauldInsights,
105 ZyCrypto,
106 KrakenBlog,
107 Coincu,
108 DailyCoin,
109 TrustNodes,
110 Coinnounce,
111 CoinEdition,
112 BitcoinSistemi,
113 TheNewsCrypto,
114 ForbesDigitalAssets,
115 Cryptonews,
116 TimesNext,
117 EthereumWorldNews,
118 CryptoCoinDotNews,
119 BTCPulse,
120 BloombergCrypto,
121 CoinOtag,
122 CryptoDotNews,
123 Chainwire,
124 CryptoIntelligence,
125 Coinpaper,
126 BitfinexBlog,
127 TheCryptoBasic,
128 NFTDotNews,
129 Blokt,
130 BitcoinWorld,
131 CryptoDaily,
132 TimesTabloid,
133 CoinTurkNews,
134 Invezz,
135 SeekingAlpha,
136 Finbold,
137 FinancialTimesCrypto,
138 Cryptopolitan,
139 NullTx,
140 TipRanks,
141 TheDefiant,
142}
143
144impl Display for NewsSourceID {
145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
146 match self {
147 Self::CoinDesk => write!(f, "coindesk"),
148 Self::CoinTelegraph => write!(f, "cointelegraph"),
149 Self::BitcoinMagazine => write!(f, "bitcoinmagazine"),
150 Self::CryptoGlobe => write!(f, "cryptoglobe"),
151 Self::CoinGape => write!(f, "coingape"),
152 Self::Blockworks => write!(f, "blockworks"),
153 Self::TheDailyHodl => write!(f, "dailyhodl"),
154 Self::CryptoSlate => write!(f, "cryptoslate"),
155 Self::CryptoPotato => write!(f, "cryptopotato"),
156 Self::Decrypt => write!(f, "decrypt"),
157 Self::CryptoBriefing => write!(f, "cryptobriefing"),
158 Self::TheBlock => write!(f, "theblock"),
159 Self::BitcoinDotCom => write!(f, "bitcoin.com"),
160 Self::NewsBTC => write!(f, "newsbtc"),
161 Self::UToday => write!(f, "utoday"),
162 Self::Bitcoinist => write!(f, "bitcoinist"),
163 Self::Coinpedia => write!(f, "coinpedia"),
164 Self::Cryptonomist => write!(f, "cryptonomist"),
165 Self::CryptoNewsReview => write!(f, "cryptonewsreview"),
166 Self::CCData => write!(f, "ccdata"),
167 Self::Cryptoknowmics => write!(f, "cryptokowmics"),
168 Self::CCN => write!(f, "ccn"),
169 Self::FinanceMagnates => write!(f, "financemagnates"),
170 Self::ETHNewsDotCom => write!(f, "ethnews.com"),
171 Self::CryptoVest => write!(f, "cryptovest"),
172 Self::CryptoInsider => write!(f, "cryptoinsider"),
173 Self::HuobiBlog => write!(f, "huobi"),
174 Self::CoinSpeaker => write!(f, "coinspeaker"),
175 Self::CoinJoker => write!(f, "coinjoker"),
176 Self::NintyNineBitcoins => write!(f, "99bitcoins"),
177 Self::Cointelligence => write!(f, "cointelligence"),
178 Self::OKXInsights => write!(f, "okexinsights"),
179 Self::CryptoCoreMedia => write!(f, "cryptocoremedia"),
180 Self::Bitcoinerx => write!(f, "bitcoinerx"),
181 Self::AMBCrypto => write!(f, "ambcrypto"),
182 Self::Coinpaprika => write!(f, "coinpaprika"),
183 Self::LiveBitcoinNews => write!(f, "livebitcoinnews"),
184 Self::CryptoCompare => write!(f, "cryptocompare"),
185 Self::BitDegree => write!(f, "bitdegree"),
186 Self::TheCoinRepublic => write!(f, "coinrepublic"),
187 Self::Chaindd => write!(f, "chaindd"),
188 Self::Chaintimes => write!(f, "chaintimes"),
189 Self::TheCoinRise => write!(f, "thecoinrise"),
190 Self::CryptoNewsZ => write!(f, "cryptonewsz"),
191 Self::YahooFinanceBitcoin => write!(f, "yahoofinance"),
192 Self::VauldInsights => write!(f, "vauld_insights"),
193 Self::ZyCrypto => write!(f, "zycrypto"),
194 Self::KrakenBlog => write!(f, "krakenblog"),
195 Self::Coincu => write!(f, "coincu"),
196 Self::DailyCoin => write!(f, "dailycoin"),
197 Self::TrustNodes => write!(f, "trustnodes"),
198 Self::Coinnounce => write!(f, "coinnounce"),
199 Self::CoinEdition => write!(f, "coinquora"),
200 Self::BitcoinSistemi => write!(f, "bitcoinsistemi"),
201 Self::TheNewsCrypto => write!(f, "thenewscrypto"),
202 Self::ForbesDigitalAssets => write!(f, "forbes"),
203 Self::Cryptonews => write!(f, "cryptonews"),
204 Self::TimesNext => write!(f, "timesnext"),
205 Self::EthereumWorldNews => write!(f, "ethereumworldnews"),
206 Self::CryptoCoinDotNews => write!(f, "cryptocoinnews"),
207 Self::BTCPulse => write!(f, "btcpulse"),
208 Self::BloombergCrypto => write!(f, "bloomberg_crypto_"),
209 Self::CoinOtag => write!(f, "coinotag"),
210 Self::CryptoDotNews => write!(f, "crypto_news"),
211 Self::Chainwire => write!(f, "chainwire"),
212 Self::CryptoIntelligence => write!(f, "cryptointelligence"),
213 Self::Coinpaper => write!(f, "coinpaper"),
214 Self::BitfinexBlog => write!(f, "bitfinexblog"),
215 Self::TheCryptoBasic => write!(f, "thecryptobasic"),
216 Self::NFTDotNews => write!(f, "nft_news"),
217 Self::Blokt => write!(f, "blokt"),
218 Self::BitcoinWorld => write!(f, "bitcoinworld"),
219 Self::CryptoDaily => write!(f, "cryptodaily"),
220 Self::TimesTabloid => write!(f, "timestabloid"),
221 Self::CoinTurkNews => write!(f, "cointurken"),
222 Self::Invezz => write!(f, "invezz"),
223 Self::SeekingAlpha => write!(f, "seekingalpha"),
224 Self::Finbold => write!(f, "finbold"),
225 Self::FinancialTimesCrypto => write!(f, "financial_times_"),
226 Self::Cryptopolitan => write!(f, "cryptopolitan"),
227 Self::NullTx => write!(f, "themerkle"),
228 Self::TipRanks => write!(f, "tipranks"),
229 Self::TheDefiant => write!(f, "thedefiant"),
230 }
231 }
232}
233
234#[derive(Clone, Debug, Serialize, Deserialize)]
235pub struct CategoryData {
236 #[serde(rename = "TYPE")]
237 pub type_: String,
239 #[serde(rename = "ID")]
240 pub id: i32,
242 #[serde(rename = "NAME")]
243 pub name: String,
245 #[serde(rename = "CATEGORY")]
246 pub category: String,
247}
248
249#[derive(Clone, Debug, Serialize, Deserialize)]
251pub struct NewsLatestArticle {
252 #[serde(rename = "TYPE")]
253 pub type_: String,
255 #[serde(rename = "ID")]
256 pub id: i32,
258 #[serde(rename = "GUID")]
259 pub guid: String,
262 #[serde(rename = "PUBLISHED_ON")]
263 pub published_on: i64,
266 #[serde(rename = "IMAGE_URL")]
267 pub image_url: String,
270 #[serde(rename = "TITLE")]
271 pub title: String,
273 #[serde(rename = "URL")]
274 pub url: String,
277 #[serde(rename = "SOURCE_ID")]
278 pub source_id: i32,
281 #[serde(rename = "BODY")]
282 pub body: String,
285 #[serde(rename = "KEYWORDS")]
286 pub keywords: String,
289 #[serde(rename = "LANG")]
290 pub lang: String,
292 #[serde(rename = "UPVOTES")]
293 pub upvotes: i32,
295 #[serde(rename = "DOWNVOTES")]
296 pub downvotes: i32,
298 #[serde(rename = "SCORE")]
299 pub score: i32,
301 #[serde(rename = "SENTIMENT")]
302 pub sentiment: String,
304 #[serde(rename = "STATUS")]
305 pub status: String,
307 #[serde(rename = "CREATED_ON")]
308 pub created_on: i64,
310 #[serde(rename = "UPDATED_ON")]
311 pub updated_on: Option<i64>,
313 #[serde(rename = "SOURCE_DATA")]
314 pub source_data: NewsSource,
316 #[serde(rename = "CATEGORY_DATA")]
317 pub category_date: Vec<CategoryData>,
319}
320
321
322
323#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
327pub enum NewsSourceType {
333 RSS,
334 API,
335 TWITTER,
336}
337
338impl Display for NewsSourceType {
339 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
340 match self {
341 Self::RSS => write!(f, "RSS"),
342 Self::API => write!(f, "API"),
343 Self::TWITTER => write!(f, "TWITTER"),
344 }
345 }
346}
347
348
349#[derive(Clone, Debug, Serialize, Deserialize)]
351pub struct NewsSource {
352 #[serde(rename = "TYPE")]
353 pub type_: String,
355 #[serde(rename = "ID")]
356 pub id: i32,
358 #[serde(rename = "SOURCE_KEY")]
359 pub source_key: String,
361 #[serde(rename = "NAME")]
362 pub name: String,
364 #[serde(rename = "IMAGE_URL")]
365 pub image_url: Option<String>,
367 #[serde(rename = "URL")]
368 pub url: String,
370 #[serde(rename = "LANG")]
371 pub lang: String,
373 #[serde(rename = "SOURCE_TYPE")]
374 pub source_type: String,
376 #[serde(rename = "LAUNCH_DATE")]
377 pub launch_date: Option<i64>,
379 #[serde(rename = "SORT_ORDER")]
380 pub sort_order: i32,
382 #[serde(rename = "BENCHMARK_SCORE")]
383 pub benchmark_score: i32,
384 #[serde(rename = "STATUS")]
385 pub status: String,
387 #[serde(rename = "LAST_UPDATED_TS")]
388 pub last_updated_ts: i64,
390 #[serde(rename = "CREATED_ON")]
391 pub created_on: i64,
393 #[serde(rename = "UPDATED_ON")]
394 pub updated_on: Option<i64>,
396}
397
398
399#[derive(Clone, Debug, Serialize, Deserialize)]
404pub struct CategoryFilter {
405 #[serde(rename = "INCLUDED_WORDS")]
406 pub included_words: Option<Vec<String>>,
408 #[serde(rename = "INCLUDED_PHRASES")]
409 pub included_phrases: Option<Vec<String>>,
411 #[serde(rename = "EXCLUDED_PHRASES")]
412 pub excluded_phrases: Option<Vec<String>>,
414}
415
416
417#[derive(Clone, Debug, Serialize, Deserialize)]
419pub struct NewsCategory {
420 #[serde(rename = "TYPE")]
421 pub type_: String,
423 #[serde(rename = "ID")]
424 pub id: i32,
426 #[serde(rename = "NAME")]
427 pub name: String,
429 #[serde(rename = "FILTER")]
430 pub filter: Option<CategoryFilter>,
432 #[serde(rename = "STATUS")]
433 pub status: String,
435 #[serde(rename = "CREATED_ON")]
436 pub created_on: i64,
438 #[serde(rename = "UPDATED_ON")]
439 pub updated_on: Option<i64>,
441}