pub struct GroupAgeGroupsResource<'a> { /* private fields */ }Expand description
client.group().age_groups()
Implementations§
Source§impl<'a> GroupAgeGroupsResource<'a>
impl<'a> GroupAgeGroupsResource<'a>
Sourcepub fn create(&self, body: &AgeGroupCreate) -> Result<AgeGroup>
pub fn create(&self, body: &AgeGroupCreate) -> Result<AgeGroup>
Create age range
POST /group/agegroups
Creates a age range as shared master data. An age range describes intended participant ages, such as ages 3 to 5. Groups can reference several ranges through information.ageGroupIds. These configured ranges are independent of the calculated ages of current members. Requires the churchgroup permission “edit masterdata”. Supply name, sortKey, start and end. Age boundaries are expressed in years. The name is trimmed. The endpoint validates integer boundaries but does not check that start is less than or equal to end; send a meaningful range. Returns the created record with its generated ID and translated display name. Creating this record does not create or assign any groups.
§Example
let body = models::AgeGroupCreate {
end: 5,
name: "3-5".into(),
sort_key: 3,
start: 3,
..Default::default()
};
let result = client.group().age_groups().create(&body)?;
println!("{}", result.name);Sourcepub fn delete(
&self,
age_group_id: impl Display,
query: &DeleteGroupAgegroupsAgeGroupIdQuery,
) -> Result<()>
pub fn delete( &self, age_group_id: impl Display, query: &DeleteGroupAgegroupsAgeGroupIdQuery, ) -> Result<()>
Delete age range
DELETE /group/agegroups/{ageGroupId}
Deletes a age range. Removing an age range also removes its ID from the ageGroupIds assignments of existing groups. The groups and their memberships remain. Requires the churchgroup permission “edit masterdata”. The dryRun query parameter is required: send false to delete or true to inspect the deletion report. A dry run changes no records and returns 409 with the report, even when deletion would be possible. An actual successful deletion returns 204 without a body.
§Example
let query = DeleteGroupAgegroupsAgeGroupIdQuery {
dry_run: Some(true),
..Default::default()
};
client.group().age_groups().delete(2, &query)?;Sourcepub fn get(&self, age_group_id: impl Display) -> Result<AgeGroup>
pub fn get(&self, age_group_id: impl Display) -> Result<AgeGroup>
Get age range
GET /group/agegroups/{ageGroupId}
Returns one age range using its ID from GET /group/agegroups. An age range describes intended participant ages, such as ages 3 to 5. Groups can reference several ranges through information.ageGroupIds. These configured ranges are independent of the calculated ages of current members. Requires authentication, but no master-data editing permission. Returns a single object in data and no list metadata. Returns 404 when the record does not exist.
§Example
let age_group = client.group().age_groups().get(2)?;
println!("{}", age_group.name);Sourcepub fn list(&self) -> Result<Vec<AgeGroup>>
pub fn list(&self) -> Result<Vec<AgeGroup>>
Get all age ranges
GET /group/agegroups
Returns all age ranges configured in this ChurchTools installation. An age range describes intended participant ages, such as ages 3 to 5. Groups can reference several ranges through information.ageGroupIds. These configured ranges are independent of the calculated ages of current members. Requires authentication, but no master-data editing permission. There are no filter or pagination parameters. Results are ordered by sortKey ascending and then by the stored name ascending; meta.count is the number of returned records. IDs and labels are installation-specific; discover them before assigning them to groups.
§Example
for age_group in client.group().age_groups().list()? {
println!("{}", age_group.name);
}Sourcepub fn update(
&self,
age_group_id: impl Display,
body: &AgeGroupCreate,
) -> Result<()>
pub fn update( &self, age_group_id: impl Display, body: &AgeGroupCreate, ) -> Result<()>
Update age range
PUT /group/agegroups/{ageGroupId}
Updates the shared age range identified by ageGroupId. Existing group assignments continue to reference the same record. This is a full update, not a partial update. Requires the churchgroup permission “edit masterdata”. Supply name, sortKey, start and end. Age boundaries are expressed in years. The name is trimmed. The endpoint validates integer boundaries but does not check that start is less than or equal to end; send a meaningful range. The ID comes from the URL; no body id is required. Returns 204 without a response body. Use GET /group/agegroups/{ageGroupId} to read the updated record.
§Example
let body = models::AgeGroupCreate {
end: 5,
name: "3-5".into(),
sort_key: 3,
start: 3,
..Default::default()
};
client.group().age_groups().update(2, &body)?;