Skip to main content

GroupTargetGroupsResource

Struct GroupTargetGroupsResource 

Source
pub struct GroupTargetGroupsResource<'a> { /* private fields */ }
Expand description

client.group().target_groups()

Implementations§

Source§

impl<'a> GroupTargetGroupsResource<'a>

Source

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);
Source

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)?;
Source

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);
Source

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);
}
Source

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)?;

Trait Implementations§

Source§

impl<'a> Clone for GroupTargetGroupsResource<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for GroupTargetGroupsResource<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more