[−][src]Struct raystack::SkySparkClient
A client for interacting with a SkySpark server.
Methods
impl SkySparkClient
[src]
pub async fn new<'_, '_>(
project_api_url: Url,
username: &'_ str,
password: &'_ str,
client_seed: ClientSeed
) -> Result<Self, NewSkySparkClientError>
[src]
project_api_url: Url,
username: &'_ str,
password: &'_ str,
client_seed: ClientSeed
) -> Result<Self, NewSkySparkClientError>
Create a new SkySparkClient
.
Example
use raystack::{ClientSeed, SkySparkClient}; use url::Url; let timeout_in_seconds = 30; let client_seed = ClientSeed::new(timeout_in_seconds).unwrap(); let url = Url::parse("https://skyspark.company.com/api/bigProject/").unwrap(); let client = SkySparkClient::new(url, "username", "p4ssw0rd", client_seed).await.unwrap();
If creating multiple SkySparkClient
s,
the same ClientSeed
should be used for each. For example:
use raystack::{ClientSeed, SkySparkClient}; use url::Url; let client_seed = ClientSeed::new(30).unwrap(); let url1 = Url::parse("http://test.com/api/bigProject/").unwrap(); let client1 = SkySparkClient::new(url1, "name", "p4ssw0rd", client_seed.clone()).await.unwrap(); let url2 = Url::parse("http://test.com/api/smallProj/").unwrap(); let client2 = SkySparkClient::new(url2, "name", "p4ss", client_seed.clone()).await.unwrap();
We pass in the ClientSeed
struct because the underlying crypto library recommends that an
application should create a single random number generator and use
it for all randomness generation. Additionally, the underlying HTTP
library recommends using a single copy of its HTTP client. These two
resources are wrapped by this ClientSeed
struct.
pub fn project_name(&self) -> &str
[src]
Return the project name for this client.
pub fn project_api_url(&self) -> &Url
[src]
Return the project API url being used by this client.
impl SkySparkClient
[src]
pub async fn about<'_>(&'_ self) -> Result<Grid, Error>
[src]
pub async fn formats<'_>(&'_ self) -> Result<Grid, Error>
[src]
pub async fn his_read<'_, '_, '_>(
&'_ self,
id: &'_ Ref,
range: &'_ HisReadRange
) -> Result<Grid, Error>
[src]
&'_ self,
id: &'_ Ref,
range: &'_ HisReadRange
) -> Result<Grid, Error>
pub async fn his_write_bool<'_, '_, '_>(
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, bool)]
) -> Result<Grid, Error>
[src]
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, bool)]
) -> Result<Grid, Error>
pub async fn his_write_num<'_, '_, '_, '_>(
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, f64)],
unit: &'_ str
) -> Result<Grid, Error>
[src]
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, f64)],
unit: &'_ str
) -> Result<Grid, Error>
pub async fn his_write_str<'_, '_, '_>(
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, String)]
) -> Result<Grid, Error>
[src]
&'_ self,
id: &'_ Ref,
his_data: &'_ [(DateTime<Tz>, String)]
) -> Result<Grid, Error>
pub async fn nav<'_, '_>(
&'_ self,
nav_id: Option<&'_ str>
) -> Result<Grid, Error>
[src]
&'_ self,
nav_id: Option<&'_ str>
) -> Result<Grid, Error>
pub async fn ops<'_>(&'_ self) -> Result<Grid, Error>
[src]
pub async fn read<'_, '_>(
&'_ self,
filter: &'_ str,
limit: Option<u64>
) -> Result<Grid, Error>
[src]
&'_ self,
filter: &'_ str,
limit: Option<u64>
) -> Result<Grid, Error>
pub async fn read_by_ids<'_, '_>(
&'_ self,
ids: &'_ [Ref]
) -> Result<Grid, Error>
[src]
&'_ self,
ids: &'_ [Ref]
) -> Result<Grid, Error>
impl SkySparkClient
[src]
Trait Implementations
Auto Trait Implementations
impl Send for SkySparkClient
impl Sync for SkySparkClient
impl Unpin for SkySparkClient
impl !UnwindSafe for SkySparkClient
impl !RefUnwindSafe for SkySparkClient
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,