pub struct GroupTargetGroupsResource<'a> { /* private fields */ }Expand description
client.group().target_groups()
Implementations§
Source§impl<'a> GroupTargetGroupsResource<'a>
impl<'a> GroupTargetGroupsResource<'a>
Sourcepub fn create(&self, body: &TargetGroupCreate) -> Result<TargetGroup>
pub fn create(&self, body: &TargetGroupCreate) -> Result<TargetGroup>
Create target audience
POST /group/targetgroups
Creates a target audience as shared master data. A target audience describes whom a group is intended for, such as families or students. A group references one audience through information.targetGroupId. This endpoint returns audience labels, not people or groups. Requires the churchgroup permission “edit masterdata”. Supply both name and sortKey. Use an integer sortKey to control display order. 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::TargetGroupCreate {
name: "men".into(),
sort_key: 2,
..Default::default()
};
let result = client.group().target_groups().create(&body)?;
println!("{}", result.name);Sourcepub fn delete(
&self,
target_group_id: impl Display,
query: &DeleteGroupTargetgroupsTargetGroupIdQuery,
) -> Result<()>
pub fn delete( &self, target_group_id: impl Display, query: &DeleteGroupTargetgroupsTargetGroupIdQuery, ) -> Result<()>
Delete target audience
DELETE /group/targetgroups/{targetGroupId}
Deletes a target audience. Deleting a target audience clears targetGroupId on groups assigned to it. 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 = DeleteGroupTargetgroupsTargetGroupIdQuery {
dry_run: Some(true),
..Default::default()
};
client.group().target_groups().delete(2, &query)?;Sourcepub fn get(&self, target_group_id: impl Display) -> Result<TargetGroup>
pub fn get(&self, target_group_id: impl Display) -> Result<TargetGroup>
Get target audience
GET /group/targetgroups/{targetGroupId}
Returns one target audience using its ID from GET /group/targetgroups. A target audience describes whom a group is intended for, such as families or students. A group references one audience through information.targetGroupId. This endpoint returns audience labels, not people or groups. 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 target_group = client.group().target_groups().get(2)?;
println!("{}", target_group.name);Sourcepub fn list(&self) -> Result<Vec<TargetGroup>>
pub fn list(&self) -> Result<Vec<TargetGroup>>
Get all target audiences
GET /group/targetgroups
Returns all target audiences configured in this ChurchTools installation. A target audience describes whom a group is intended for, such as families or students. A group references one audience through information.targetGroupId. This endpoint returns audience labels, not people or groups. 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 target_group in client.group().target_groups().list()? {
println!("{}", target_group.name);
}Sourcepub fn update(
&self,
target_group_id: impl Display,
body: &TargetGroupCreate,
) -> Result<()>
pub fn update( &self, target_group_id: impl Display, body: &TargetGroupCreate, ) -> Result<()>
Update target audience
PUT /group/targetgroups/{targetGroupId}
Updates the shared target audience identified by targetGroupId. 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 both name and sortKey. Use an integer sortKey to control display order. The ID comes from the URL; no body id is required. Returns 204 without a response body. Use GET /group/targetgroups/{targetGroupId} to read the updated record.
§Example
let body = models::TargetGroupCreate {
name: "men".into(),
sort_key: 2,
..Default::default()
};
client.group().target_groups().update(2, &body)?;