[][src]Struct raystack::SkySparkClient

pub struct SkySparkClient { /* fields omitted */ }

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]

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 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<'_>(&'_ 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]

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

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

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

pub async fn nav<'_, '_>(
    &'_ self,
    nav_id: Option<&'_ str>
) -> Result<Grid, Error>
[src]

pub async fn ops<'_>(&'_ self) -> Result<Grid, Error>[src]

pub async fn read<'_, '_>(
    &'_ self,
    filter: &'_ str,
    limit: Option<u64>
) -> Result<Grid, Error>
[src]

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

impl SkySparkClient[src]

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

Trait Implementations

impl Debug for SkySparkClient[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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