Skip to main content

zulip_api/message/channel_permission/
can_delete_any_message_group.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{impl_cow, GroupSetting};
4
5/// Represents a group-setting value defining the set of users who have permission to delete any message in the channel.
6///
7/// Note that a user must `have content access` to a channel in order to delete any message in the channel.
8/// Users present in the organization-level `can_delete_any_message_group` setting can always delete any message in the channel if they `have content access` to that channel.
9///
10/// **Changes**: New in Zulip 11.0 (feature level 407). Prior to this change, only the users in `can_delete_any_message_group` were able delete any message in the organization.
11///
12/// Modified from `openapi-generator-cli` output:
13///
14/// ```shell,no_build,no_run
15/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
16/// ```
17///
18/// ```text
19/// /*
20/// * Zulip REST API
21/// *
22/// * Powerful open source group chat
23/// *
24/// * The version of the OpenAPI document: 1.0.0
25/// *
26/// * Generated by: https://openapi-generator.tech
27/// */
28/// ```
29///
30/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
31///
32/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
33#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
34pub struct CanDeleteAnyMessageGroup(pub GroupSetting);
35
36impl CanDeleteAnyMessageGroup {
37    /// Creates a new [Self].
38    pub const fn new() -> Self {
39        Self(GroupSetting::new())
40    }
41
42    /// Converts the inner representation into a [Self].
43    pub const fn from_inner(val: GroupSetting) -> Self {
44        Self(val)
45    }
46
47    /// Converts the [Self] into the inner representation.
48    pub fn into_inner(self) -> GroupSetting {
49        self.0
50    }
51}
52
53impl Default for CanDeleteAnyMessageGroup {
54    fn default() -> Self {
55        Self::new()
56    }
57}
58
59impl_cow!(CanDeleteAnyMessageGroup);