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
use serde::{Deserialize, Serialize};
use crate::{field_access, impl_default, impl_display, VisibilityPolicy};
/// Represents the user's configuration for a given topic.
///
/// 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, PartialEq, Serialize, Deserialize)]
pub struct UserTopic {
#[serde(skip_serializing_if = "Option::is_none")]
stream_id: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
topic_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
last_updated: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
visibility_policy: Option<VisibilityPolicy>,
}
impl UserTopic {
/// Creates a new [UserTopic].
pub const fn new() -> UserTopic {
UserTopic {
stream_id: None,
topic_name: None,
last_updated: None,
visibility_policy: None,
}
}
}
field_access! {
UserTopic {
/// The ID of the channel to which the topic belongs.
stream_id: option { u64 },
/// An integer UNIX timestamp representing when the user-topic relationship was changed.
last_updated: option { u64 },
/// An integer indicating the user's visibility configuration for the topic.
visibility_policy: option { VisibilityPolicy },
}
}
field_access! {
UserTopic {
/// The name of the topic.
///
/// Note that the empty string topic may have been rewritten by the server to the value of `realm_empty_topic_display_name` found in the
/// [`POST /register`](https://zulip.com/api/register-queue) response depending on the value of the `empty_topic_name`
/// [client capability](https://zulip.com/api/register-queue#parameter-client_capabilities).
///
/// **Changes**: The `empty_topic_name` client capability is new in Zulip 10.0 (feature level 334).
topic_name: option_cow_deref { str, String },
}
}
impl_default!(UserTopic);
impl_display!(UserTopic);