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
use serde::{Deserialize, Serialize};
use crate::{field_access, impl_default, impl_display};
/// Represents details of the saved snippet.
///
/// 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 SavedSnippet {
#[serde(skip_serializing_if = "Option::is_none")]
id: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
content: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
date_created: Option<u64>,
}
impl SavedSnippet {
/// Creates a new [SavedSnippet].
pub const fn new() -> Self {
Self {
id: None,
title: None,
content: None,
date_created: None,
}
}
}
field_access! {
SavedSnippet {
/// The unique ID of the saved snippet.
id: option { u64 },
/// The UNIX timestamp for when the saved snippet was created, in UTC seconds.
date_created: option { u64 },
}
}
field_access! {
SavedSnippet {
/// The title of the saved snippet.
title: option_cow_deref { str, String },
/// The content of the saved snippet in [Zulip-flavored Markdown](https://zulip.com/help/format-your-message-using-markdown) format.
///
/// Clients should insert this content into a message when using a saved snippet.
content: option_cow_deref { str, String },
}
}
impl_default!(SavedSnippet);
impl_display!(SavedSnippet);