changeset 191:5a55862de3fb

Document small adjustments to generated code
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 29 Jan 2021 13:32:16 +0100
parents 7b7ab508a20f
children 4dfa0a94595c
files README.md example_crates/drive_example/src/media_download.patch example_crates/gcs_example/Cargo.lock example_crates/gcs_example/src/main.rs example_crates/gcs_example/src/media_download.patch example_crates/gcs_example/src/storage_v1_types.rs
diffstat 6 files changed, 48 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Fri Jan 29 11:50:37 2021 +0100
+++ b/README.md	Fri Jan 29 13:32:16 2021 +0100
@@ -46,6 +46,11 @@
   used by the generated code, as well as some types (like errors) and as well as
   all imports. Include this crate in your dependencies when you are using
   the generated code in your project.
+* NOTE: some parts of the API -- for example: URL query parameters that are not
+  represented as enums -- may require small manual adjustments to the generated
+  code. If possible, this should be solved automatically, but sometimes it isn't
+  yet. Refer to the example crates for more details.
+
 
 ## To Do
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example_crates/drive_example/src/media_download.patch	Fri Jan 29 13:32:16 2021 +0100
@@ -0,0 +1,19 @@
+--- ../../generate/gen/drive_v3_types.rs	2021-01-29 11:36:40.915194494 +0100
++++ src/drive_v3_types.rs	2021-01-29 11:42:27.374665228 +0100
+@@ -1676,6 +1676,8 @@
+     /// Responses with Content-Type of application/json
+     #[serde(rename = "json")]
+     Json,
++    #[serde(rename = "media")]
++    Media,
+ }
+ 
+ impl std::default::Default for DriveParamsAlt {
+@@ -1689,6 +1691,7 @@
+         let s = match self {
+             DriveParamsAlt::Undefined => write!(f, "undefined"),
+             DriveParamsAlt::Json => write!(f, "json"),
++            DriveParamsAlt::Media => write!(f, "media"),
+         };
+         Ok(())
+     }
--- a/example_crates/gcs_example/Cargo.lock	Fri Jan 29 11:50:37 2021 +0100
+++ b/example_crates/gcs_example/Cargo.lock	Fri Jan 29 13:32:16 2021 +0100
@@ -32,7 +32,7 @@
 
 [[package]]
 name = "async-google-apis-common"
-version = "0.1.7"
+version = "0.2.0"
 dependencies = [
  "anyhow",
  "chrono",
--- a/example_crates/gcs_example/src/main.rs	Fri Jan 29 11:50:37 2021 +0100
+++ b/example_crates/gcs_example/src/main.rs	Fri Jan 29 13:32:16 2021 +0100
@@ -45,7 +45,7 @@
 ) -> common::Result<()> {
     // Set alt=media for download.
     let mut gparams = storage_v1_types::StorageParams::default();
-    gparams.alt = Some("media".into());
+    gparams.alt = Some(storage_v1_types::StorageParamsAlt::Media);
     let mut params = storage_v1_types::ObjectsGetParams::default();
     params.storage_params = Some(gparams);
     params.bucket = bucket.into();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example_crates/gcs_example/src/media_download.patch	Fri Jan 29 13:32:16 2021 +0100
@@ -0,0 +1,19 @@
+--- ../../generate/gen/storage_v1_types.rs	2021-01-29 11:49:42.176524408 +0100
++++ src/storage_v1_types.rs	2021-01-29 13:25:13.281422576 +0100
+@@ -1125,6 +1125,8 @@
+     /// Responses with Content-Type of application/json
+     #[serde(rename = "json")]
+     Json,
++    #[serde(rename = "media")]
++    Media,
+ }
+ 
+ impl std::default::Default for StorageParamsAlt {
+@@ -1138,6 +1140,7 @@
+         let s = match self {
+             StorageParamsAlt::Undefined => write!(f, "undefined"),
+             StorageParamsAlt::Json => write!(f, "json"),
++            StorageParamsAlt::Media => write!(f, "media"),
+         };
+         Ok(())
+     }
--- a/example_crates/gcs_example/src/storage_v1_types.rs	Fri Jan 29 11:50:37 2021 +0100
+++ b/example_crates/gcs_example/src/storage_v1_types.rs	Fri Jan 29 13:32:16 2021 +0100
@@ -1125,6 +1125,8 @@
     /// Responses with Content-Type of application/json
     #[serde(rename = "json")]
     Json,
+    #[serde(rename = "media")]
+    Media,
 }
 
 impl std::default::Default for StorageParamsAlt {
@@ -1138,6 +1140,7 @@
         let s = match self {
             StorageParamsAlt::Undefined => write!(f, "undefined"),
             StorageParamsAlt::Json => write!(f, "json"),
+            StorageParamsAlt::Media => write!(f, "media"),
         };
         Ok(())
     }