zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use serde::{Deserialize, Serialize};

use crate::{impl_cow, GroupSetting};

/// Represents A group-setting value defining the set of users who have permission to remove subscribers from this channel.
///
/// Organization administrators can unsubscribe others from a channel as though they were in this group without being explicitly listed here.  Note that a user must have metadata access to a channel and permission to administer the channel in order to modify this setting.
///
/// **Changes**: Prior to Zulip 10.0 (feature level 349), channel administrators could not unsubscribe other users if they were not an organization administrator or part of `can_remove_subscribers_group`. Realm administrators were not allowed to unsubscribe other users from a private channel if they were not subscribed to that channel.  Prior to Zulip 10.0 (feature level 320), this value was always the integer ID of a system group.  Before Zulip 8.0 (feature level 197), the `can_remove_subscribers_group` setting was named `can_remove_subscribers_group_id`.  New in Zulip 6.0 (feature level 142).  [setting-values]: /api/group-setting-values
///
/// Modified from `openapi-generator-cli` output:
///
/// ```shell,no_build,no_run
/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
/// ```
///
/// ```text
/// /*
/// * Zulip REST API
/// *
/// * Powerful open source group chat
/// *
/// * The version of the OpenAPI document: 1.0.0
/// *
/// * Generated by: https://openapi-generator.tech
/// */
/// ```
///
/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
///
/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CanRemoveSubscribersGroup(pub GroupSetting);

impl CanRemoveSubscribersGroup {
    /// Creates a new [Self].
    pub const fn new() -> Self {
        Self(GroupSetting::new())
    }

    /// Converts the inner representation into a [Self].
    pub const fn from_inner(val: GroupSetting) -> Self {
        Self(val)
    }

    /// Converts the [Self] into the inner representation.
    pub fn into_inner(self) -> GroupSetting {
        self.0
    }
}

impl Default for CanRemoveSubscribersGroup {
    fn default() -> Self {
        Self::new()
    }
}

impl_cow!(CanRemoveSubscribersGroup);