drive_v3/objects/
comment.rs1use std::fmt;
2use serde::{Serialize, Deserialize};
3
4use super::{Reply, User};
5
6#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct QuotedFileContent {
14 #[serde(skip_serializing_if = "Option::is_none")]
16 pub mime_type: Option<String>,
17
18 #[serde(skip_serializing_if = "Option::is_none")]
22 pub value: Option<String>,
23}
24
25impl fmt::Display for QuotedFileContent {
26 fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
27 let json = serde_json::to_string_pretty(&self)
28 .unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
29
30 write!(f, "{}", json)
31 }
32}
33
34impl QuotedFileContent {
35 pub fn new() -> Self {
37 Self { ..Default::default() }
38 }
39}
40
41#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub struct Comment {
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub id: Option<String>,
48
49 #[serde(skip_serializing_if = "Option::is_none")]
53 pub kind: Option<String>,
54
55 #[serde(skip_serializing_if = "Option::is_none")]
57 pub created_time: Option<String>,
58
59 #[serde(skip_serializing_if = "Option::is_none")]
62 pub modified_time: Option<String>,
63
64 #[serde(skip_serializing_if = "Option::is_none")]
66 pub resolved: Option<bool>,
67
68 #[serde(skip_serializing_if = "Option::is_none")]
74 pub anchor: Option<String>,
75
76 #[serde(skip_serializing_if = "Option::is_none")]
78 pub replies: Option<Vec<Reply>>,
79
80 #[serde(skip_serializing_if = "Option::is_none")]
84 pub author: Option<User>,
85
86 #[serde(skip_serializing_if = "Option::is_none")]
90 pub deleted: Option<bool>,
91
92 #[serde(skip_serializing_if = "Option::is_none")]
94 pub html_content: Option<String>,
95
96 #[serde(skip_serializing_if = "Option::is_none")]
102 pub content: Option<String>,
103
104 #[serde(skip_serializing_if = "Option::is_none")]
110 pub quoted_file_content: Option<QuotedFileContent>,
111}
112
113#[doc(hidden)]
114impl From<&Self> for Comment {
115 fn from( reference: &Self ) -> Self {
116 reference.clone()
117 }
118}
119
120impl fmt::Display for Comment {
121 fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
122 let json = serde_json::to_string_pretty(&self)
123 .unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
124
125 write!(f, "{}", json)
126 }
127}
128
129impl Comment {
130 pub fn new() -> Self {
132 Self { ..Default::default() }
133 }
134}
135
136#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
138#[serde(rename_all = "camelCase")]
139pub struct CommentList {
140 #[serde(skip_serializing_if = "Option::is_none")]
144 pub kind: Option<String>,
145
146 #[serde(skip_serializing_if = "Option::is_none")]
152 pub comments: Option<Vec<Comment>>,
153
154 #[serde(skip_serializing_if = "Option::is_none")]
162 pub next_page_token: Option<String>,
163}
164
165impl fmt::Display for CommentList {
166 fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
167 let json = serde_json::to_string_pretty(&self)
168 .unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
169
170 write!(f, "{}", json)
171 }
172}
173
174impl CommentList {
175 pub fn new() -> Self {
177 Self { ..Default::default() }
178 }
179}