1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use serde::{Deserialize, Serialize};
use crate::{impl_default, impl_display};
/// Represents a muted topic.
///
/// - The first element of the tuple is the channel name in which the topic has to be muted
/// - The second element is the topic name to be muted
/// - The third element is an integer UNIX timestamp representing when the topic was muted
///
/// **Changes**: Deprecated in Zulip 6.0 (feature level 134). Starting with this version, `muted_topics` will only be present in the response if the `user_topic` object, which generalizes and replaces this field, is not explicitly requested via `fetch_event_types`. Before Zulip 3.0 (feature level 1), the `muted_topics` array objects were 2-item tuples and did not include the timestamp information for when the topic was muted.
///
/// 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, Eq, PartialEq, Deserialize, Serialize)]
pub struct MutedTopic(String, String, u64);
impl MutedTopic {
/// Creates a new [MutedTopic].
pub const fn new() -> Self {
Self(String::new(), String::new(), 0)
}
/// Gets the channel name.
pub fn channel_name(&self) -> &str {
self.0.as_str()
}
/// Sets the channel name.
pub fn set_channel_name(&mut self, val: String) {
self.0 = val;
}
/// Builder function that sets the channel name.
pub fn with_channel_name(self, val: String) -> Self {
Self(val, self.1, self.2)
}
/// Gets the topic name.
pub fn topic_name(&self) -> &str {
self.1.as_str()
}
/// Sets the topic name.
pub fn set_topic_name(&mut self, val: String) {
self.1 = val;
}
/// Builder function that sets the topic name.
pub fn with_topic_name(self, val: String) -> Self {
Self(self.0, val, self.2)
}
/// Gets the timestamp.
pub const fn timestamp(&self) -> u64 {
self.2
}
/// Sets the timestamp.
pub fn set_timestamp(&mut self, val: u64) {
self.2 = val;
}
/// Builder function that sets the timestamp.
pub fn with_timestamp(self, val: u64) -> Self {
Self(self.0, self.1, val)
}
}
impl_default!(MutedTopic);
impl_display!(MutedTopic);