zulip_api/message/channel_permission/can_add_subscribers_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 add subscribers to this channel.
6///
7/// Users who can administer the channel or have similar realm-level permissions can add subscribers to a public channel regardless of the value of this setting.
8///
9/// Users in this group need not be subscribed to a private channel to add subscribers to it.
10///
11/// Note that a user must `have content access` to a channel and permission to administer the channel in order to modify this setting.
12///
13/// **Changes**: New in Zulip 10.0 (feature level 342). Previously, there was no channel-level setting for this permission.
14///
15/// Modified from `openapi-generator-cli` output:
16///
17/// ```shell,no_build,no_run
18/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
19/// ```
20///
21/// ```text
22/// /*
23/// * Zulip REST API
24/// *
25/// * Powerful open source group chat
26/// *
27/// * The version of the OpenAPI document: 1.0.0
28/// *
29/// * Generated by: https://openapi-generator.tech
30/// */
31/// ```
32///
33/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
34///
35/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
36#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
37pub struct CanAddSubscribersGroup(pub GroupSetting);
38
39impl CanAddSubscribersGroup {
40 /// Creates a new [CanAddSubscribersGroup].
41 pub const fn new() -> Self {
42 Self(GroupSetting::new())
43 }
44
45 /// Converts the inner representation into a [Self].
46 pub const fn from_inner(val: GroupSetting) -> Self {
47 Self(val)
48 }
49
50 /// Converts the [Self] into the inner representation.
51 pub fn into_inner(self) -> GroupSetting {
52 self.0
53 }
54}
55
56impl Default for CanAddSubscribersGroup {
57 fn default() -> Self {
58 Self::new()
59 }
60}
61
62impl_cow!(CanAddSubscribersGroup);