[][src]Struct raystack::SkySparkClient

pub struct SkySparkClient { /* fields omitted */ }

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]

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 SkySparkClients, 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]

pub async fn his_write_bool(
    &mut self,
    id: &Ref,
    his_data: &[(DateTime<Tz>, bool)]
) -> Result<Grid, Error>
[src]

pub async fn his_write_num(
    &mut self,
    id: &Ref,
    his_data: &[(DateTime<Tz>, f64)],
    unit: Option<&str>
) -> Result<Grid, Error>
[src]

pub async fn his_write_str(
    &mut self,
    id: &Ref,
    his_data: &[(DateTime<Tz>, String)]
) -> Result<Grid, Error>
[src]

pub async fn utc_his_write_bool(
    &mut self,
    id: &Ref,
    time_zone_name: &str,
    his_data: &[(DateTime<Utc>, bool)]
) -> Result<Grid, Error>
[src]

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]

pub async fn utc_his_write_str(
    &mut self,
    id: &Ref,
    time_zone_name: &str,
    his_data: &[(DateTime<Utc>, String)]
) -> Result<Grid, Error>
[src]

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]

pub async fn read_by_ids(&mut self, ids: &[Ref]) -> Result<Grid, Error>[src]

impl SkySparkClient[src]

pub async fn eval(&mut self, axon_expr: &str) -> Result<Grid, Error>[src]

Trait Implementations

impl Debug for SkySparkClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.