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
use serde::{Deserialize, Serialize};
use crate::{field_access, impl_default, impl_display, ReactionType};
/// Represents the status details of a user with the key of the object being the ID of the user.
///
/// 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 UserStatus {
#[serde(skip_serializing_if = "Option::is_none")]
away: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
status_text: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
emoji_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
emoji_code: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reaction_type: Option<ReactionType>,
}
impl UserStatus {
/// Creates a new [UserStatus].
pub const fn new() -> Self {
Self {
away: None,
status_text: None,
emoji_name: None,
emoji_code: None,
reaction_type: None,
}
}
}
field_access! {
UserStatus {
/// If present, the user has marked themself \"away\".
///
/// **Changes**: Deprecated in Zulip 6.0 (feature level 148);
/// starting with that feature level,
/// `away` is a legacy way to access the user's `presence_enabled` setting,
/// with `away = !presence_enabled`.
///
/// To be removed in a future release.
away: option { bool },
/// If present, a string indicating the type of emoji.
reaction_type: option { ReactionType },
}
}
field_access! {
UserStatus {
/// If present, the text content of the user's status message.
status_text: option_cow_deref { str, String },
/// If present, the name for the emoji to associate with the user's status. **Changes**: New in Zulip 5.0 (feature level 86).
emoji_name: option_cow_deref { str, String },
/// If present, a unique identifier, defining the specific emoji codepoint requested, within the namespace of the `reaction_type`.
///
/// **Changes**: New in Zulip 5.0 (feature level 86).
emoji_code: option_cow_deref { str, String },
}
}
impl_default!(UserStatus);
impl_display!(UserStatus);