ccdata_api/schemas/data_api/
news.rs

1use serde::Deserialize;
2
3
4/// List of statuses used to filter articles based on their source integration state.
5/// Current allowed values are: ACTIVE, INACTIVE. An ACTIVE status indicates that the source's integration, such as an RSS feed,
6/// is currently operational and actively providing data. An INACTIVE status is assigned to sources that have either blocked access,
7/// disabled their integration mechanisms, or ceased operations. More statuses may be added in the future as source integration scenarios evolve.
8pub enum CCNewsStatus {
9    ACTIVE,
10    INACTIVE,
11}
12
13impl CCNewsStatus {
14    /// Converts enum value to `String`
15    pub fn to_string(&self) -> String {
16        match self {
17            CCNewsStatus::ACTIVE => String::from("ACTIVE"),
18            CCNewsStatus::INACTIVE => String::from("INACTIVE")
19        }
20    }
21}
22
23
24/// The preferred language for the sources or articles - English (EN), Espanol (ES), Turkish (TR), French (FR), Japanese (JP), Portuguese (PT).
25pub enum CCNewsLang {
26    EN,
27    ES,
28    TR,
29    FR,
30    JP,
31    PT,
32}
33
34impl CCNewsLang {
35    /// Converts enum value to `String`.
36    pub fn to_string(&self) -> String {
37        match self {
38            CCNewsLang::EN => String::from("EN"),
39            CCNewsLang::ES => String::from("ES"),
40            CCNewsLang::TR => String::from("TR"),
41            CCNewsLang::FR => String::from("FR"),
42            CCNewsLang::JP => String::from("JP"),
43            CCNewsLang::PT => String::from("PT"),
44        }
45    }
46}
47
48
49// News: Latest Articles
50
51
52/// Get articles from specific sources based on their keys. If left empty it will just return news from ACTIVE sources for the selected language,
53/// if you want to get inactive sources as well, please pass them in alongside the active ones in this array.
54pub enum CCNewsSourceID {
55    CoinDesk,
56    CoinTelegraph,
57    BitcoinMagazine,
58    CryptoGlobe,
59    CoinGape,
60    Blockworks,
61    TheDailyHodl,
62    CryptoSlate,
63    CryptoPotato,
64    Decrypt,
65    CryptoBriefing,
66    TheBlock,
67    BitcoinDotCom,
68    NewsBTC,
69    UToday,
70    Bitcoinist,
71    Coinpedia,
72    Cryptonomist,
73    CryptoNewsReview,
74    CCData,
75    Cryptoknowmics,
76    CCN,
77    FinanceMagnates,
78    ETHNewsDotCom,
79    CryptoVest,
80    CryptoInsider,
81    HuobiBlog,
82    CoinSpeaker,
83    CoinJoker,
84    NintyNineBitcoins,
85    Cointelligence,
86    OKXInsights,
87    CryptoCoreMedia,
88    Bitcoinerx,
89    AMBCrypto,
90    Coinpaprika,
91    LiveBitcoinNews,
92    CryptoCompare,
93    BitDegree,
94    TheCoinRepublic,
95    Chaindd,
96    Chaintimes,
97    TheCoinRise,
98    CryptoNewsZ,
99    YahooFinanceBitcoin,
100    VauldInsights,
101    ZyCrypto,
102    KrakenBlog,
103    Coincu,
104    DailyCoin,
105    TrustNodes,
106    Coinnounce,
107    CoinEdition,
108    BitcoinSistemi,
109    TheNewsCrypto,
110    ForbesDigitalAssets,
111    Cryptonews,
112    TimesNext,
113    EthereumWorldNews,
114    CryptoCoinDotNews,
115    BTCPulse,
116    BloombergCrypto,
117    CoinOtag,
118    CryptoDotNews,
119    Chainwire,
120    CryptoIntelligence,
121    Coinpaper,
122    BitfinexBlog,
123    TheCryptoBasic,
124    NFTDotNews,
125    Blokt,
126    BitcoinWorld,
127    CryptoDaily,
128    TimesTabloid,
129    CoinTurkNews,
130    Invezz,
131    SeekingAlpha,
132    Finbold,
133    FinancialTimesCrypto,
134    Cryptopolitan,
135    NullTx,
136    TipRanks,
137    TheDefiant,
138}
139
140impl CCNewsSourceID {
141    /// Converts enum value to `String`.
142    pub fn to_string(&self) -> String {
143        match self {
144            CCNewsSourceID::CoinDesk => String::from("coindesk"),
145            CCNewsSourceID::CoinTelegraph => String::from("cointelegraph"),
146            CCNewsSourceID::BitcoinMagazine => String::from("bitcoinmagazine"),
147            CCNewsSourceID::CryptoGlobe => String::from("cryptoglobe"),
148            CCNewsSourceID::CoinGape => String::from("coingape"),
149            CCNewsSourceID::Blockworks => String::from("blockworks"),
150            CCNewsSourceID::TheDailyHodl => String::from("dailyhodl"),
151            CCNewsSourceID::CryptoSlate => String::from("cryptoslate"),
152            CCNewsSourceID::CryptoPotato => String::from("cryptopotato"),
153            CCNewsSourceID::Decrypt => String::from("decrypt"),
154            CCNewsSourceID::CryptoBriefing => String::from("cryptobriefing"),
155            CCNewsSourceID::TheBlock => String::from("theblock"),
156            CCNewsSourceID::BitcoinDotCom => String::from("bitcoin.com"),
157            CCNewsSourceID::NewsBTC => String::from("newsbtc"),
158            CCNewsSourceID::UToday => String::from("utoday"),
159            CCNewsSourceID::Bitcoinist => String::from("bitcoinist"),
160            CCNewsSourceID::Coinpedia => String::from("coinpedia"),
161            CCNewsSourceID::Cryptonomist => String::from("cryptonomist"),
162            CCNewsSourceID::CryptoNewsReview => String::from("cryptonewsreview"),
163            CCNewsSourceID::CCData => String::from("ccdata"),
164            CCNewsSourceID::Cryptoknowmics => String::from("cryptokowmics"),
165            CCNewsSourceID::CCN => String::from("ccn"),
166            CCNewsSourceID::FinanceMagnates => String::from("financemagnates"),
167            CCNewsSourceID::ETHNewsDotCom => String::from("ethnews.com"),
168            CCNewsSourceID::CryptoVest => String::from("cryptovest"),
169            CCNewsSourceID::CryptoInsider => String::from("cryptoinsider"),
170            CCNewsSourceID::HuobiBlog => String::from("huobi"),
171            CCNewsSourceID::CoinSpeaker => String::from("coinspeaker"),
172            CCNewsSourceID::CoinJoker => String::from("coinjoker"),
173            CCNewsSourceID::NintyNineBitcoins => String::from("99bitcoins"),
174            CCNewsSourceID::Cointelligence => String::from("cointelligence"),
175            CCNewsSourceID::OKXInsights => String::from("okexinsights"),
176            CCNewsSourceID::CryptoCoreMedia => String::from("cryptocoremedia"),            
177            CCNewsSourceID::Bitcoinerx => String::from("bitcoinerx"),
178            CCNewsSourceID::AMBCrypto => String::from("ambcrypto"),
179            CCNewsSourceID::Coinpaprika => String::from("coinpaprika"),
180            CCNewsSourceID::LiveBitcoinNews => String::from("livebitcoinnews"),
181            CCNewsSourceID::CryptoCompare => String::from("cryptocompare"),
182            CCNewsSourceID::BitDegree => String::from("bitdegree"),
183            CCNewsSourceID::TheCoinRepublic => String::from("coinrepublic"),
184            CCNewsSourceID::Chaindd => String::from("chaindd"),
185            CCNewsSourceID::Chaintimes => String::from("chaintimes"),
186            CCNewsSourceID::TheCoinRise => String::from("thecoinrise"),
187            CCNewsSourceID::CryptoNewsZ => String::from("cryptonewsz"),
188            CCNewsSourceID::YahooFinanceBitcoin => String::from("yahoofinance"),
189            CCNewsSourceID::VauldInsights => String::from("vauld_insights"),
190            CCNewsSourceID::ZyCrypto => String::from("zycrypto"),
191            CCNewsSourceID::KrakenBlog => String::from("krakenblog"),
192            CCNewsSourceID::Coincu => String::from("coincu"),
193            CCNewsSourceID::DailyCoin => String::from("dailycoin"),
194            CCNewsSourceID::TrustNodes => String::from("trustnodes"),
195            CCNewsSourceID::Coinnounce => String::from("coinnounce"),
196            CCNewsSourceID::CoinEdition => String::from("coinquora"),
197            CCNewsSourceID::BitcoinSistemi => String::from("bitcoinsistemi"),
198            CCNewsSourceID::TheNewsCrypto => String::from("thenewscrypto"),
199            CCNewsSourceID::ForbesDigitalAssets => String::from("forbes"),
200            CCNewsSourceID::Cryptonews => String::from("cryptonews"),
201            CCNewsSourceID::TimesNext => String::from("timesnext"),
202            CCNewsSourceID::EthereumWorldNews => String::from("ethereumworldnews"),
203            CCNewsSourceID::CryptoCoinDotNews => String::from("cryptocoinnews"),
204            CCNewsSourceID::BTCPulse => String::from("btcpulse"),
205            CCNewsSourceID::BloombergCrypto => String::from("bloomberg_crypto_"),
206            CCNewsSourceID::CoinOtag => String::from("coinotag"),
207            CCNewsSourceID::CryptoDotNews => String::from("crypto_news"),
208            CCNewsSourceID::Chainwire => String::from("chainwire"),
209            CCNewsSourceID::CryptoIntelligence => String::from("cryptointelligence"),
210            CCNewsSourceID::Coinpaper => String::from("coinpaper"),
211            CCNewsSourceID::BitfinexBlog => String::from("bitfinexblog"),
212            CCNewsSourceID::TheCryptoBasic => String::from("thecryptobasic"),
213            CCNewsSourceID::NFTDotNews => String::from("nft_news"),
214            CCNewsSourceID::Blokt => String::from("blokt"),
215            CCNewsSourceID::BitcoinWorld => String::from("bitcoinworld"),
216            CCNewsSourceID::CryptoDaily => String::from("cryptodaily"),
217            CCNewsSourceID::TimesTabloid => String::from("timestabloid"),
218            CCNewsSourceID::CoinTurkNews => String::from("cointurken"),
219            CCNewsSourceID::Invezz => String::from("invezz"),
220            CCNewsSourceID::SeekingAlpha => String::from("seekingalpha"),
221            CCNewsSourceID::Finbold => String::from("finbold"),
222            CCNewsSourceID::FinancialTimesCrypto => String::from("financial_times_"),
223            CCNewsSourceID::Cryptopolitan => String::from("cryptopolitan"),
224            CCNewsSourceID::NullTx => String::from("themerkle"),
225            CCNewsSourceID::TipRanks => String::from("tipranks"),
226            CCNewsSourceID::TheDefiant => String::from("thedefiant"),
227        }
228    }
229}
230
231#[derive(Deserialize, Debug)]
232pub struct CCCategoryData {
233    #[serde(rename = "TYPE")]
234    /// Type of the message.
235    pub type_: String,
236    #[serde(rename = "ID")]
237    /// The unique identifier for the news category entry.
238    pub id: i32,
239    #[serde(rename = "NAME")]
240    /// The name of the news category.
241    pub name: String,
242    #[serde(rename = "CATEGORY")]
243    pub category: String,
244}
245
246/// News: Latest Articles
247#[derive(Deserialize, Debug)]
248pub struct CCNewsLatestArticle {
249    #[serde(rename = "TYPE")]
250    /// Type of the message.
251    pub type_: String,
252    #[serde(rename = "ID")]
253    /// The unique identifier for the article entry.
254    pub id: i32,
255    #[serde(rename = "GUID")]
256    /// The Global Unique Identifier (GUID) of the article. A GUID is a unique reference number used as an identifier in computer systems.
257    /// The "Article guid" is unique for every article and serves as its distinct identifier.
258    pub guid: String,
259    #[serde(rename = "PUBLISHED_ON")]
260    /// The unix timestamp when the article was first published. This information is useful for understanding the timeline of the content,
261    /// sorting articles by date, or determining the recency of the information.
262    pub published_on: i64,
263    #[serde(rename = "IMAGE_URL")]
264    /// The URL, or web address, of the article's associated or featured image. This URL can be used to retrieve the image for display,
265    /// providing a visual context for the article content. The URL points directly to the location where the image file is stored online.
266    pub image_url: String,
267    #[serde(rename = "TITLE")]
268    /// The heading or title of a specific article. It's a text string that gives a concise description of the article's content.
269    pub title: String,
270    #[serde(rename = "URL")]
271    /// The web address that directs to the specific content or article on a source website. It's a unique URL used for directly
272    /// linking to the article or for fetching additional data from the article page.
273    pub url: String,
274    #[serde(rename = "SOURCE_ID")]
275    /// The unique identifier for the source of the article or content. The "SOURCE_ID" allows for easy tracking and categorization of articles
276    /// based on their origin, facilitating analysis by source, or fetching additional content from the same source.
277    pub source_id: i32,
278    #[serde(rename = "BODY")]
279    /// The main textual content of the article. It includes the substance of the article but it it generally very limited since sources want
280    /// clients to visit their website. This is where the primary information of the article is found.
281    pub body: String,
282    #[serde(rename = "KEYWORDS")]
283    /// 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
284    /// a summary of the main themes, topics, or subjects covered in the article.
285    pub keywords: String,
286    #[serde(rename = "LANG")]
287    /// The article Preferred language - English (EN), Portuguese (PT), Espanol (ES), Turkish (TR), French (FR).
288    pub lang: String,
289    #[serde(rename = "UPVOTES")]
290    /// The number of upvotes this article has.
291    pub upvotes: i32,
292    #[serde(rename = "DOWNVOTES")]
293    /// The number of downvotes this article has.
294    pub downvotes: i32,
295    #[serde(rename = "SCORE")]
296    /// The score of this article.
297    pub score: i32,
298    #[serde(rename = "SENTIMENT")]
299    /// The sentiment polarity of this article. We compute this using ChatGPT.
300    pub sentiment: String,
301    #[serde(rename = "STATUS")]
302    /// The status for the Article. Allowed values: ACTIVE, DELETED.
303    pub status: String,
304    #[serde(rename = "CREATED_ON")]
305    /// Article internal creation unix ts in our system.
306    pub created_on: i64,
307    #[serde(rename = "UPDATED_ON")]
308    /// Article internal last updated unix ts in our system.
309    pub updated_on: Option<i64>,
310    #[serde(rename = "SOURCE_DATA")]
311    /// The news source data of this article.
312    pub source_data: CCNewsSource,
313    #[serde(rename = "CATEGORY_DATA")]
314    /// An array of categories this article belongs to.
315    pub category_date: Vec<CCCategoryData>,
316}
317
318
319
320// News: Sources
321
322/// Specifies the type of integration used by the news source. Current allowed values are RSS, API, and TWITTER.
323/// 'RSS' indicates a source that distributes content via RSS feeds.
324/// 'API' refers to sources that provide data through a standardized programming interface.
325/// 'TWITTER' represents sources that disseminate information directly through Twitter.
326/// This parameter helps in selecting the method through which news content is retrieved.
327pub enum CCNewsSourceType {
328    RSS,
329    API,
330    TWITTER,
331}
332
333impl CCNewsSourceType {
334    /// Converts enum value to `String`.
335    pub fn to_string(&self) -> String {
336        match self {
337            CCNewsSourceType::RSS => String::from("RSS"),
338            CCNewsSourceType::API => String::from("API"),
339            CCNewsSourceType::TWITTER => String::from("TWITTER"),
340        }
341    }
342}
343
344
345/// News: Sources
346#[derive(Deserialize, Debug)]
347pub struct CCNewsSource {
348    #[serde(rename = "TYPE")]
349    /// Type of the message.
350    pub type_: String,
351    #[serde(rename = "ID")]
352    /// The unique identifier for the news source entry.
353    pub id: i32,
354    #[serde(rename = "SOURCE_KEY")]
355    /// The unique key for a news source.
356    pub source_key: String,
357    #[serde(rename = "NAME")]
358    /// The name of the news source".
359    pub name: String,
360    #[serde(rename = "IMAGE_URL")]
361    /// The image url for the article source.
362    pub image_url: String,
363    #[serde(rename = "URL")]
364    /// The URL of the news source.
365    pub url: String,
366    #[serde(rename = "LANG")]
367    /// The Article Source Preferred language - English (EN), Portuguese (PT), Espanol (ES), Turkish (TR), French (FR).
368    pub lang: String,
369    #[serde(rename = "SOURCE_TYPE")]
370    /// RSS, API, TWITTER.
371    pub source_type: String,
372    #[serde(rename = "LAUNCH_DATE")]
373    /// The launch date of the source is indicated as (yyyy-mm-dd).
374    pub launch_date: Option<i64>,
375    #[serde(rename = "SORT_ORDER")]
376    /// Internal sort order of the source to define the field overwrites.
377    pub sort_order: i32,
378    #[serde(rename = "BENCHMARK_SCORE")]
379    pub benchmark_score: i32,
380    #[serde(rename = "STATUS")]
381    /// The status for the Article Source entry. Allowed values: ACTIVE, INACTIVE".
382    pub status: String,
383    #[serde(rename = "LAST_UPDATED_TS")]
384    /// The last script update timestamp for this article source.
385    pub last_updated_ts: i64,
386    #[serde(rename = "CREATED_ON")]
387    /// Article Source internal creation unix ts in our system.
388    pub created_on: i64,
389    #[serde(rename = "UPDATED_ON")]
390    /// Article Source internal last updated unix ts in our system.
391    pub updated_on: i64,
392}
393
394
395// News: Categories
396
397
398/// The filters for the news category.
399#[derive(Deserialize, Debug)]
400pub struct CCCategoryFilter {
401    #[serde(rename = "INCLUDED_WORDS")]
402    /// Words related or included in news category.
403    pub included_words: Option<Vec<String>>,
404    #[serde(rename = "INCLUDED_PHRASES")]
405    /// Phrases that should be included in news category.
406    pub included_phrases: Option<Vec<String>>,
407    #[serde(rename = "EXCLUDED_PHRASES")]
408    /// Phrases to should be excluded from news category.
409    pub excluded_phrases: Option<Vec<String>>,
410}
411
412
413/// News: Categories
414#[derive(Deserialize, Debug)]
415pub struct CCNewsCategory {
416    #[serde(rename = "TYPE")]
417    /// Type of the message.
418    pub type_: String,
419    #[serde(rename = "ID")]
420    /// The unique identifier for the news category entry.
421    pub id: i32,
422    #[serde(rename = "NAME")]
423    /// The name of the news category.
424    pub name: String,
425    #[serde(rename = "FILTER")]
426    /// The filters for the news category.
427    pub filter: Option<CCCategoryFilter>,
428    #[serde(rename = "STATUS")]
429    /// The status for the News category entry. Allowed values: ACTIVE, INACTIVE.
430    pub status: String,
431    #[serde(rename = "CREATED_ON")]
432    /// News category internal creation unix ts in our system
433    pub created_on: i64,
434    #[serde(rename = "UPDATED_ON")]
435    /// News category internal last updated unix ts in our system.
436    pub updated_on: Option<i64>,
437}