Skip to main content

transistor/
lib.rs

1pub use edn_rs;
2
3/// Generic Request/Response Types for Crux.
4/// Availables types are:
5/// * `CruxId` is the field that receives a String and serielizes it to a EDN Keyword.
6///
7/// Availables types for responses in module `types::response` are:
8/// * `StateResponse` response for Crux REST API at endpoint `/state`.
9/// * `TxLogResponse` response for Crux REST API at endpoint `/tx-log`. For `POSTs`, `tx__event___tx_events (:crux-tx.event/tx_events)` comes with `None`.
10/// * `TxLogsResponse` response is the wrapper for a `GET` at endpoint `/tx-logs`, it is a `Vector` of type `TxLogResponse`.
11/// * `EntityTxResponse` response for Crux REST API at `/entity-tx` endpoint.
12/// * `EntityHistoryResponse` response for Crux REST API at `/entity-history`.
13/// * `QueryAsyncResponse` is a Future response for a query on Crux REST Api at `/query`, feature `async` is required.
14///
15/// Available auxiliary Enums for HTTP in module `types::http`:
16/// * Enum [`Action`](../types/http/enum.Action.html) is available in this module.
17/// * Enum [`Order`](../types/http/enum.Order.html)  is available in this module to be used with `entity_history`.
18/// * Enum [`TimeHistory`](../types/http/enum.TimeHistory.html)  is available in this module to be used with `entity_history_timed`.
19///
20/// It is possible to use `chrono`  for time related responses (`TxLogResponse`, `EntityTxResponse`, `EntityHistoryElement`). to use it you need to enable feature `"time".
21pub mod types;
22
23/// Http Client  module. It contains the [`HttpClient`](../http/struct.HttpClient.html#impl) for Docker and Standalone HTTP Server.
24///
25/// `HttpClient` Contains the following functions:
26/// * `tx_log` requests endpoint `/tx-log` via `POST`. A Vector of `types::http::Action` is expected as argument.
27/// * `tx_logs` requests endpoint `/tx-log` via `GET`. No args.
28/// * `entity` requests endpoint `/entity` via `POST`. A serialized `CruxId`, serialized `Edn::Key` or a String containing a [`keyword`](https://github.com/edn-format/edn#keywords) must be passed as argument.
29/// * `entity_timed` similar to `entity`, but receives as arguments `transaction_time: Option<DateTime<FixedOffset>>` and `valid_time: Option<DateTime<FixedOffset>>,`.
30/// * `entity_tx` requests endpoint `/entity-tx` via `POST`. A serialized `CruxId`, serialized `Edn::Key` or a String containing a [`keyword`](https://github.com/edn-format/edn#keywords) must be passed as argument.
31/// * `entity_tx_timed` similar to `entity_tx`, but receives as arguments `transaction_time: Option<DateTime<FixedOffset>>` and `valid_time: Option<DateTime<FixedOffset>>,`.
32/// * `entity_history` requests endpoint `/entity-history` via `GET`. Arguments are the `crux.db/id` as a `String`, an ordering argument defined by the enum `types::http::Order` (`Asc` or `Desc`) and a boolean for the `with-docs?` flag (this returns values for the field `:crux.db/doc`).
33/// * `entity_history_timed` similar to `entity_history`, but receives one more argument that is a `Vec<TimeHistory>` to define `valid-time` and `transaction-time`
34/// * `query` requests endpoint `/query` via `POST`. Argument is a `query` of the type `Query`. Retrives a Set containing a vector of the values defined by the function `Query::find`.
35/// * All endpoints support async calls when `--feature "async"` is enabled, check [`async_<...>` examples](https://github.com/naomijub/transistor/tree/master/examples) for usage. [Tokio runtime](https://docs.rs/tokio/0.2.22/tokio/) is required.
36///
37/// Examples can be found in the [examples directory](https://github.com/naomijub/transistor/tree/master/examples).
38pub mod http;
39
40/// This module contains the basic client, struct `Crux`, which configures `host:port` and `authorization`, and returns the needed `client`.
41pub mod client;