diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-22 21:41:35 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-22 21:50:29 -0800 |
commit | 09475b87821142c5cd36c6b90fb97deb2a058312 (patch) | |
tree | 2f57b9623a8f8938e8d13b4441e8861b19e6e533 /rust/fatcat-api-spec/examples | |
parent | 83d5c49f5093b1820b625e1b3a1e21fc7242f79e (diff) | |
download | fatcat-09475b87821142c5cd36c6b90fb97deb2a058312.tar.gz fatcat-09475b87821142c5cd36c6b90fb97deb2a058312.zip |
allow passing description+extra to batch endpoints
Pretty messy, but I needed some way to do this.
In particular, requires json.dumps() in python code, for now. Blech.
Diffstat (limited to 'rust/fatcat-api-spec/examples')
-rw-r--r-- | rust/fatcat-api-spec/examples/client.rs | 70 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/server_lib/server.rs | 42 |
2 files changed, 98 insertions, 14 deletions
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index 196580e4..40a5a3ab 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -144,7 +144,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateContainerBatch") => { - let result = client.create_container_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_container_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -211,7 +219,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateCreatorBatch") => { - let result = client.create_creator_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_creator_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -359,7 +375,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateFileBatch") => { - let result = client.create_file_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_file_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -427,7 +451,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateFilesetBatch") => { - let result = client.create_fileset_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_fileset_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -482,7 +514,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateReleaseBatch") => { - let result = client.create_release_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_release_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -575,7 +615,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateWebcaptureBatch") => { - let result = client.create_webcapture_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_webcapture_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -624,7 +672,15 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateWorkBatch") => { - let result = client.create_work_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + let result = client + .create_work_batch( + &Vec::new(), + Some(true), + Some("editgroup_id_example".to_string()), + Some("description_example".to_string()), + Some("extra_example".to_string()), + ) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index 20336528..98f31485 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -46,14 +46,18 @@ impl Api for Server { entity_list: &Vec<models::ContainerEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_container_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_container_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -171,14 +175,18 @@ impl Api for Server { entity_list: &Vec<models::CreatorEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_creator_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -465,14 +473,18 @@ impl Api for Server { entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_file_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -592,14 +604,18 @@ impl Api for Server { entity_list: &Vec<models::FilesetEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_fileset_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_fileset_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -697,14 +713,18 @@ impl Api for Server { entity_list: &Vec<models::ReleaseEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_release_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -878,14 +898,18 @@ impl Api for Server { entity_list: &Vec<models::WebcaptureEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_webcapture_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_webcapture_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) @@ -972,14 +996,18 @@ impl Api for Server { entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>, + description: Option<String>, + extra: Option<String>, context: &Context, ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_work_batch({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup_id, + description, + extra, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) |