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
Implementation of our client to interact with the Amber REST API endpoints.
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 duplicate 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 Freeze for RestClient
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