Struct raystack::SkySparkClient [−][src]
pub struct SkySparkClient { /* fields omitted */ }
Expand description
A client for interacting with a SkySpark server.
Implementations
pub async fn new(
project_api_url: Url,
username: &str,
password: &str,
client_seed: ClientSeed
) -> Result<Self, NewSkySparkClientError>
[src]
pub async fn new(
project_api_url: Url,
username: &str,
password: &str,
client_seed: ClientSeed
) -> Result<Self, NewSkySparkClientError>
[src]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.
Return the project name for this client.
Return the project API url being used by this client.
Returns a grid containing basic server information.
Returns a grid describing what MIME types are available.
Returns a grid of history data for a single point.
Writes boolean values to a single point.
Writes numeric values to a single point. unit
must be a valid
Haystack unit literal, such as L/s
or celsius
.
Writes string values to a single point.
Writes boolean values with UTC timestamps to a single point.
time_zone_name
must be a valid SkySpark timezone name.
Writes numeric values with UTC timestamps to a single point.
unit
must be a valid Haystack unit literal, such as L/s
or
celsius
.
time_zone_name
must be a valid SkySpark timezone name.
Writes string values with UTC timestamps to a single point.
time_zone_name
must be a valid SkySpark timezone name.
The Haystack nav operation.
Returns a grid containing the operations available on the server.
Returns a grid containing the records matching the given Axon filter string.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for SkySparkClient
impl Send for SkySparkClient
impl Sync for SkySparkClient
impl Unpin for SkySparkClient
impl !UnwindSafe for SkySparkClient