pub struct PersonsResource<'a> { /* private fields */ }Expand description
client.persons()
Implementations§
Source§impl<'a> PersonsResource<'a>
impl<'a> PersonsResource<'a>
pub fn absences(&self) -> PersonsAbsencesResource<'a>
pub fn devices(&self) -> PersonsDevicesResource<'a>
pub fn events(&self) -> PersonsEventsResource<'a>
pub fn exchange_requests(&self) -> PersonsExchangeRequestsResource<'a>
pub fn external_logins(&self) -> PersonsExternalLoginsResource<'a>
pub fn followups(&self) -> PersonsFollowupsResource<'a>
pub fn merge(&self) -> PersonsMergeResource<'a>
pub fn relationships(&self) -> PersonsRelationshipsResource<'a>
pub fn service_requests(&self) -> PersonsServiceRequestsResource<'a>
pub fn settings(&self) -> PersonsSettingsResource<'a>
Sourcepub fn archive(
&self,
person_id: impl Display,
body: &PostPersonsPersonIdArchiveBody,
) -> Result<()>
pub fn archive( &self, person_id: impl Display, body: &PostPersonsPersonIdArchiveBody, ) -> Result<()>
POST /persons/{personId}/archive
archives or undos an archive of a person
§Example
let body = models::PostPersonsPersonIdArchiveBody {
archived: Some(true),
..Default::default()
};
client.persons().archive(42, &body)?;Sourcepub fn create(&self, body: &PostPersonsBody) -> Result<Person>
pub fn create(&self, body: &PostPersonsBody) -> Result<Person>
Create new person
POST /persons
Creates a person using only fields the current user may write. Before calling this endpoint, retrieve valid statusId, campusId, and departmentIds values from GET /person/masterdata. Read GET /config to determine whether privacy_policy_fields_mandatory is enabled. If it is enabled, provide all three privacy agreement fields. privacyPolicyAgreementTypeId describes how the agreement was obtained, while privacyPolicyAgreementWhoId describes who gave it; these are independent facts and must not be inferred from each other. The without_privacy_policy_agreement parameter is only effective when privacy_policy_fields_mandatory_api is disabled and must not be used without first verifying that setting. If a duplicate person is found, repeat the request with force only after intentionally deciding to create the duplicate.
Use Self::create_with to pass query parameters.
§Example
let body = models::PostPersonsBody {
department_ids: vec![42],
..Default::default()
};
let result = client.persons().create(&body)?;
println!("{:?}", result.title);Sourcepub fn create_with(
&self,
query: &PostPersonsQuery,
body: &PostPersonsBody,
) -> Result<Person>
pub fn create_with( &self, query: &PostPersonsQuery, body: &PostPersonsBody, ) -> Result<Person>
Create new person
Like Self::create, with query parameters.
POST /persons
Creates a person using only fields the current user may write. Before calling this endpoint, retrieve valid statusId, campusId, and departmentIds values from GET /person/masterdata. Read GET /config to determine whether privacy_policy_fields_mandatory is enabled. If it is enabled, provide all three privacy agreement fields. privacyPolicyAgreementTypeId describes how the agreement was obtained, while privacyPolicyAgreementWhoId describes who gave it; these are independent facts and must not be inferred from each other. The without_privacy_policy_agreement parameter is only effective when privacy_policy_fields_mandatory_api is disabled and must not be used without first verifying that setting. If a duplicate person is found, repeat the request with force only after intentionally deciding to create the duplicate.
Sourcepub fn delete_confidentiality_agreement(
&self,
person_id: impl Display,
) -> Result<()>
pub fn delete_confidentiality_agreement( &self, person_id: impl Display, ) -> Result<()>
Revoke a person’s confidentiality agreement
DELETE /persons/{personId}/confidentialityagreement
Clears the confidentiality acceptance date. Requires write access for Persons (churchdb); being the selected person alone is insufficient. Simulation is rejected. The policy checks module-level write access without an additional person-visibility check. Already absent acceptance is a successful no-op. This is separate from privacy-consent revocation and takes no request body.
§Example
client.persons().delete_confidentiality_agreement(42)?;Sourcepub fn delete_login_token(&self, person_id: impl Display) -> Result<()>
pub fn delete_login_token(&self, person_id: impl Display) -> Result<()>
Revoke the current person’s login token
DELETE /persons/{personId}/logintoken
Deletes the current person’s persistent login token. Only the current person may revoke their own token. A missing token is treated as success. Ordinary user simulation is forbidden; support-user simulation is exempt. This does not invalidate existing sessions or separate one-time login strings. A subsequent GET creates a new token.
§Example
client.persons().delete_login_token(42)?;Sourcepub fn delete_privacy_policy(&self, person_id: impl Display) -> Result<()>
pub fn delete_privacy_policy(&self, person_id: impl Display) -> Result<()>
Revoke privacy consent
DELETE /persons/{personId}/privacypolicy
Clears the person’s consent timestamp, consent type and consent-giver category, and then notifies the configured administrator by email when an address is available. Requires an enabled consent banner and either the person themselves, a super administrator, or the parent of a person not known to be at least 16 through relationship type 1. Simulation is rejected. Revocation is not idempotent: an existing person without prior consent raises an application error instead of returning 204. Notification happens after the data change, so a later failure does not imply that consent was retained.
§Example
client.persons().delete_privacy_policy(42)?;Sourcepub fn filter(&self, body: &Value) -> Result<Vec<Person>>
pub fn filter(&self, body: &Value) -> Result<Vec<Person>>
Filter persons with probes
POST /persons/filter
Evaluates a logical expression of probes against all persons the current user may view. Probe evaluation honors person security levels, and the matching persons are returned as a paginated collection.
Use Self::filter_with to pass query parameters.
§Example
let body = serde_json::json!({
"data": {},
"probe": "probe-person-field"
});
for person in client.persons().filter(&body)? {
println!("{:?}", person.title);
}Sourcepub fn filter_with(
&self,
query: &PostPersonsFilterQuery,
body: &Value,
) -> Result<Vec<Person>>
pub fn filter_with( &self, query: &PostPersonsFilterQuery, body: &Value, ) -> Result<Vec<Person>>
Filter persons with probes
Like Self::filter, with query parameters.
POST /persons/filter
Evaluates a logical expression of probes against all persons the current user may view. Probe evaluation honors person security levels, and the matching persons are returned as a paginated collection.
Sourcepub fn get(&self, person_id: impl Display) -> Result<Person>
pub fn get(&self, person_id: impl Display) -> Result<Person>
Get a person by ID or GUID
GET /persons/{personId}
Each person as a unique numeric ID in ChurchTools. This ID is used all over in ChurchTools and in the API.
§Example
let person = client.persons().get(42)?;
println!("{:?}", person.title);Sourcepub fn get_information(
&self,
person_id: impl Display,
) -> Result<PersonInformationExport>
pub fn get_information( &self, person_id: impl Display, ) -> Result<PersonInformationExport>
Generate a personal data sheet PDF
GET /persons/{personId}/information
Generates the complete configured data sheet for the person and returns a PDF download URL. Requires super-administrator access, even when exporting your own data. Despite using GET, every successful call generates and stores a file and logs the export; this is not a read-only preview. The file is associated with the datasheet domain and scheduled for deletion after one day. The API response is JSON, not PDF bytes. message is localized display text. Unknown persons return 404; generation or storage failures may return 500.
§Example
let information = client.persons().get_information(42)?;
println!("{}", information.pdf_link);Sourcepub fn get_login_string(
&self,
person_id: impl Display,
) -> Result<GetPersonsIdLoginstringResponse>
pub fn get_login_string( &self, person_id: impl Display, ) -> Result<GetPersonsIdLoginstringResponse>
Create a one-time login string for the current person
GET /persons/{personId}/loginstring
Creates a new one-time login credential valid for 14 days. Only the current person may request their own credential. Each GET creates and stores a fresh credential; treat the response as a secret. Use it as the loginstr parameter of a ChurchTools login link. Simulation creates a credential carrying the simulating user context. The legacy response has top-level loginString and personId fields, without a data envelope.
§Example
let login_string = client.persons().get_login_string("abc123")?;
println!("{}", login_string.login_string);Sourcepub fn get_login_token(&self, person_id: impl Display) -> Result<String>
pub fn get_login_token(&self, person_id: impl Display) -> Result<String>
Get or create the current person’s login token
GET /persons/{personId}/logintoken
Returns the current person’s persistent login credential, creating and storing one if absent. Only the current person may request their own token. The same token is returned on subsequent calls until revoked; treat it as a secret. It has no expiry field. Ordinary user simulation is forbidden; support-user simulation is exempt. This GET can change stored data.
§Example
let result = client.persons().get_login_token(42)?;
println!("{:?}", result);Sourcepub fn get_post_statistics(
&self,
person_id: impl Display,
) -> Result<PersonPostStatistics>
pub fn get_post_statistics( &self, person_id: impl Display, ) -> Result<PersonPostStatistics>
Returns the post statistics for a person
GET /persons/{personId}/poststatistics
§Example
let post_statistic = client.persons().get_post_statistics("abc123")?;
println!("{}", post_statistic.count_banned);Sourcepub fn get_privacy_policy(
&self,
person_id: impl Display,
) -> Result<PersonPrivacyPolicy>
pub fn get_privacy_policy( &self, person_id: impl Display, ) -> Result<PersonPrivacyPolicy>
Get privacy-consent information
GET /persons/{personId}/privacypolicy
Returns consent details and parent/child relationship information for the selected person. Simulation is rejected. Access is allowed to super administrators, the person themselves unless they are known to be younger than 16, and a parent linked through relationship type 1 for a person who is not known to be at least 16. An unknown birthday is treated differently by the self-read and acceptance checks. The response supplies suggested typeId/whoId and display flags; it does not grant permission to submit consent.
§Example
let privacy_policy = client.persons().get_privacy_policy(42)?;
println!("{}", privacy_policy.minimum_age);Sourcepub fn invite(&self, person_id: impl Display) -> Result<()>
pub fn invite(&self, person_id: impl Display) -> Result<()>
Invite Person to ChurchTools
POST /persons/{personId}/invite
Sends a ChurchTools invitation email to the person’s stored email address. Requires the global churchcore permission invite persons or the group-internal churchdb +invite person permission for this person. Archived people cannot be invited. The call forces sending even after an earlier invitation or acceptance. With local login enabled, the email links to setting a password; with local login disabled, it links to the login page. No request body is consumed. A 204 response indicates that invitation processing completed, not confirmed email delivery.
§Example
client.persons().invite(42)?;Sourcepub fn list(&self) -> Result<Vec<Person>>
pub fn list(&self) -> Result<Vec<Person>>
Get all persons
GET /persons
This endpoint gives you all the people you are allowed to see. Each person object holds only those fields you may see. You will get at least an empty array even if you cannot see any person. The results are sorted by lastname, firstname.
We distinguish between date and date-time fields. date is a ISO representation like YYYY-MM-DD. On the other hand, for date-time we return and accept a W3C Zulu date string. Example 1994-11-05T08:15:30Z
Use Self::list_with to pass query parameters.
§Example
for person in client.persons().list()? {
println!("{:?}", person.title);
}Sourcepub fn list_with(&self, query: &GetPersonsQuery) -> Result<Vec<Person>>
pub fn list_with(&self, query: &GetPersonsQuery) -> Result<Vec<Person>>
Get all persons
Like Self::list, with query parameters.
GET /persons
This endpoint gives you all the people you are allowed to see. Each person object holds only those fields you may see. You will get at least an empty array even if you cannot see any person. The results are sorted by lastname, firstname.
We distinguish between date and date-time fields. date is a ISO representation like YYYY-MM-DD. On the other hand, for date-time we return and accept a W3C Zulu date string. Example 1994-11-05T08:15:30Z
Sourcepub fn list_iter(&self, query: &GetPersonsQuery) -> Items<Person> ⓘ
pub fn list_iter(&self, query: &GetPersonsQuery) -> Items<Person> ⓘ
Get all persons
Like Self::list_with, but lazy: each page is fetched only when the iteration reaches it.
Breaking off early saves the remaining requests.
Sourcepub fn list_birthdays(&self) -> Result<Vec<GetPersonsBirthdaysDataItem>>
pub fn list_birthdays(&self) -> Result<Vec<GetPersonsBirthdaysDataItem>>
Fetch Birthdays
GET /persons/birthdays
This endpoint returns birthdays within a specific time interval. The returned objects are ordered by MONTH-DAY, where the first birthday in the list is the one next from the start date.
The API also returns the age of the birthday. That age is calculated based on the date interval. That means, it is not the current age and also not the next birthday, but the age which the person had/will have at the end of the given date interval.
There are two ways to utilize this endpoint:
- With a fixed date interval (
start_date,end_date). This interval must not be larger than one year. - With a
start_dateand adirectionfield. This combination also accepts apageandlimitparameter (both with suitable defaults) to paginate through the results.
Use Self::list_birthdays_with to pass query parameters.
§Example
for birthday in client.persons().list_birthdays()? {
println!("{:?}", birthday.deprecated);
}Sourcepub fn list_birthdays_with(
&self,
query: &GetPersonsBirthdaysQuery,
) -> Result<Vec<GetPersonsBirthdaysDataItem>>
pub fn list_birthdays_with( &self, query: &GetPersonsBirthdaysQuery, ) -> Result<Vec<GetPersonsBirthdaysDataItem>>
Fetch Birthdays
Like Self::list_birthdays, with query parameters.
GET /persons/birthdays
This endpoint returns birthdays within a specific time interval. The returned objects are ordered by MONTH-DAY, where the first birthday in the list is the one next from the start date.
The API also returns the age of the birthday. That age is calculated based on the date interval. That means, it is not the current age and also not the next birthday, but the age which the person had/will have at the end of the given date interval.
There are two ways to utilize this endpoint:
- With a fixed date interval (
start_date,end_date). This interval must not be larger than one year. - With a
start_dateand adirectionfield. This combination also accepts apageandlimitparameter (both with suitable defaults) to paginate through the results.
Sourcepub fn list_birthdays_iter(
&self,
query: &GetPersonsBirthdaysQuery,
) -> Items<GetPersonsBirthdaysDataItem> ⓘ
pub fn list_birthdays_iter( &self, query: &GetPersonsBirthdaysQuery, ) -> Items<GetPersonsBirthdaysDataItem> ⓘ
Fetch Birthdays
Like Self::list_birthdays_with, but lazy: each page is fetched only when the iteration reaches it.
Breaking off early saves the remaining requests.
Sourcepub fn list_duplicates(&self) -> Result<Vec<GetPersonsDuplicatesDataItem>>
pub fn list_duplicates(&self) -> Result<Vec<GetPersonsDuplicatesDataItem>>
get potential duplicates of persons
GET /persons/duplicates
Caution: This API is published as Beta and subject to be changed. It is published such that customers can play evaluate it with production data.
Provide a list of potential duplicate person records. You can suppress some duplicates
The other parameters are used to filter duplicates.
Returns an array of duplicates
p1- properties of Person 1p2- properties of Person 2
Use Self::list_duplicates_with to pass query parameters.
§Example
for duplicate in client.persons().list_duplicates()? {
println!("{:?}", duplicate.relationship_type_id);
}Sourcepub fn list_duplicates_with(
&self,
query: &GetPersonsDuplicatesQuery,
) -> Result<Vec<GetPersonsDuplicatesDataItem>>
pub fn list_duplicates_with( &self, query: &GetPersonsDuplicatesQuery, ) -> Result<Vec<GetPersonsDuplicatesDataItem>>
get potential duplicates of persons
Like Self::list_duplicates, with query parameters.
GET /persons/duplicates
Caution: This API is published as Beta and subject to be changed. It is published such that customers can play evaluate it with production data.
Provide a list of potential duplicate person records. You can suppress some duplicates
The other parameters are used to filter duplicates.
Returns an array of duplicates
p1- properties of Person 1p2- properties of Person 2
Sourcepub fn list_groups(&self, person_id: impl Display) -> Result<Vec<GroupMember>>
pub fn list_groups(&self, person_id: impl Display) -> Result<Vec<GroupMember>>
Get all groups a member is in
GET /persons/{personId}/groups
This endpoint returns an array with all groups the user is in.
Use Self::list_groups_with to pass query parameters.
§Example
for group in client.persons().list_groups(42)? {
println!("{}", group.id);
}Sourcepub fn list_groups_with(
&self,
person_id: impl Display,
query: &GetPersonsIdGroupsQuery,
) -> Result<Vec<GroupMember>>
pub fn list_groups_with( &self, person_id: impl Display, query: &GetPersonsIdGroupsQuery, ) -> Result<Vec<GroupMember>>
Get all groups a member is in
Like Self::list_groups, with query parameters.
GET /persons/{personId}/groups
This endpoint returns an array with all groups the user is in.
Sourcepub fn list_open_meeting_requests(
&self,
person_id: impl Display,
) -> Result<Vec<OpenMeetingRequest>>
pub fn list_open_meeting_requests( &self, person_id: impl Display, ) -> Result<Vec<OpenMeetingRequest>>
Get my unanswered meeting invitations
GET /persons/{personId}/openmeetingrequests
Lists meeting invitations for the authenticated person that have no response date and still have an occurrence found by recurrence calculation. personId must match the current user; querying another person returns 403, including for administrators. Tentative answers are excluded because they already have a response date. Invitations apply to the stored appointment or series, not separately to every occurrence. Results include nextStartDate and nextEndDate, are sorted by nextStartDate ascending, and are not paginated. The embedded appointment and legacy eventDate describe the stored appointment, which can start in the past for a recurring series.
§Example
for open_meeting_request in client.persons().list_open_meeting_requests(42)? {
println!("{}", open_meeting_request.id);
}Sourcepub fn list_posts(&self, person_id: impl Display) -> Result<Vec<Post>>
pub fn list_posts(&self, person_id: impl Display) -> Result<Vec<Post>>
Returns the posts authored by a person
GET /persons/{personId}/posts
Use Self::list_posts_with to pass query parameters.
§Example
for post in client.persons().list_posts("abc123")? {
println!("{}", post.title);
}Sourcepub fn list_posts_with(
&self,
person_id: impl Display,
query: &GetPersonsPersonIdPostsQuery,
) -> Result<Vec<Post>>
pub fn list_posts_with( &self, person_id: impl Display, query: &GetPersonsPersonIdPostsQuery, ) -> Result<Vec<Post>>
Returns the posts authored by a person
Like Self::list_posts, with query parameters.
GET /persons/{personId}/posts
Sourcepub fn list_relationships(&self) -> Result<Vec<GetPersonsRelationshipsDataItem>>
pub fn list_relationships(&self) -> Result<Vec<GetPersonsRelationshipsDataItem>>
Get all relationships for all persons
GET /persons/relationships
§Example
for relationship in client.persons().list_relationships()? {
println!("{:?}", relationship.id);
}Sourcepub fn list_search_old(&self) -> Result<Vec<i64>>
👎Deprecated: GET /persons/search_old is deprecated in the ChurchTools API.
pub fn list_search_old(&self) -> Result<Vec<i64>>
GET /persons/search_old is deprecated in the ChurchTools API.
GET /persons/search_old
§Example
for search_old in client.persons().list_search_old()? {
println!("{:?}", search_old);
}Sourcepub fn patch(
&self,
person_id: impl Display,
body: &PatchPersonsIdBody,
) -> Result<Person>
pub fn patch( &self, person_id: impl Display, body: &PatchPersonsIdBody, ) -> Result<Person>
Updates a person
PATCH /persons/{personId}
Endpoint to update a person in ChurchTools. Generally, you can provide any information to save, but be aware that you can only save information for fields you have write access to. Beware, that not all fields which are listed in the Person schema can be updated. E.g. imageUrl or familyUrl.
§Example
let body = models::PatchPersonsIdBody {
title: Some("Hauskreis Nord".into()),
..Default::default()
};
let result = client.persons().patch(42, &body)?;
println!("{:?}", result.title);Sourcepub fn properties(
&self,
body: &PostPersonsPropertiesBody,
) -> Result<BTreeMap<String, PersonProperties>>
pub fn properties( &self, body: &PostPersonsPropertiesBody, ) -> Result<BTreeMap<String, PersonProperties>>
Retrieve person account properties
POST /persons/properties
Returns lightweight account and communication properties for the given person IDs. The response object is keyed by person ID. If ids is empty or omitted, no person properties are returned.
§Example
let body = models::PostPersonsPropertiesBody::default();
let result = client.persons().properties(&body)?;
println!("{:?}", result);Sourcepub fn update_confidentiality_agreement(
&self,
person_id: impl Display,
) -> Result<()>
pub fn update_confidentiality_agreement( &self, person_id: impl Display, ) -> Result<()>
Accept the current person’s confidentiality agreement
PUT /persons/{personId}/confidentialityagreement
Records the current database date as the selected person’s confidentiality acceptance date. Only the current person can accept; simulation is rejected and administrators cannot accept for another person. Repeated acceptance overwrites the date. This is separate from privacy consent and takes no request body.
§Example
client.persons().update_confidentiality_agreement(42)?;Sourcepub fn update_password(
&self,
person_id: impl Display,
body: &PersonPasswordUpdate,
) -> Result<()>
pub fn update_password( &self, person_id: impl Display, body: &PersonPasswordUpdate, ) -> Result<()>
Change the password for the active account
PUT /persons/{personId}/password
Changes the password for the account in the password-reset session, or otherwise the currently signed-in account. The personId path value is currently ignored and does not select the target account. A reset session takes precedence over a signed-in session; in that case oldPassword must be an empty string. Without a reset session, oldPassword must match the current password (or be empty if none exists). The new password must meet the installation’s minimum_password_length (default 8), contain ASCII upper- and lowercase letters and a digit, and exclude the person’s first name, last name and nickname case-insensitively. A successful change normally invalidates all sessions and persistent login tokens and signs out the affected current user. Initial setup from no password or the default admin password retains sessions unless using a reset session. Ordinary user simulation is forbidden; support-user simulation is exempt.
§Example
let body = models::PersonPasswordUpdate {
new_password: "ExamplePassword42".into(),
new_password_confirm: "ExamplePassword42".into(),
old_password: "PreviousPassword41".into(),
..Default::default()
};
client.persons().update_password(42, &body)?;Sourcepub fn update_privacy_policy(
&self,
person_id: impl Display,
body: &PersonPrivacyPolicyUpdate,
) -> Result<Option<Vec<PersonPrivacyPolicyChildResult>>>
pub fn update_privacy_policy( &self, person_id: impl Display, body: &PersonPrivacyPolicyUpdate, ) -> Result<Option<Vec<PersonPrivacyPolicyChildResult>>>
Record privacy consent
PUT /persons/{personId}/privacypolicy
Records consent for the selected person and optionally their children. The consent banner must be enabled. The requester must be the person themselves at age 16 or above, a super administrator, or a parent authorized through relationship type 1. For own consent, a missing birthday must be supplied and the controller separately checks the age; a request can return 204 without recording own consent when that check does not pass. Children are checked against parent/child relationship type 1, missing prior consent and age below 16. If any child marked accepted is processed, 200 returns per-child outcomes, including errors or not allowed. Otherwise 204 has no body. The flow is not atomic; own consent or birthdays may already have changed when a later step fails. Unlike GET and DELETE, the acceptance policy has no explicit simulation prohibition.
§Example
let body = models::PersonPrivacyPolicyUpdate {
children_accepted: false,
own_accepted: true,
persons: vec![models::PersonPrivacyPolicyChildUpdate {
accepted: true,
birthday: "2016-05-14".into(),
edit_birthday: false,
id: 43,
..Default::default()
}],
type_id: 2,
who_id: 1,
..Default::default()
};
let result = client.persons().update_privacy_policy(42, &body)?;
println!("{:?}", result);