#![allow(unused_imports)]
use serde_json::Value;
use bigdecimal::BigDecimal;
use chrono::{NaiveDateTime, DateTime, FixedOffset, Utc};
use crate::models::*;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct News {
#[serde(rename = "symbols")]
symbols: Vec<String>, #[serde(rename = "title")]
title: String, #[serde(rename = "url")]
url: String, #[serde(rename = "source")]
source: String, #[serde(rename = "summary")]
summary: String, #[serde(rename = "image")]
image: Option<String>, #[serde(rename = "timestamp")]
timestamp: String, #[serde(rename = "keywords")]
keywords: Option<Vec<Value>> }
impl News {
pub fn new(symbols: Vec<String>, title: String, url: String, source: String, summary: String, timestamp: String, ) -> News {
News {
symbols: symbols,
title: title,
url: url,
source: source,
summary: summary,
image: None,
timestamp: timestamp,
keywords: None
}
}
pub fn set_symbols(&mut self, symbols: Vec<String>) {
self.symbols = symbols;
}
pub fn with_symbols(mut self, symbols: Vec<String>) -> News {
self.symbols = symbols;
self
}
pub fn symbols(&self) -> &Vec<String> {
&self.symbols
}
pub fn set_title(&mut self, title: String) {
self.title = title;
}
pub fn with_title(mut self, title: String) -> News {
self.title = title;
self
}
pub fn title(&self) -> &String {
&self.title
}
pub fn set_url(&mut self, url: String) {
self.url = url;
}
pub fn with_url(mut self, url: String) -> News {
self.url = url;
self
}
pub fn url(&self) -> &String {
&self.url
}
pub fn set_source(&mut self, source: String) {
self.source = source;
}
pub fn with_source(mut self, source: String) -> News {
self.source = source;
self
}
pub fn source(&self) -> &String {
&self.source
}
pub fn set_summary(&mut self, summary: String) {
self.summary = summary;
}
pub fn with_summary(mut self, summary: String) -> News {
self.summary = summary;
self
}
pub fn summary(&self) -> &String {
&self.summary
}
pub fn set_image(&mut self, image: String) {
self.image = Some(image);
}
pub fn with_image(mut self, image: String) -> News {
self.image = Some(image);
self
}
pub fn image(&self) -> Option<&String> {
self.image.as_ref()
}
pub fn reset_image(&mut self) {
self.image = None;
}
pub fn set_timestamp(&mut self, timestamp: String) {
self.timestamp = timestamp;
}
pub fn with_timestamp(mut self, timestamp: String) -> News {
self.timestamp = timestamp;
self
}
pub fn timestamp(&self) -> &String {
&self.timestamp
}
pub fn set_keywords(&mut self, keywords: Vec<Value>) {
self.keywords = Some(keywords);
}
pub fn with_keywords(mut self, keywords: Vec<Value>) -> News {
self.keywords = Some(keywords);
self
}
pub fn keywords(&self) -> Option<&Vec<Value>> {
self.keywords.as_ref()
}
pub fn reset_keywords(&mut self) {
self.keywords = None;
}
}