[−][src]Struct raystack::SkySparkClient
A client for interacting with a SkySpark server.
Implementations
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 mut 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(&mut self) -> Result<Grid, Error>
[src]
pub async fn formats(&mut self) -> Result<Grid, Error>
[src]
pub async fn his_read(
&mut self,
id: &Ref,
range: &HisReadRange
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
range: &HisReadRange
) -> Result<Grid, Error>
pub async fn his_write_bool(
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, bool)]
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, bool)]
) -> Result<Grid, Error>
pub async fn his_write_num(
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, f64)],
unit: Option<&str>
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, f64)],
unit: Option<&str>
) -> Result<Grid, Error>
pub async fn his_write_str(
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, String)]
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
his_data: &[(DateTime<Tz>, String)]
) -> Result<Grid, Error>
pub async fn utc_his_write_bool(
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, bool)]
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, bool)]
) -> Result<Grid, Error>
pub async fn utc_his_write_num(
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, f64)],
unit: Option<&str>
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, f64)],
unit: Option<&str>
) -> Result<Grid, Error>
pub async fn utc_his_write_str(
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, String)]
) -> Result<Grid, Error>
[src]
&mut self,
id: &Ref,
time_zone_name: &str,
his_data: &[(DateTime<Utc>, String)]
) -> Result<Grid, Error>
pub async fn nav(&mut self, nav_id: Option<&str>) -> Result<Grid, Error>
[src]
pub async fn ops(&mut self) -> Result<Grid, Error>
[src]
pub async fn read(
&mut self,
filter: &str,
limit: Option<u64>
) -> Result<Grid, Error>
[src]
&mut self,
filter: &str,
limit: Option<u64>
) -> Result<Grid, Error>
pub async fn read_by_ids(&mut self, ids: &[Ref]) -> Result<Grid, Error>
[src]
impl SkySparkClient
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for SkySparkClient
[src]
impl Send for SkySparkClient
[src]
impl Sync for SkySparkClient
[src]
impl Unpin for SkySparkClient
[src]
impl !UnwindSafe for SkySparkClient
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,