Expand description
Synchronous client for the ChurchTools REST API.
use churchtools_api::Client;
use churchtools_api::queries::GetEventsQuery;
let client = Client::new("https://meinegemeinde.church.tools", Some("token".into()))?;
let query = GetEventsQuery {
from: Some("2026-11-01".parse().unwrap()),
to: Some("2026-11-30".parse().unwrap()),
..Default::default()
};
for event in client.events().list_with(&query)? {
println!("{} {}", event.start_date, event.name);
}The code is generated from the API description of ChurchTools
API_VERSION. Other versions work as far as their API matches: missing
endpoints answer 404, unknown fields end up in extra.
The client is blocking. Inside an async runtime such as Tokio, run it in
tokio::task::spawn_blocking; calling it directly from async code panics.
§Public dependencies
The models use types of chrono (dates and timestamps), serde
(Serialize/Deserialize) and serde_json (Value, extra maps); those
crates are part of the public API, chrono is re-exported. The HTTP
library is not: requests take Method, transport errors are wrapped in
TransportError.
Re-exports§
pub use chrono;
Modules§
- models
- Generated ChurchTools models.
- queries
- Query parameters (
…Query) and form fields (…Form) of the generated methods. Unset fields are left out of the request; fill them with..Default::default(). - resources
- Resource handles returned by the accessors of
Client, e.g.client.persons(), with one method per endpoint.
Structs§
- ApiError
- Error response of the ChurchTools API.
- Client
- Synchronous ChurchTools API client.
- Client
Builder - Options for a
Client, created withClient::builder. - Invalid
Method - Error of
Method::from_str: not one of the supported methods. - Items
- Iterator returned by
Client::itemsand the generated…_itermethods. - Pages
- Iterator returned by
Client::pages. - Transport
Error - Error of the HTTP layer: connection, TLS, timeout, or reading the response.
- Upload
- A file for an upload endpoint.
Enums§
- Date
OrDate Time - A value that is a date for all-day entries and a UTC timestamp otherwise.
- Error
- Everything that can go wrong with a request.
- Method
- HTTP method of a request.
Constants§
- API_
BUILD - Build number of
API_VERSION. - API_
VERSION - ChurchTools version whose API description the code was generated from.
- DEFAULT_
MAX_ RESPONSE_ SIZE - Default for
ClientBuilder::max_response_size: 256 MiB.
Functions§
- decode
- Decodes a whole response body.
- decode_
data - Decodes the
datafield of a response envelope. - encode_
path_ segment - Percent-encodes a value for use as a single path segment.