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 delete the messages that they have sent in the channel.
///
/// `update-group-setting`: Note that a user must `have content access` to a channel in order to delete their own message in the channel.
///
/// Users with permission to delete any message in the channel and users present in the organization-level `can_delete_own_message_group` setting can always delete their own messages in the channel if they `have content access` to that channel.
///
/// **Changes**: New in Zulip 11.0 (feature level 407). Prior to this change, only the users in the organization-level `can_delete_any_message_group` and `can_delete_own_message_group` settings were able delete their own messages in the organization.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CanDeleteOwnMessageGroup(pub GroupSetting);

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

impl_cow!(CanDeleteOwnMessageGroup);