11use chrono:: Duration ;
22use google_drive3:: {
3- api:: { File , Scope } ,
4- yup_oauth2:: { read_service_account_key, ServiceAccountAuthenticator } ,
53 DriveHub ,
4+ api:: { File , Scope } ,
5+ yup_oauth2:: { ServiceAccountAuthenticator , read_service_account_key} ,
66} ;
77use http_body_util:: BodyExt ;
88use hyper_rustls:: HttpsConnector ;
99use hyper_util:: client:: legacy:: connect:: HttpConnector ;
10+ use phf:: phf_map;
1011
1112use crate :: base:: field_attrs;
1213use crate :: ops:: sdk:: * ;
@@ -18,45 +19,33 @@ struct ExportMimeType {
1819
1920const FOLDER_MIME_TYPE : & str = "application/vnd.google-apps.folder" ;
2021const FILE_MIME_TYPE : & str = "application/vnd.google-apps.file" ;
21- static EXPORT_MIME_TYPES : LazyLock < HashMap < & ' static str , ExportMimeType > > = LazyLock :: new ( || {
22- HashMap :: from ( [
23- (
24- "application/vnd.google-apps.document" ,
25- ExportMimeType {
26- text : "text/markdown" ,
27- binary : "application/pdf" ,
28- } ,
29- ) ,
30- (
31- "application/vnd.google-apps.spreadsheet" ,
32- ExportMimeType {
33- text : "text/csv" ,
34- binary : "application/pdf" ,
35- } ,
36- ) ,
37- (
38- "application/vnd.google-apps.presentation" ,
39- ExportMimeType {
40- text : "text/plain" ,
41- binary : "application/pdf" ,
42- } ,
43- ) ,
44- (
45- "application/vnd.google-apps.drawing" ,
46- ExportMimeType {
47- text : "image/svg+xml" ,
48- binary : "image/png" ,
49- } ,
50- ) ,
51- (
52- "application/vnd.google-apps.script" ,
53- ExportMimeType {
54- text : "application/vnd.google-apps.script+json" ,
55- binary : "application/vnd.google-apps.script+json" ,
56- } ,
57- ) ,
58- ] )
59- } ) ;
22+ static EXPORT_MIME_TYPES : phf:: Map < & ' static str , ExportMimeType > = phf_map ! {
23+ "application/vnd.google-apps.document" =>
24+ ExportMimeType {
25+ text: "text/markdown" ,
26+ binary: "application/pdf" ,
27+ } ,
28+ "application/vnd.google-apps.spreadsheet" =>
29+ ExportMimeType {
30+ text: "text/csv" ,
31+ binary: "application/pdf" ,
32+ } ,
33+ "application/vnd.google-apps.presentation" =>
34+ ExportMimeType {
35+ text: "text/plain" ,
36+ binary: "application/pdf" ,
37+ } ,
38+ "application/vnd.google-apps.drawing" =>
39+ ExportMimeType {
40+ text: "image/svg+xml" ,
41+ binary: "image/png" ,
42+ } ,
43+ "application/vnd.google-apps.script" =>
44+ ExportMimeType {
45+ text: "application/vnd.google-apps.script+json" ,
46+ binary: "application/vnd.google-apps.script+json" ,
47+ } ,
48+ } ;
6049
6150fn is_supported_file_type ( mime_type : & str ) -> bool {
6251 !mime_type. starts_with ( "application/vnd.google-apps." )
@@ -291,11 +280,7 @@ impl<T> ResultExt<T> for google_drive3::Result<T> {
291280}
292281
293282fn optional_modified_time ( include_ordinal : bool ) -> & ' static str {
294- if include_ordinal {
295- ",modifiedTime"
296- } else {
297- ""
298- }
283+ if include_ordinal { ",modifiedTime" } else { "" }
299284}
300285
301286#[ async_trait]
0 commit comments