use crate::prelude::*;
pub struct NewsItem {
pub headline: String,
pub source: String,
pub url: String,
pub summary: String,
pub image_url: Option<String>,
pub language: Option<String>,
pub categories: Option<Vec<String>>,
pub sub_categories: Option<Vec<String>>,
}
pub type NewsFeed = Vec<Snapshot<NewsItem>>;
pub trait FetchNews {
fn latest_news(&self, for_symbol: Symbol, max_items: usize) -> RequestResult<NewsFeed>;
fn news_from(
&self,
for_symbol: Symbol,
start_date: Date,
max_items: usize,
) -> RequestResult<NewsFeed>;
}
pub trait FetchCategoryNews {
fn latest_news(
&self,
category: String,
sub_category: Option<String>,
max_items: usize,
) -> RequestResult<NewsFeed>;
fn news_from(
&self,
category: String,
sub_category: Option<String>,
start_date: Date,
max_items: usize,
) -> RequestResult<NewsFeed>;
}