From 32cd25bf48d54f5ede4e327d073d2782e4a81524 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 26 Nov 2018 23:43:46 -0800 Subject: codegen hide changes --- rust/fatcat-api-spec/examples/client.rs | 30 +++--- rust/fatcat-api-spec/examples/server_lib/server.rs | 103 ++++++++++++++++----- 2 files changed, 97 insertions(+), 36 deletions(-) (limited to 'rust/fatcat-api-spec/examples') diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index cb025d5c..1273d892 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -104,7 +104,9 @@ fn main() { } Some("GetContainer") => { - let result = client.get_container("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_container("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -114,7 +116,7 @@ fn main() { } Some("LookupContainer") => { - let result = client.lookup_container("issnl_example".to_string()).wait(); + let result = client.lookup_container("issnl_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -140,7 +142,9 @@ fn main() { } Some("GetCreator") => { - let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_creator("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -150,12 +154,12 @@ fn main() { } Some("GetCreatorReleases") => { - let result = client.get_creator_releases("id_example".to_string()).wait(); + let result = client.get_creator_releases("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } Some("LookupCreator") => { - let result = client.lookup_creator("orcid_example".to_string()).wait(); + let result = client.lookup_creator("orcid_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -220,7 +224,7 @@ fn main() { } Some("GetFile") => { - let result = client.get_file("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client.get_file("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -230,7 +234,7 @@ fn main() { } Some("LookupFile") => { - let result = client.lookup_file("sha1_example".to_string()).wait(); + let result = client.lookup_file("sha1_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -261,12 +265,14 @@ fn main() { } Some("GetRelease") => { - let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_release("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } Some("GetReleaseFiles") => { - let result = client.get_release_files("id_example".to_string()).wait(); + let result = client.get_release_files("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -276,7 +282,7 @@ fn main() { } Some("LookupRelease") => { - let result = client.lookup_release("doi_example".to_string()).wait(); + let result = client.lookup_release("doi_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -296,7 +302,7 @@ fn main() { } Some("GetWork") => { - let result = client.get_work("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client.get_work("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -306,7 +312,7 @@ fn main() { } Some("GetWorkReleases") => { - let result = client.get_work_releases("id_example".to_string()).wait(); + let result = client.get_work_releases("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index dc669490..b11f26c3 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -63,9 +63,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_container(&self, id: String, expand: Option, context: &Context) -> Box + Send> { + fn get_container(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -80,9 +86,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_container(&self, issnl: String, context: &Context) -> Box + Send> { + fn lookup_container(&self, issnl: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}", + issnl, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -138,9 +149,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_creator(&self, id: String, expand: Option, context: &Context) -> Box + Send> { + fn get_creator(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -155,15 +172,25 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_creator_releases(&self, id: String, context: &Context) -> Box + Send> { + fn get_creator_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_creator_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn lookup_creator(&self, orcid: String, context: &Context) -> Box + Send> { + fn lookup_creator(&self, orcid: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + orcid, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -267,9 +294,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_file(&self, id: String, expand: Option, context: &Context) -> Box + Send> { + fn get_file(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -284,9 +317,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_file(&self, sha1: String, context: &Context) -> Box + Send> { + fn lookup_file(&self, sha1: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -353,15 +386,26 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_release(&self, id: String, expand: Option, context: &Context) -> Box + Send> { + fn get_release(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_release_files(&self, id: String, context: &Context) -> Box + Send> { + fn get_release_files(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_release_files(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -376,9 +420,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_release(&self, doi: String, context: &Context) -> Box + Send> { + fn lookup_release(&self, doi: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -423,9 +467,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_work(&self, id: String, expand: Option, context: &Context) -> Box + Send> { + fn get_work(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -440,9 +490,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_work_releases(&self, id: String, context: &Context) -> Box + Send> { + fn get_work_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_work_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } -- cgit v1.2.3