From 10e59ac5d002c0b91dece34ed2a082ba5f022edd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 25 Jul 2018 23:40:28 -0700 Subject: API schema: identifier checking, expand query param --- rust/fatcat-api/examples/client.rs | 10 +++++----- rust/fatcat-api/examples/server_lib/server.rs | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'rust/fatcat-api/examples') diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs index 46ff0abd..3cfcd965 100644 --- a/rust/fatcat-api/examples/client.rs +++ b/rust/fatcat-api/examples/client.rs @@ -156,7 +156,7 @@ fn main() { } Some("GetContainer") => { - let result = client.get_container("id_example".to_string()).wait(); + let result = client.get_container("id_example".to_string(), Some("expend_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -166,7 +166,7 @@ fn main() { } Some("GetCreator") => { - let result = client.get_creator("id_example".to_string()).wait(); + let result = client.get_creator("id_example".to_string(), Some("expend_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -196,7 +196,7 @@ fn main() { } Some("GetFile") => { - let result = client.get_file("id_example".to_string()).wait(); + let result = client.get_file("id_example".to_string(), Some("expend_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -206,7 +206,7 @@ fn main() { } Some("GetRelease") => { - let result = client.get_release("id_example".to_string()).wait(); + let result = client.get_release("id_example".to_string(), Some("expend_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -226,7 +226,7 @@ fn main() { } Some("GetWork") => { - let result = client.get_work("id_example".to_string()).wait(); + let result = client.get_work("id_example".to_string(), Some("expend_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/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs index a25e175f..bd18d8fb 100644 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ b/rust/fatcat-api/examples/server_lib/server.rs @@ -110,9 +110,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_container(&self, id: String, context: &Context) -> Box + Send> { + fn get_container(&self, id: String, expend: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_container(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expend, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -127,9 +127,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_creator(&self, id: String, context: &Context) -> Box + Send> { + fn get_creator(&self, id: String, expend: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_creator(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expend, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -168,9 +168,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_file(&self, id: String, context: &Context) -> Box + Send> { + fn get_file(&self, id: String, expend: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_file(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expend, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -185,9 +185,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_release(&self, id: String, context: &Context) -> Box + Send> { + fn get_release(&self, id: String, expend: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_release(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expend, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -214,9 +214,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_work(&self, id: String, context: &Context) -> Box + Send> { + fn get_work(&self, id: String, expend: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_work(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expend, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } -- cgit v1.2.3