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
use std::fmt;
use serde::{Serialize, Deserialize};
use super::{File, DriveInfo};
/// A list of changes for a user.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ChangeList {
/// Identifies what kind of resource this is.
///
/// This is always `drive#changeList`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// The page token for the next page of changes.
///
/// This will be absent if the end of the changes list has been reached.
/// The page token doesn't expire.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
/// The starting page token for future changes.
///
/// This will be present only if the end of the current changes list has
/// been reached. The page token doesn't expire.
#[serde(skip_serializing_if = "Option::is_none")]
pub new_start_page_token: Option<String>,
/// The list of changes.
///
/// If [`next_page_token`](ChangeList::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 changes: Option<Vec<Change>>,
}
impl fmt::Display for ChangeList {
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 ChangeList {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// A change to a file or shared drive.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Change {
/// Identifies what kind of resource this is.
///
/// This is always `drive#change`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// Whether the file or shared drive has been removed from this list of
/// changes, for example by deletion or loss of access.
#[serde(skip_serializing_if = "Option::is_none")]
pub removed: Option<bool>,
/// The updated state of the file.
///
/// Present if the type is file and the file has not been removed from this
/// list of changes.
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<File>,
/// The ID of the file which has changed.
#[serde(skip_serializing_if = "Option::is_none")]
pub file_id: Option<String>,
/// The time of this change (RFC 3339 date-time).
#[serde(skip_serializing_if = "Option::is_none")]
pub time: Option<String>,
/// The ID of the shared drive associated with this change.
#[serde(skip_serializing_if = "Option::is_none")]
pub drive_id: Option<String>,
/// The type of the change.
///
/// Possible values are `file` and `drive`.
#[serde(skip_serializing_if = "Option::is_none")]
pub change_type: Option<String>,
/// The updated state of the shared drive.
///
/// Present if the [`change_type`](Change::change_type) is `drive`, the user
/// is still a member of the shared drive, and the shared drive has not been
/// deleted.
#[serde(skip_serializing_if = "Option::is_none")]
pub drive: Option<DriveInfo>,
}
impl fmt::Display for Change {
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 Change {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}