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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
use std::fmt;
use serde::{Serialize, Deserialize};
/// An icon for an app.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AppIcon {
/// Size of the icon.
///
/// Represented as the maximum of the width and height.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
/// Category of the icon.
///
/// Allowed values are:
/// - `application`: The icon for the application.
/// - `document`: The icon for a file associated with the app.
/// - `documentShared`: The icon for a shared file associated with the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub category: Option<String>,
/// URL for the icon.
#[serde(skip_serializing_if = "Option::is_none")]
pub icon_url: Option<String>,
}
impl fmt::Display for AppIcon {
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 AppIcon {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// A list of apps which the user has installed.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AppList {
/// The list of app IDs that the user has specified to use by default.
///
/// The list is in reverse-priority order (lowest to highest).
#[serde(skip_serializing_if = "Option::is_none")]
pub default_app_ids: Option<Vec<String>>,
/// Identifies what kind of resource this is.
///
/// This always is `drive#appList`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// A link back to this list.
#[serde(skip_serializing_if = "Option::is_none")]
pub self_link: Option<String>,
/// The list of apps.
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<App>>,
}
impl fmt::Display for AppList {
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 AppList {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}
/// An app that a user has installed.
///
/// Contains information about its supported MIME types, file extensions, and
/// other details.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct App {
/// The name of the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// The type of object this app creates such as a Chart.
///
/// If empty, the app name should be used instead.
#[serde(skip_serializing_if = "Option::is_none")]
pub object_type: Option<String>,
/// Whether this app supports creating objects.
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_create: Option<bool>,
/// A link to the product listing for this app.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_url: Option<String>,
/// The list of primary MIME types.
#[serde(skip_serializing_if = "Option::is_none")]
pub primary_mime_types: Option<Vec<String>>,
/// The list of secondary MIME types.
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_mime_types: Option<Vec<String>>,
/// The list of primary file extensions.
#[serde(skip_serializing_if = "Option::is_none")]
pub primary_file_extensions: Option<Vec<String>>,
/// The list of secondary file extensions.
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_file_extensions: Option<Vec<String>>,
/// The ID of the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Whether this app supports importing from Google Docs.
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_import: Option<bool>,
/// Whether the app is installed.
#[serde(skip_serializing_if = "Option::is_none")]
pub installed: Option<bool>,
/// Whether the app is authorized to access data on the user's Drive.
#[serde(skip_serializing_if = "Option::is_none")]
pub authorized: Option<bool>,
/// The various icons for the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub icons: Option<Vec<AppIcon>>,
/// Whether the app is selected as the default handler for the types it supports.
#[serde(skip_serializing_if = "Option::is_none")]
pub use_by_default: Option<bool>,
/// Identifies what kind of resource this is.
///
/// This always is `drive#app`.
#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// A short description of the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub short_description: Option<String>,
/// A long description of the app.
#[serde(skip_serializing_if = "Option::is_none")]
pub long_description: Option<String>,
/// Whether this app supports opening more than one file.
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_multi_open: Option<bool>,
/// The ID of the product listing for this app.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_id: Option<String>,
/// The template URL for opening files with this app.
///
/// The template contains `{ids}` or `{exportIds}` to be replaced by the
/// actual file IDs.
///
/// For more information, see Google's
/// [Open Files](https://developers.google.com/drive/api/guides/integrate-open)
/// documentation.
#[serde(skip_serializing_if = "Option::is_none")]
pub open_url_template: Option<String>,
/// The URL to create a file with this app.
#[serde(skip_serializing_if = "Option::is_none")]
pub create_url: Option<String>,
/// The template URL to create a file with this app in a given folder.
///
/// The template contains the `{folderId}` to be replaced by the folder ID
/// house the new file.
#[serde(skip_serializing_if = "Option::is_none")]
pub create_in_folder_template: Option<String>,
/// Whether this app supports creating files when offline.
#[serde(skip_serializing_if = "Option::is_none")]
pub supports_offline_create: Option<bool>,
/// Whether the app has Drive-wide scope.
///
/// An app with Drive-wide scope can access all files in the user's Drive.
#[serde(skip_serializing_if = "Option::is_none")]
pub has_drive_wide_scope: Option<bool>,
}
impl fmt::Display for App {
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 App {
/// Creates a new, empty instance of this struct.
pub fn new() -> Self {
Self { ..Default::default() }
}
}