Skip to main content

Crate churchtools_api

Crate churchtools_api 

Source
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.
ClientBuilder
Options for a Client, created with Client::builder.
InvalidMethod
Error of Method::from_str: not one of the supported methods.
Items
Iterator returned by Client::items and the generated …_iter methods.
Pages
Iterator returned by Client::pages.
TransportError
Error of the HTTP layer: connection, TLS, timeout, or reading the response.
Upload
A file for an upload endpoint.

Enums§

DateOrDateTime
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 data field of a response envelope.
encode_path_segment
Percent-encodes a value for use as a single path segment.

Type Aliases§

Query
Query parameters as sent on the wire; array parameters appear once per value (ids[]=1&ids[]=2).
Result