[][src]Struct transistor::http::HttpClient

pub struct HttpClient { /* fields omitted */ }

HttpClient has the reqwest::blocking::Client, the uri to query and the HeaderMap with all the possible headers. Default header is Content-Type: "application/edn". Synchronous request.

Implementations

impl HttpClient[src]

pub fn tx_log(&self, actions: Vec<Action>) -> Result<TxLogResponse, CruxError>[src]

Function tx_log requests endpoint /tx-log via POST which allow you to send actions Action to CruxDB. The "write" endpoint, to post transactions.

pub fn tx_logs(&self) -> Result<TxLogsResponse, CruxError>[src]

Function tx_logs requests endpoint /tx-log via GET and returns a list of all transactions

pub fn entity(&self, id: String) -> Result<Edn, CruxError>[src]

Function entity requests endpoint /entity via POST which retrieves the last document in CruxDB. Field with CruxId is required. Response is a reqwest::Result<edn_rs::Edn> with the last Entity with that ID.

pub fn entity_timed(
    &self,
    id: String,
    transaction_time: Option<DateTime<FixedOffset>>,
    valid_time: Option<DateTime<FixedOffset>>
) -> Result<Edn, CruxError>
[src]

Function entity_timed is like entity but with two optional fields transaction_time and valid_time that are of type Option<DateTime<FixedOffset>>.

pub fn entity_tx(&self, id: String) -> Result<EntityTxResponse, CruxError>[src]

Function entity_tx requests endpoint /entity-tx via POST which retrieves the docs and tx infos for the last document for that ID saved in CruxDB.

pub fn entity_tx_timed(
    &self,
    id: String,
    transaction_time: Option<DateTime<FixedOffset>>,
    valid_time: Option<DateTime<FixedOffset>>
) -> Result<EntityTxResponse, CruxError>
[src]

Function entity_tx_timed is like entity_tx but with two optional fields transaction_time and valid_time that are of type Option<DateTime<FixedOffset>>.

pub fn entity_history(
    &self,
    hash: String,
    order: Order,
    with_docs: bool
) -> Result<EntityHistoryResponse, CruxError>
[src]

Function entity_history requests endpoint /entity-history via GET which returns a list with all entity's transaction history. It is possible to order it with Order , types::http::Order::Asc and types::http::Order:Desc, (second argument) and to include the document for each transaction with the boolean flag with_docs (third argument).

pub fn entity_history_timed(
    &self,
    hash: String,
    order: Order,
    with_docs: bool,
    time: Vec<TimeHistory>
) -> Result<EntityHistoryResponse, CruxError>
[src]

Function entity_history_timed is an txtension of the function entity_history. This function receives as the last argument a vector containing TimeHistory elements. TimeHistory can be ValidTime or TransactionTime and both have optional DateTime<Utc> params corresponding to the start-time and end-time to be queried.

pub fn query(&self, query: Query) -> Result<BTreeSet<Vec<String>>, CruxError>[src]

Function query requests endpoint /query via POST which retrives a Set containing a vector of the values defined by the function Query::find - github example. Argument is a query of the type Query.

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, 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.