[][src]Module transistor::http

Http Client module. It contains the HttpClient for Docker and Standalone HTTP Server.

HttpClient Contains the following functions:

  • tx_log requests endpoint /tx-log via POST. A Vector of types::http::Action is expected as argument.
  • tx_logs requests endpoint /tx-log via GET. No args.
  • entity requests endpoint /entity via POST. A serialized CruxId, serialized Edn::Key or a String containing a keyword must be passed as argument.
  • entity_timed similar to entity, but receives as arguments transaction_time: Option<DateTime<FixedOffset>> and valid_time: Option<DateTime<FixedOffset>>,.
  • entity_tx requests endpoint /entity-tx via POST. A serialized CruxId, serialized Edn::Key or a String containing a keyword must be passed as argument.
  • entity_tx_timed similar to entity_tx, but receives as arguments transaction_time: Option<DateTime<FixedOffset>> and valid_time: Option<DateTime<FixedOffset>>,.
  • 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).
  • entity_history_timed similar to entity_history, but receives one more argument that is a Vec<TimeHistory> to define valid-time and transaction-time
  • 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.
  • All endpoints support async calls when --feature "async" is enabled, check async_<...> examples for usage. Tokio runtime is required.

Examples can be found in the examples directory.

Structs

HttpClient

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.