pub struct PolestarClient { /* private fields */ }Expand description
Main client for interacting with the Polestar API.
§Example
use polestar_api::PolestarClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = PolestarClient::new("your_username", "your_password")?;
let telemetry = client.get_telemetry("YOUR_VIN").await?;
Ok(())
}Implementations§
Source§impl PolestarClient
impl PolestarClient
Sourcepub fn new(
username: impl Into<String>,
password: impl Into<String>,
) -> Result<Self>
pub fn new( username: impl Into<String>, password: impl Into<String>, ) -> Result<Self>
Creates a new Polestar API client with the provided credentials.
The client will use these credentials to authenticate with the Polestar API via the web-based login flow and obtain access tokens as needed.
§Arguments
username- Polestar account username (email)password- Polestar account password
§Example
let client = PolestarClient::new("user@example.com", "password").unwrap();Sourcepub async fn get_telemetry(&self, vin: &str) -> Result<Telemetry>
pub async fn get_telemetry(&self, vin: &str) -> Result<Telemetry>
Trait Implementations§
Source§impl Clone for PolestarClient
impl Clone for PolestarClient
Source§fn clone(&self) -> PolestarClient
fn clone(&self) -> PolestarClient
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 PolestarClient
impl !RefUnwindSafe for PolestarClient
impl Send for PolestarClient
impl Sync for PolestarClient
impl Unpin for PolestarClient
impl !UnwindSafe for PolestarClient
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