Struct amber_client::rest_client::RestClient
source · pub struct RestClient {
pub url: String,
pub auth_token: String,
pub client: Client,
}Expand description
Struct type that provides options for our implementation of a reqwest client.
Fields§
§url: String§auth_token: String§client: ClientImplementations§
source§impl RestClient
impl RestClient
Implementation of our client to interact with the Amber REST API endpoints.
pub fn new_client(url: String, auth_token: String) -> Self
sourcepub async fn get_site_data(&mut self) -> Result<Vec<SiteDetails>, Error>
pub async fn get_site_data(&mut self) -> Result<Vec<SiteDetails>, Error>
RestClient function to request data from the Amber “/sites” endpoint.
sourcepub async fn get_price_data(&mut self) -> Result<Vec<PriceData>>
pub async fn get_price_data(&mut self) -> Result<Vec<PriceData>>
RestClient function to request data from the Amber “/prices” endpoint.
sourcepub async fn get_usage_data(&mut self) -> Result<Vec<UsageData>>
pub async fn get_usage_data(&mut self) -> Result<Vec<UsageData>>
RestClient function to request data from the Amber “/usage” endpoint.
sourcepub async fn get_renewables_data(&self) -> Result<Vec<RenewablesData>>
pub async fn get_renewables_data(&self) -> Result<Vec<RenewablesData>>
RustClient function to request data from the Amber “/renewables” endpoint.
Trait Implementations§
source§impl Clone for RestClient
impl Clone for RestClient
source§fn clone(&self) -> RestClient
fn clone(&self) -> RestClient
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RestClient
impl Send for RestClient
impl Sync for RestClient
impl Unpin for RestClient
impl !UnwindSafe for RestClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more