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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
use std::fmt;
use serde::{Serialize, Deserialize};
use super::{Reply, User};
/// The file content to which the comment refers, typically within the anchor
/// region.
///
/// For a text file, for example, this would be the text at the location of the
/// comment.
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct QuotedFileContent {
/// The MIME type of the quoted content.
#[serde(skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
/// The quoted content itself.
///
/// This is interpreted as plain text if set through the API.
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
impl fmt::Display for QuotedFileContent {
fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
let json = serde_json::to_string_pretty(&self)
.unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
write!(f, "{}", json)
}
}
impl QuotedFileContent {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// A comment on a file.
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Comment {
/// The ID of the comment.
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Identifies what kind of resource this is.
///
/// This is always `drive#comment`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// The time at which the comment was created (RFC 3339 date-time).
#[serde(skip_serializing_if = "Option::is_none")]
pub created_time: Option<String>,
/// The last time the comment or any of its replies was modified
/// (RFC 3339 date-time).
#[serde(skip_serializing_if = "Option::is_none")]
pub modified_time: Option<String>,
/// Whether the comment has been resolved by one of its replies.
#[serde(skip_serializing_if = "Option::is_none")]
pub resolved: Option<bool>,
/// A region of the document represented as a JSON string.
///
/// For details on defining anchor properties, refer to Google's
/// [Manage comments and replies](https://developers.google.com/drive/api/v3/manage-comments)
/// documentation.
#[serde(skip_serializing_if = "Option::is_none")]
pub anchor: Option<String>,
/// The full list of replies to the comment in chronological order.
#[serde(skip_serializing_if = "Option::is_none")]
pub replies: Option<Vec<Reply>>,
/// The author of the reply.
///
/// The author's email address and permission ID will not be populated.
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<User>,
/// Whether the reply has been deleted.
///
/// A deleted reply has no content.
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted: Option<bool>,
/// The content of the reply with HTML formatting.
#[serde(skip_serializing_if = "Option::is_none")]
pub html_content: Option<String>,
/// The plain text content of the reply.
///
/// This field is used for setting the content, while
/// [`html_content`](Reply::html_content) should be displayed. This is
/// required on creates if no `action` is specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<String>,
/// The file content to which the comment refers, typically within the
/// anchor region.
///
/// For a text file, for example, this would be the text at the location of
/// the comment.
#[serde(skip_serializing_if = "Option::is_none")]
pub quoted_file_content: Option<QuotedFileContent>,
}
#[doc(hidden)]
impl From<&Self> for Comment {
fn from( reference: &Self ) -> Self {
reference.clone()
}
}
impl fmt::Display for Comment {
fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
let json = serde_json::to_string_pretty(&self)
.unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
write!(f, "{}", json)
}
}
impl Comment {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// A list of comments on a file.
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CommentList {
/// Identifies what kind of resource this is.
///
/// This is always `drive#commentList`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// The list of comments.
///
/// If [`next_page_token`](CommentList::next_page_token) is populated, then
/// this list may be incomplete and an additional page of results should be
/// fetched.
#[serde(skip_serializing_if = "Option::is_none")]
pub comments: Option<Vec<Comment>>,
/// The page token for the next page of comments.
///
/// This will be absent if the end of the comments list has been reached. If
/// the token is rejected for any reason, it should be discarded, and
/// pagination should be restarted from the first page of results. The page
/// token is typically valid for several hours. However, if new items are
/// added or removed, your expected results might differ.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
}
impl fmt::Display for CommentList {
fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
let json = serde_json::to_string_pretty(&self)
.unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
write!(f, "{}", json)
}
}
impl CommentList {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}