churchtools_api/lib.rs
1//! Synchronous client for the ChurchTools REST API.
2//!
3//! ```no_run
4//! use churchtools_api::Client;
5//! use churchtools_api::queries::GetEventsQuery;
6//!
7//! let client = Client::new("https://meinegemeinde.church.tools", Some("token".into()))?;
8//! let query = GetEventsQuery {
9//! from: Some("2026-11-01".parse().unwrap()),
10//! to: Some("2026-11-30".parse().unwrap()),
11//! ..Default::default()
12//! };
13//! for event in client.events().list_with(&query)? {
14//! println!("{} {}", event.start_date, event.name);
15//! }
16//! # Ok::<(), churchtools_api::Error>(())
17//! ```
18//!
19//! The code is generated from the API description of ChurchTools
20//! [`API_VERSION`]. Other versions work as far as their API matches: missing
21//! endpoints answer `404`, unknown fields end up in `extra`.
22//!
23//! The client is blocking. Inside an async runtime such as Tokio, run it in
24//! `tokio::task::spawn_blocking`; calling it directly from async code panics.
25//!
26//! # Public dependencies
27//!
28//! The models use types of `chrono` (dates and timestamps), `serde`
29//! (`Serialize`/`Deserialize`) and `serde_json` (`Value`, `extra` maps); those
30//! crates are part of the public API, `chrono` is re-exported. The HTTP
31//! library is not: requests take [`Method`], transport errors are wrapped in
32//! [`TransportError`].
33
34mod client;
35mod datetime;
36mod error;
37mod generated;
38mod lenient;
39mod query;
40#[cfg(feature = "replay")]
41#[doc(hidden)]
42pub mod replay;
43
44pub use chrono;
45pub use client::{
46 Client, ClientBuilder, DEFAULT_MAX_RESPONSE_SIZE, InvalidMethod, Items, Method, Pages, Query, Upload, decode,
47 decode_data, encode_path_segment,
48};
49pub use datetime::DateOrDateTime;
50pub use error::{ApiError, Error, Result, TransportError};
51pub use generated::api as resources;
52pub use generated::{API_BUILD, API_VERSION, models, queries};