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
91
92
93
94
use serde::{Deserialize, Serialize};
use crate::{field_access, impl_default, impl_display};
/// Represents details about the emoji with the specified ID. It has the following properties:
///
/// 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 RealmEmoji {
#[serde(skip_serializing_if = "Option::is_none")]
id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
source_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
still_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
deactivated: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
author_id: Option<u64>,
}
impl RealmEmoji {
/// Creates a new [RealmEmoji].
pub const fn new() -> Self {
Self {
id: None,
name: None,
source_url: None,
still_url: None,
deactivated: None,
author_id: None,
}
}
}
field_access! {
RealmEmoji {
/// The ID for this emoji, same as the object's key.
id: option_cow_deref { str, String },
/// The user-friendly name for this emoji.
///
/// Users in the organization can use this emoji by writing this name between colons (`:name :`).
name: option_cow_deref { str, String },
/// The path relative to the organization's URL where the emoji's image can be found.
source_url: option_cow_deref { str, String },
/// Only non-null when the emoji's image is animated.
///
/// The path relative to the organization's URL where a still (not animated) version of the emoji can be found.
/// (This is currently always the first frame of the animation).
///
/// This is useful for clients to display the emoji in contexts where continuously animating it would be a bad user experience (e.g. because it would be distracting).
///
/// **Changes**: New in Zulip 5.0 (added as optional field in feature level 97 and then made mandatory, but nullable, in feature level 113).
still_url: option_cow_deref { str, String },
}
}
field_access! {
RealmEmoji {
/// Whether the emoji has been deactivated or not.
deactivated: option { bool },
/// The user ID of the user who uploaded the custom emoji.
///
/// Will be `null` if the uploader is unknown.
///
/// **Changes**: New in Zulip 3.0 (feature level 7). Previously was accessible via an `author` object with an `id` field.
author_id: option { u64 },
}
}
impl_default!(RealmEmoji);
impl_display!(RealmEmoji);