Skip to main content

DynamicGroupsResource

Struct DynamicGroupsResource 

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

client.dynamic_groups()

Implementations§

Source§

impl<'a> DynamicGroupsResource<'a>

Source

pub fn delete_ruleset(&self, group_id: impl Display) -> Result<()>

Remove automatic membership rules

DELETE /dynamicgroups/{groupId}/ruleset

Clears the stored rule set and resets the stored dynamicGroupStatus to null (reported as none by GET /status). Requires churchcore administer persons. Existing group memberships and the group itself remain in place. No refresh is run. The current implementation returns HTTP 200 with an empty body, including when no rule set was stored.

§Example
client.dynamic_groups().delete_ruleset(42)?;
Source

pub fn get_status( &self, group_id: impl Display, ) -> Result<DynamicGroupStatusUpdate>

Get the dynamic membership refresh mode

GET /dynamicgroups/{groupId}/status

Returns the stored refresh mode of an ordinary group. A missing/null stored status is returned as none. This is configuration, not the progress of an in-flight job or proof that the rules are valid. Requires churchcore administer persons. The response is a flat object without a data wrapper.

§Example
let statu = client.dynamic_groups().get_status(42)?;
println!("{}", statu.dynamic_group_status);
Source

pub fn list(&self) -> Result<Vec<i64>>

List groups with automatic membership refresh

GET /dynamicgroups

Returns IDs of groups whose dynamicGroupStatus is active. A dynamic group is an ordinary ChurchTools group whose memberships can be maintained by a set of query rules. Groups in manual, inactive or none status are excluded, even when a rule set is stored. Conversely, active groups without a valid rule set are included and may fail during refresh. Requires churchcore administer persons. Results are not paginated and no ordering is guaranteed. This preliminary API may change.

§Example
for dynamic_group in client.dynamic_groups().list()? {
    println!("{:?}", dynamic_group);
}
Source

pub fn list_ruleset( &self, group_id: impl Display, ) -> Result<Vec<DynamicGroupRule>>

Get stored automatic membership rules

GET /dynamicgroups/{groupId}/ruleset

Returns the stored rule array directly, without a data wrapper. Requires churchcore administer persons. Rules can exist independently of the refresh status. If the group has no rules, including after an empty array was saved, this returns 404. Reading rules does not execute or validate their query results.

§Example
for ruleset in client.dynamic_groups().list_ruleset(42)? {
    println!("{}", ruleset.description);
}
Source

pub fn refresh( &self, group_id: impl Display, ) -> Result<Vec<DynamicGroupRefreshResult>>

Refresh memberships of one dynamic group

POST /dynamicgroups/{groupId}/refresh

Synchronously evaluates and applies the stored rules of one group. Requires churchcore administer persons and dynamicGroupStatus active or manual. inactive and none reject manual refreshes. The request has no body and no dry-run option. Rules run against the initial membership snapshot and changes are applied as the system user, with at most 500 actual changes per run. Inspect unprocessed and runsNeeded before assuming convergence. A caught processing failure returns 400 with a message; it does not return a successful statistics object. Membership updates have their own transaction, but later timestamp/event/logging failures can occur after those changes have committed.

§Example
for dynamic_group in client.dynamic_groups().refresh(42)? {
    println!("{}", dynamic_group.created);
}
Source

pub fn refresh_all(&self) -> Result<Vec<Value>>

Refresh all active dynamic groups

POST /dynamicgroups/refresh

Synchronously evaluates and applies membership rules for all groups with active dynamicGroupStatus. Requires churchcore administer persons. Manual, inactive and none groups are excluded. Rules run in ascending importance order against the starting membership snapshot; later field updates can override earlier ones, while any deletion action takes precedence. Membership writes run as the system user and can bypass the group size limit. Each group is processed separately; this is not a transaction across groups. At most 500 actual changes are applied per group per run, so inspect unprocessed and runsNeeded and repeat if necessary. A 200 response can contain per-group failures alongside successful statistics. Error entries lack a structured groupId; unexpected Errors can still abort the whole request. This endpoint performs changes immediately and does not support a dry run.

§Example
for dynamic_group in client.dynamic_groups().refresh_all()? {
    println!("{:?}", dynamic_group);
}
Source

pub fn update_ruleset( &self, group_id: impl Display, body: &DynamicGroupRuleSetUpdate, ) -> Result<PutDynamicgroupsIdRulesetResponse>

Replace automatic membership rules

PUT /dynamicgroups/{groupId}/ruleset

Stores the complete rule array after validation against the dynamic-group JSON schema. Requires churchcore administer persons. Rule syntax validation does not execute queries or validate all referenced roles, fields and runtime process values. Saving rules does not change dynamicGroupStatus or immediately update memberships. Use PUT /status to select the refresh mode and POST /refresh to run it explicitly. An empty array stores no rule set and returns dynamicGroupRuleSet: null, even if the group remains active. The response has a dynamicGroupRuleSet property directly, without a data wrapper.

§Example
let body = models::DynamicGroupRuleSetUpdate {
    dynamic_group_rule_set: vec![models::DynamicGroupRule {
        description: "Add selected people to the group.".into(),
        importance: 10,
        person_id_field_name: "person.id".into(),
        process: models::DynamicGroupProcessSets {
            group_and_query_result: models::DynamicGroupProcessSetsGroupAndQueryResult::default(),
            group_only: models::DynamicGroupProcessSetsGroupOnly::default(),
            query_result_only: models::DynamicGroupProcessSetsQueryResultOnly::default(),
            ..Default::default()
        },
        query: models::DynamicGroupQuery {
            method: "ChurchQuery".into(),
            params: models::DynamicGroupQueryParams::default(),
            ..Default::default()
        },
        shorty: "selected-people".into(),
        ..Default::default()
    }],
    ..Default::default()
};
let result = client.dynamic_groups().update_ruleset(42, &body)?;
println!("{:?}", result);
Source

pub fn update_status( &self, group_id: impl Display, body: &DynamicGroupStatusUpdate, ) -> Result<DynamicGroupStatusUpdate>

Set the dynamic membership refresh mode

PUT /dynamicgroups/{groupId}/status

Sets active, manual, inactive or none for an existing group. Requires churchcore administer persons. This does not run a refresh, delete stored rules or alter existing memberships. The mode is not checked against the presence or validity of a rule set, so an active group can subsequently fail to refresh. To remove rules as well, use DELETE /ruleset. The response is a flat object without a data wrapper.

§Example
let body = models::DynamicGroupStatusUpdate {
    dynamic_group_status: "manual".into(),
    ..Default::default()
};
let result = client.dynamic_groups().update_status(42, &body)?;
println!("{}", result.dynamic_group_status);

Trait Implementations§

Source§

impl<'a> Clone for DynamicGroupsResource<'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 DynamicGroupsResource<'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