Skip to main content

acuity_index_api_rs/
lib.rs

1//! High-level async client for the `acuity-index` WebSocket API.
2//!
3//! ```no_run
4//! use acuity_index_api_rs::{CustomKey, CustomScalarValue, IndexerClient, Key};
5//!
6//! #[tokio::main(flavor = "current_thread")]
7//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
8//!     let client = IndexerClient::connect("ws://127.0.0.1:8172").await?;
9//!
10//!     let spans = client.status().await?;
11//!     println!("indexed spans: {spans:?}");
12//!
13//!     let events = client
14//!         .get_events(
15//!             Key::Custom(CustomKey::composite(
16//!                 "item_revision",
17//!                 [
18//!                     CustomScalarValue::Bytes32([0x11; 32].into()),
19//!                     CustomScalarValue::U32(7),
20//!                 ],
21//!             )),
22//!             Some(100),
23//!             None,
24//!         )
25//!         .await?;
26//!     println!("events: {}", events.events.len());
27//!     Ok(())
28//! }
29//! ```
30mod client;
31mod error;
32mod types;
33
34pub use client::{EventSubscription, IndexerClient, StatusSubscription};
35pub use error::{IndexerApiError, ServerError};
36pub use types::{
37    Bytes32, CustomKey, CustomScalarValue, CustomValue, DecodedEvent, EventMatch, EventMeta,
38    EventNotification, EventRef, EventsResponse, Key, PalletMeta, Span, StatusUpdate,
39    StoredEvent, SubscriptionTarget, U128Text, U64Text,
40};