Skip to main content

ccdata_api/schemas/data_api/
news.rs

1use std::fmt::Display;
2use serde::{Serialize, Deserialize};
3
4
5#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
6/// List of statuses used to filter articles based on their source integration state.
7/// Current allowed values are: ACTIVE, INACTIVE. An ACTIVE status indicates that the source's integration, such as an RSS feed,
8/// is currently operational and actively providing data. An INACTIVE status is assigned to sources that have either blocked access,
9/// disabled their integration mechanisms, or ceased operations. More statuses may be added in the future as source integration scenarios evolve.
10pub 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)]
27/// The preferred language for the sources or articles - English (EN), Espanol (ES), Turkish (TR), French (FR), Japanese (JP), Portuguese (PT).
28pub 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// News: Latest Articles
53
54
55#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
56/// Get articles from specific sources based on their keys. If left empty it will just return news from ACTIVE sources for the selected language,
57/// if you want to get inactive sources as well, please pass them in alongside the active ones in this array.
58pub 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    /// Type of the message.
238    pub type_: String,
239    #[serde(rename = "ID")]
240    /// The unique identifier for the news category entry.
241    pub id: i32,
242    #[serde(rename = "NAME")]
243    /// The name of the news category.
244    pub name: String,
245    #[serde(rename = "CATEGORY")]
246    pub category: String,
247}
248
249/// News: Latest Articles
250#[derive(Clone, Debug, Serialize, Deserialize)]
251pub struct NewsLatestArticle {
252    #[serde(rename = "TYPE")]
253    /// Type of the message.
254    pub type_: String,
255    #[serde(rename = "ID")]
256    /// The unique identifier for the article entry.
257    pub id: i32,
258    #[serde(rename = "GUID")]
259    /// The Global Unique Identifier (GUID) of the article. A GUID is a unique reference number used as an identifier in computer systems.
260    /// The "Article guid" is unique for every article and serves as its distinct identifier.
261    pub guid: String,
262    #[serde(rename = "PUBLISHED_ON")]
263    /// The unix timestamp when the article was first published. This information is useful for understanding the timeline of the content,
264    /// sorting articles by date, or determining the recency of the information.
265    pub published_on: i64,
266    #[serde(rename = "IMAGE_URL")]
267    /// The URL, or web address, of the article's associated or featured image. This URL can be used to retrieve the image for display,
268    /// providing a visual context for the article content. The URL points directly to the location where the image file is stored online.
269    pub image_url: String,
270    #[serde(rename = "TITLE")]
271    /// The heading or title of a specific article. It's a text string that gives a concise description of the article's content.
272    pub title: String,
273    #[serde(rename = "URL")]
274    /// The web address that directs to the specific content or article on a source website. It's a unique URL used for directly
275    /// linking to the article or for fetching additional data from the article page.
276    pub url: String,
277    #[serde(rename = "SOURCE_ID")]
278    /// The unique identifier for the source of the article or content. The "SOURCE_ID" allows for easy tracking and categorization of articles
279    /// based on their origin, facilitating analysis by source, or fetching additional content from the same source.
280    pub source_id: i32,
281    #[serde(rename = "BODY")]
282    /// The main textual content of the article. It includes the substance of the article but it it generally very limited since sources want
283    /// clients to visit their website. This is where the primary information of the article is found.
284    pub body: String,
285    #[serde(rename = "KEYWORDS")]
286    /// A list of words or phrases that are relevant to the content of the article. These keywords are given by the source and serve as
287    /// a summary of the main themes, topics, or subjects covered in the article.
288    pub keywords: String,
289    #[serde(rename = "LANG")]
290    /// The article Preferred language - English (EN), Portuguese (PT), Espanol (ES), Turkish (TR), French (FR).
291    pub lang: String,
292    #[serde(rename = "UPVOTES")]
293    /// The number of upvotes this article has.
294    pub upvotes: i32,
295    #[serde(rename = "DOWNVOTES")]
296    /// The number of downvotes this article has.
297    pub downvotes: i32,
298    #[serde(rename = "SCORE")]
299    /// The score of this article.
300    pub score: i32,
301    #[serde(rename = "SENTIMENT")]
302    /// The sentiment polarity of this article. We compute this using ChatGPT.
303    pub sentiment: String,
304    #[serde(rename = "STATUS")]
305    /// The status for the Article. Allowed values: ACTIVE, DELETED.
306    pub status: String,
307    #[serde(rename = "CREATED_ON")]
308    /// Article internal creation unix ts in our system.
309    pub created_on: i64,
310    #[serde(rename = "UPDATED_ON")]
311    /// Article internal last updated unix ts in our system.
312    pub updated_on: Option<i64>,
313    #[serde(rename = "SOURCE_DATA")]
314    /// The news source data of this article.
315    pub source_data: NewsSource,
316    #[serde(rename = "CATEGORY_DATA")]
317    /// An array of categories this article belongs to.
318    pub category_date: Vec<CategoryData>,
319}
320
321
322
323// News: Sources
324
325
326#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
327/// Specifies the type of integration used by the news source. Current allowed values are RSS, API, and TWITTER.
328/// 'RSS' indicates a source that distributes content via RSS feeds.
329/// 'API' refers to sources that provide data through a standardized programming interface.
330/// 'TWITTER' represents sources that disseminate information directly through Twitter.
331/// This parameter helps in selecting the method through which news content is retrieved.
332pub 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/// News: Sources
350#[derive(Clone, Debug, Serialize, Deserialize)]
351pub struct NewsSource {
352    #[serde(rename = "TYPE")]
353    /// Type of the message.
354    pub type_: String,
355    #[serde(rename = "ID")]
356    /// The unique identifier for the news source entry.
357    pub id: i32,
358    #[serde(rename = "SOURCE_KEY")]
359    /// The unique key for a news source.
360    pub source_key: String,
361    #[serde(rename = "NAME")]
362    /// The name of the news source".
363    pub name: String,
364    #[serde(rename = "IMAGE_URL")]
365    /// The image url for the article source.
366    pub image_url: Option<String>,
367    #[serde(rename = "URL")]
368    /// The URL of the news source.
369    pub url: String,
370    #[serde(rename = "LANG")]
371    /// The Article Source Preferred language - English (EN), Portuguese (PT), Espanol (ES), Turkish (TR), French (FR).
372    pub lang: String,
373    #[serde(rename = "SOURCE_TYPE")]
374    /// RSS, API, TWITTER.
375    pub source_type: String,
376    #[serde(rename = "LAUNCH_DATE")]
377    /// The launch date of the source is indicated as (yyyy-mm-dd).
378    pub launch_date: Option<i64>,
379    #[serde(rename = "SORT_ORDER")]
380    /// Internal sort order of the source to define the field overwrites.
381    pub sort_order: i32,
382    #[serde(rename = "BENCHMARK_SCORE")]
383    pub benchmark_score: i32,
384    #[serde(rename = "STATUS")]
385    /// The status for the Article Source entry. Allowed values: ACTIVE, INACTIVE".
386    pub status: String,
387    #[serde(rename = "LAST_UPDATED_TS")]
388    /// The last script update timestamp for this article source.
389    pub last_updated_ts: i64,
390    #[serde(rename = "CREATED_ON")]
391    /// Article Source internal creation unix ts in our system.
392    pub created_on: i64,
393    #[serde(rename = "UPDATED_ON")]
394    /// Article Source internal last updated unix ts in our system.
395    pub updated_on: Option<i64>,
396}
397
398
399// News: Categories
400
401
402/// The filters for the news category.
403#[derive(Clone, Debug, Serialize, Deserialize)]
404pub struct CategoryFilter {
405    #[serde(rename = "INCLUDED_WORDS")]
406    /// Words related or included in news category.
407    pub included_words: Option<Vec<String>>,
408    #[serde(rename = "INCLUDED_PHRASES")]
409    /// Phrases that should be included in news category.
410    pub included_phrases: Option<Vec<String>>,
411    #[serde(rename = "EXCLUDED_PHRASES")]
412    /// Phrases to should be excluded from news category.
413    pub excluded_phrases: Option<Vec<String>>,
414}
415
416
417/// News: Categories
418#[derive(Clone, Debug, Serialize, Deserialize)]
419pub struct NewsCategory {
420    #[serde(rename = "TYPE")]
421    /// Type of the message.
422    pub type_: String,
423    #[serde(rename = "ID")]
424    /// The unique identifier for the news category entry.
425    pub id: i32,
426    #[serde(rename = "NAME")]
427    /// The name of the news category.
428    pub name: String,
429    #[serde(rename = "FILTER")]
430    /// The filters for the news category.
431    pub filter: Option<CategoryFilter>,
432    #[serde(rename = "STATUS")]
433    /// The status for the News category entry. Allowed values: ACTIVE, INACTIVE.
434    pub status: String,
435    #[serde(rename = "CREATED_ON")]
436    /// News category internal creation unix ts in our system
437    pub created_on: i64,
438    #[serde(rename = "UPDATED_ON")]
439    /// News category internal last updated unix ts in our system.
440    pub updated_on: Option<i64>,
441}