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 post in this channel.
///
/// Note that a user must have metadata access to a channel and permission to administer the channel in order to modify this setting.
///
/// **Changes**: New in Zulip 10.0 (feature level 333). Previously `stream_post_policy` field used to control the permission to post in the channel.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CanSendMessageGroup(pub GroupSetting);

impl CanSendMessageGroup {
    /// 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 CanSendMessageGroup {
    fn default() -> Self {
        Self::new()
    }
}

impl_cow!(CanSendMessageGroup);