From 91c080a2e82ec4e8908cb8e3916a543519151847 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 11 Sep 2018 16:10:47 -0700 Subject: implement new editgroup_id behavior --- rust/fatcat-api-spec/examples/server_lib/server.rs | 80 ++++++++++++++++------ 1 file changed, 60 insertions(+), 20 deletions(-) (limited to 'rust/fatcat-api-spec/examples/server_lib') diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index ab08f594..2ca8eb3b 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -29,9 +29,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box + Send> { + fn create_container(&self, entity: models::ContainerEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("create_container({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "create_container({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -53,9 +58,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box + Send> { + fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("create_creator({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "create_creator({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -83,9 +93,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box + Send> { + fn create_file(&self, entity: models::FileEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("create_file({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "create_file({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -107,9 +122,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box + Send> { + fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("create_release({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "create_release({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -131,9 +151,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box + Send> { + fn create_work(&self, entity: models::WorkEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("create_work({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "create_work({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -373,48 +398,63 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_container(&self, id: String, entity: models::ContainerEntity, context: &Context) -> Box + Send> { + fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_container(\"{}\", {:?}) - X-Span-ID: {:?}", + "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, entity, + editgroup, context.x_span_id.unwrap_or(String::from("")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn update_creator(&self, id: String, entity: models::CreatorEntity, context: &Context) -> Box + Send> { + fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, entity, + editgroup, context.x_span_id.unwrap_or(String::from("")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn update_file(&self, id: String, entity: models::FileEntity, context: &Context) -> Box + Send> { + fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("update_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn update_release(&self, id: String, entity: models::ReleaseEntity, context: &Context) -> Box + Send> { + fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_release(\"{}\", {:?}) - X-Span-ID: {:?}", + "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, entity, + editgroup, context.x_span_id.unwrap_or(String::from("")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn update_work(&self, id: String, entity: models::WorkEntity, context: &Context) -> Box + Send> { + fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("update_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "update_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } } -- cgit v1.2.3