From 17fe81ea8d58f93f129492dc44a38df9ab8d528e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 9 Jan 2019 13:18:38 -0800 Subject: rust impl required editgroup_id --- rust/fatcat-api-spec/examples/client.rs | 42 +++++----- rust/fatcat-api-spec/examples/server_lib/server.rs | 96 ++++++++++------------ 2 files changed, 63 insertions(+), 75 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 5a43a33c..f5f336b0 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -137,7 +137,7 @@ fn main() { match matches.value_of("operation") { // Disabled because there's no example. // Some("CreateContainer") => { - // let result = client.create_container(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_container(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateContainerBatch") => { @@ -146,7 +146,7 @@ fn main() { } Some("DeleteContainer") => { - let result = client.delete_container("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_container("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -198,13 +198,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateContainer") => { - // let result = client.update_container("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_container("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, // Disabled because there's no example. // Some("CreateCreator") => { - // let result = client.create_creator(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_creator(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateCreatorBatch") => { @@ -213,7 +213,7 @@ fn main() { } Some("DeleteCreator") => { - let result = client.delete_creator("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_creator("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -270,7 +270,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateCreator") => { - // let result = client.update_creator("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_creator("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("AuthCheck") => { @@ -325,7 +325,7 @@ fn main() { // Disabled because there's no example. // Some("CreateFile") => { - // let result = client.create_file(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_file(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateFileBatch") => { @@ -334,7 +334,7 @@ fn main() { } Some("DeleteFile") => { - let result = client.delete_file("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_file("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -387,13 +387,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateFile") => { - // let result = client.update_file("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_file("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, // Disabled because there's no example. // Some("CreateFileset") => { - // let result = client.create_fileset(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_fileset(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateFilesetBatch") => { @@ -402,7 +402,7 @@ fn main() { } Some("DeleteFileset") => { - let result = client.delete_fileset("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_fileset("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -442,13 +442,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateFileset") => { - // let result = client.update_fileset("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_fileset("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, // Disabled because there's no example. // Some("CreateRelease") => { - // let result = client.create_release(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_release(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateReleaseBatch") => { @@ -458,11 +458,11 @@ fn main() { // Disabled because there's no example. // Some("CreateWork") => { - // let result = client.create_work(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_work(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("DeleteRelease") => { - let result = client.delete_release("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_release("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -533,13 +533,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateRelease") => { - // let result = client.update_release("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_release("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, // Disabled because there's no example. // Some("CreateWebcapture") => { - // let result = client.create_webcapture(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_webcapture(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateWebcaptureBatch") => { @@ -548,7 +548,7 @@ fn main() { } Some("DeleteWebcapture") => { - let result = client.delete_webcapture("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_webcapture("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -588,7 +588,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateWebcapture") => { - // let result = client.update_webcapture("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_webcapture("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, Some("CreateWorkBatch") => { @@ -597,7 +597,7 @@ fn main() { } Some("DeleteWork") => { - let result = client.delete_work("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_work("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -642,7 +642,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateWork") => { - // let result = client.update_work("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_work("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, _ => panic!("Invalid operation provided"), diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index 73917351..febd61de 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -30,10 +30,10 @@ use fatcat::{ pub struct Server; impl Api for Server { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_container({:?}, {:?}) - X-Span-ID: {:?}", + "create_container({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -59,10 +59,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_container(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_container(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_container(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -143,16 +143,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_container( - &self, - ident: String, - entity: models::ContainerEntity, - editgroup_id: Option, - context: &Context, - ) -> Box + Send> { + fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_container(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -161,10 +155,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_creator({:?}, {:?}) - X-Span-ID: {:?}", + "create_creator({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -190,10 +184,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_creator(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_creator(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_creator(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -285,10 +279,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_creator(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -362,10 +356,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_file(&self, entity: models::FileEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_file({:?}, {:?}) - X-Span-ID: {:?}", + "create_file({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -391,10 +385,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_file(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_file(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_file(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -477,10 +471,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_file(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -489,10 +483,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_fileset({:?}, {:?}) - X-Span-ID: {:?}", + "create_fileset({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -518,10 +512,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_fileset(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_fileset(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_fileset(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -582,10 +576,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_fileset(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -594,10 +588,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_release({:?}, {:?}) - X-Span-ID: {:?}", + "create_release({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -623,10 +617,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_work(&self, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_work({:?}, {:?}) - X-Span-ID: {:?}", + "create_work({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -634,10 +628,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_release(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_release(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_release(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -759,10 +753,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_release(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -771,10 +765,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "create_webcapture({:?}, {:?}) - X-Span-ID: {:?}", + "create_webcapture({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -800,10 +794,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_webcapture(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_webcapture(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_webcapture(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -864,16 +858,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_webcapture( - &self, - ident: String, - entity: models::WebcaptureEntity, - editgroup_id: Option, - context: &Context, - ) -> Box + Send> { + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_webcapture(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -900,10 +888,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_work(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + fn delete_work(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_work(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("")).clone() @@ -975,10 +963,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "update_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_work(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, -- cgit v1.2.3