mod api;
mod model;
mod wire;
pub use model::{EsgInvolvement, EsgScores, EsgSummary};
use crate::{YfClient, YfError, YfResponse, core::CallOptions};
pub struct EsgBuilder {
client: YfClient,
symbol: String,
options: CallOptions,
}
impl EsgBuilder {
pub fn new(client: &YfClient, symbol: impl Into<String>) -> Self {
Self {
client: client.clone(),
symbol: symbol.into(),
options: CallOptions::default(),
}
}
crate::core::impl_call_option_setters!();
pub async fn fetch(&self) -> Result<EsgSummary, YfError> {
Ok(self.fetch_with_diagnostics().await?.into_data())
}
pub async fn fetch_with_diagnostics(&self) -> Result<YfResponse<EsgSummary>, YfError> {
api::fetch_esg_scores(&self.client, &self.symbol, &self.options).await
}
}