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
use std::fmt;
use serde::{Serialize, Deserialize};
use super::User;
/// The metadata for a revision to a file.
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Revision {
/// The ID of the revision.
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// The MIME type of the revision.
#[serde(skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
/// Identifies what kind of resource this is.
///
/// This is always `drive#revision`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// Whether this revision is published.
///
/// This is only applicable to Docs Editors files.
#[serde(skip_serializing_if = "Option::is_none")]
pub published: Option<bool>,
/// Links for exporting Docs Editors files to specific formats.
#[serde(skip_serializing_if = "Option::is_none")]
pub export_links: Option< serde_json::Map<String, serde_json::Value> >,
/// Whether to keep this revision forever, even if it is no longer the head
/// revision.
///
/// If not set, the revision will be automatically purged 30 days after
/// newer content is uploaded. This can be set on a maximum of 200 revisions
/// for a file.
#[serde(skip_serializing_if = "Option::is_none")]
pub keep_forever: Option<bool>,
/// The MD5 checksum of the revision's content.
///
/// This is only applicable to files with binary content in Drive.
#[serde(skip_serializing_if = "Option::is_none")]
pub md5_checksum: Option<String>,
/// The last time the revision was modified (RFC 3339 date-time).
#[serde(skip_serializing_if = "Option::is_none")]
pub modified_time: Option<String>,
/// Whether subsequent revisions will be automatically republished.
///
/// This is only applicable to Docs Editors files.
#[serde(skip_serializing_if = "Option::is_none")]
pub publish_auto: Option<bool>,
/// Whether this revision is published outside the domain.
///
/// This is only applicable to Docs Editors files.
#[serde(skip_serializing_if = "Option::is_none")]
pub published_outside_domain: Option<bool>,
/// A link to the published revision.
///
/// This is only populated for Google Sites files.
#[serde(skip_serializing_if = "Option::is_none")]
pub published_link: Option<String>,
/// The size of the revision's content in bytes.
///
/// This is only applicable to files with binary content in Drive.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<String>,
/// The original filename used to create this revision.
///
/// This is only applicable to files with binary content in Drive.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_filename: Option<String>,
/// The last user to modify this revision.
#[serde(skip_serializing_if = "Option::is_none")]
pub last_modifying_user: Option<User>,
}
#[doc(hidden)]
impl From<&Self> for Revision {
fn from( reference: &Self ) -> Self {
reference.clone()
}
}
impl fmt::Display for Revision {
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 Revision {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// A list of revisions to a file.
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RevisionList {
/// The page token for the next page of replies.
///
/// This will be absent if the end of the 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>,
/// Identifies what kind of resource this is.
///
/// This is always `drive#revisionList`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// The list of replies.
///
/// If [`next_page_token`](RevisionList::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 revisions: Option<Vec<Revision>>,
}
impl fmt::Display for RevisionList {
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 RevisionList {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}