infrahub/lib.rs
1//! infrahub graphql client
2//!
3//! this crate provides a small, typed client for the infrahub graphql api.
4//! start with [`Client`] and [`ClientConfig`], then use `execute_raw` or
5//! `execute` for ad-hoc queries. for generated schema clients, use the
6//! `infrahub-codegen` tool to build a separate crate.
7//!
8//! ## quick start
9//!
10//! ```no_run
11//! use infrahub::{Client, ClientConfig};
12//!
13//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
14//! let client = Client::new(ClientConfig::new("http://localhost:8000", "token"))?;
15//! let response = client
16//! .execute_raw("{ InfrahubInfo { deployment_id version } }", None, None)
17//! .await?;
18//! println!("{:?}", response.data);
19//! # Ok(())
20//! # }
21//! ```
22//!
23//! ## generated clients
24//!
25//! use `infrahub-codegen` to generate a schema-specific crate, then use it
26//! alongside this base client.
27
28mod client;
29mod config;
30mod error;
31mod graphql;
32mod operation;
33mod pagination;
34
35pub use client::Client;
36pub use config::ClientConfig;
37pub use error::{Error, Result};
38pub use graphql::{GraphQlError, GraphQlLocation, GraphQlResponse};
39pub use operation::Operation;
40pub use pagination::{BoxExtract, BoxFetch, BoxFutureResult, DynPaginator, EdgePage, Paginator};