diff options
Diffstat (limited to 'rust/fatcat-api-spec/examples')
-rw-r--r-- | rust/fatcat-api-spec/examples/client.rs | 253 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/server_lib/server.rs | 322 |
2 files changed, 285 insertions, 290 deletions
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index 5d600965..43f002fc 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -28,45 +28,43 @@ fn main() { Arg::with_name("operation") .help("Sets the operation to run") .possible_values(&[ - "AcceptEditgroup", "CreateContainerBatch", - "CreateCreatorBatch", - "CreateFileBatch", - "CreateReleaseBatch", - "CreateWorkBatch", "DeleteContainer", - "DeleteCreator", - "DeleteFile", - "DeleteRelease", - "DeleteWork", - "GetChangelog", - "GetChangelogEntry", "GetContainer", "GetContainerHistory", + "LookupContainer", + "CreateCreatorBatch", + "DeleteCreator", "GetCreator", "GetCreatorHistory", "GetCreatorReleases", - "GetEditgroup", + "LookupCreator", "GetEditor", "GetEditorChangelog", + "GetStats", + "AcceptEditgroup", + "GetChangelog", + "GetChangelogEntry", + "GetEditgroup", + "CreateFileBatch", + "DeleteFile", "GetFile", "GetFileHistory", + "LookupFile", + "CreateReleaseBatch", + "DeleteRelease", "GetRelease", "GetReleaseFiles", "GetReleaseHistory", - "GetStats", + "LookupRelease", + "CreateWorkBatch", + "DeleteWork", "GetWork", "GetWorkHistory", "GetWorkReleases", - "LookupContainer", - "LookupCreator", - "LookupFile", - "LookupRelease", - ]) - .required(true) + ]).required(true) .index(1), - ) - .arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not")) + ).arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not")) .arg(Arg::with_name("host").long("host").takes_value(true).default_value("localhost").help("Hostname to contact")) .arg(Arg::with_name("port").long("port").takes_value(true).default_value("8080").help("Port to contact")) .get_matches(); @@ -90,11 +88,6 @@ fn main() { let client = client.with_context(fatcat::Context::new_with_span_id(self::uuid::Uuid::new_v4().to_string())); match matches.value_of("operation") { - Some("AcceptEditgroup") => { - let result = client.accept_editgroup("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - // Disabled because there's no example. // Some("CreateContainer") => { // let result = client.create_container(???, Some("editgroup_example".to_string())).wait(); @@ -105,54 +98,39 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - // Disabled because there's no example. - // Some("CreateCreator") => { - // let result = client.create_creator(???, Some("editgroup_example".to_string())).wait(); - // 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_example".to_string())).wait(); + Some("DeleteContainer") => { + let result = client.delete_container("id_example".to_string(), Some("editgroup_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - // Disabled because there's no example. - // Some("CreateEditgroup") => { - // let result = client.create_editgroup(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, + Some("GetContainer") => { + let result = client.get_container("id_example".to_string(), Some("expand_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + } - // Disabled because there's no example. - // Some("CreateFile") => { - // let result = client.create_file(???, Some("editgroup_example".to_string())).wait(); - // 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_example".to_string())).wait(); + Some("GetContainerHistory") => { + let result = client.get_container_history("id_example".to_string(), Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - // Disabled because there's no example. - // Some("CreateRelease") => { - // let result = client.create_release(???, Some("editgroup_example".to_string())).wait(); - // 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_example".to_string())).wait(); + Some("LookupContainer") => { + let result = client.lookup_container("issnl_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } // Disabled because there's no example. - // Some("CreateWork") => { - // let result = client.create_work(???, Some("editgroup_example".to_string())).wait(); + // Some("UpdateContainer") => { + // let result = client.update_container("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); // 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_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - Some("DeleteContainer") => { - let result = client.delete_container("id_example".to_string(), Some("editgroup_example".to_string())).wait(); + // Disabled because there's no example. + // Some("CreateCreator") => { + // let result = client.create_creator(???, Some("editgroup_example".to_string())).wait(); + // 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_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -161,53 +139,63 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("DeleteFile") => { - let result = client.delete_file("id_example".to_string(), Some("editgroup_example".to_string())).wait(); + Some("GetCreator") => { + let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("DeleteRelease") => { - let result = client.delete_release("id_example".to_string(), Some("editgroup_example".to_string())).wait(); + Some("GetCreatorHistory") => { + let result = client.get_creator_history("id_example".to_string(), Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("DeleteWork") => { - let result = client.delete_work("id_example".to_string(), Some("editgroup_example".to_string())).wait(); + Some("GetCreatorReleases") => { + let result = client.get_creator_releases("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetChangelog") => { - let result = client.get_changelog(Some(789)).wait(); + Some("LookupCreator") => { + let result = client.lookup_creator("orcid_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetChangelogEntry") => { - let result = client.get_changelog_entry(789).wait(); + // Disabled because there's no example. + // Some("UpdateCreator") => { + // let result = client.update_creator("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, + Some("GetEditor") => { + let result = client.get_editor("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetContainer") => { - let result = client.get_container("id_example".to_string(), Some("expand_example".to_string())).wait(); + Some("GetEditorChangelog") => { + let result = client.get_editor_changelog("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetContainerHistory") => { - let result = client.get_container_history("id_example".to_string(), Some(789)).wait(); + Some("GetStats") => { + let result = client.get_stats(Some("more_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetCreator") => { - let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait(); + Some("AcceptEditgroup") => { + let result = client.accept_editgroup("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetCreatorHistory") => { - let result = client.get_creator_history("id_example".to_string(), Some(789)).wait(); + // Disabled because there's no example. + // Some("CreateEditgroup") => { + // let result = client.create_editgroup(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, + Some("GetChangelog") => { + let result = client.get_changelog(Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetCreatorReleases") => { - let result = client.get_creator_releases("id_example".to_string()).wait(); + Some("GetChangelogEntry") => { + let result = client.get_changelog_entry(789).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -216,13 +204,18 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetEditor") => { - let result = client.get_editor("id_example".to_string()).wait(); + // Disabled because there's no example. + // Some("CreateFile") => { + // let result = client.create_file(???, Some("editgroup_example".to_string())).wait(); + // 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_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetEditorChangelog") => { - let result = client.get_editor_changelog("id_example".to_string()).wait(); + Some("DeleteFile") => { + let result = client.delete_file("id_example".to_string(), Some("editgroup_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -236,84 +229,86 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetRelease") => { - let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).wait(); + Some("LookupFile") => { + let result = client.lookup_file("sha1_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetReleaseFiles") => { - let result = client.get_release_files("id_example".to_string()).wait(); + // Disabled because there's no example. + // Some("UpdateFile") => { + // let result = client.update_file("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, + + // Disabled because there's no example. + // Some("CreateRelease") => { + // let result = client.create_release(???, Some("editgroup_example".to_string())).wait(); + // 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_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetReleaseHistory") => { - let result = client.get_release_history("id_example".to_string(), Some(789)).wait(); + // Disabled because there's no example. + // Some("CreateWork") => { + // let result = client.create_work(???, Some("editgroup_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, + Some("DeleteRelease") => { + let result = client.delete_release("id_example".to_string(), Some("editgroup_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetStats") => { - let result = client.get_stats(Some("more_example".to_string())).wait(); + Some("GetRelease") => { + let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetWork") => { - let result = client.get_work("id_example".to_string(), Some("expand_example".to_string())).wait(); + Some("GetReleaseFiles") => { + let result = client.get_release_files("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetWorkHistory") => { - let result = client.get_work_history("id_example".to_string(), Some(789)).wait(); + Some("GetReleaseHistory") => { + let result = client.get_release_history("id_example".to_string(), Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("GetWorkReleases") => { - let result = client.get_work_releases("id_example".to_string()).wait(); + Some("LookupRelease") => { + let result = client.lookup_release("doi_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("LookupContainer") => { - let result = client.lookup_container("issnl_example".to_string()).wait(); + // Disabled because there's no example. + // Some("UpdateRelease") => { + // let result = client.update_release("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); + // 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_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("LookupCreator") => { - let result = client.lookup_creator("orcid_example".to_string()).wait(); + Some("DeleteWork") => { + let result = client.delete_work("id_example".to_string(), Some("editgroup_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("LookupFile") => { - let result = client.lookup_file("sha1_example".to_string()).wait(); + Some("GetWork") => { + let result = client.get_work("id_example".to_string(), Some("expand_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("LookupRelease") => { - let result = client.lookup_release("doi_example".to_string()).wait(); + Some("GetWorkHistory") => { + let result = client.get_work_history("id_example".to_string(), Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - // Disabled because there's no example. - // Some("UpdateContainer") => { - // let result = client.update_container("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - - // Disabled because there's no example. - // Some("UpdateCreator") => { - // let result = client.update_creator("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - - // Disabled because there's no example. - // Some("UpdateFile") => { - // let result = client.update_file("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - - // Disabled because there's no example. - // Some("UpdateRelease") => { - // let result = client.update_release("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, + Some("GetWorkReleases") => { + let result = client.get_work_releases("id_example".to_string()).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + } // Disabled because there's no example. // Some("UpdateWork") => { diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index 2ca8eb3b..dc669490 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -23,12 +23,6 @@ use fatcat::{ pub struct Server; impl Api for Server { - fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( @@ -58,74 +52,56 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_creator({:?}, {:?}) - X-Span-ID: {:?}", - entity, + "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", + id, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn create_creator_batch( - &self, - entity_list: &Vec<models::CreatorEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> { + fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> { + fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("create_editgroup({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + limit, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { + fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "create_file({:?}, {:?}) - X-Span-ID: {:?}", - entity, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn create_file_batch( - &self, - entity_list: &Vec<models::FileEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> { + fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, + "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + entity, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_release({:?}, {:?}) - X-Span-ID: {:?}", + "create_creator({:?}, {:?}) - X-Span-ID: {:?}", entity, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -133,16 +109,16 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_release_batch( + fn create_creator_batch( &self, - entity_list: &Vec<models::ReleaseEntity>, + entity_list: &Vec<models::CreatorEntity>, autoaccept: Option<bool>, editgroup: Option<String>, context: &Context, - ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> { + ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", entity_list, autoaccept, editgroup, @@ -151,157 +127,143 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_work({:?}, {:?}) - X-Span-ID: {:?}", - entity, + "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + id, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn create_work_batch( - &self, - entity_list: &Vec<models::WorkEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> { + fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", + "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", id, - editgroup, + limit, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { + fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", + "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, + entity, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { + fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> { + fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> { + fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_changelog_entry({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_stats({:?}) - X-Span-ID: {:?}", more, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { + fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { + fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("create_editgroup({:?}) - X-Span-ID: {:?}", editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { + fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { + fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> { let context = context.clone(); - println!( - "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); + println!("get_changelog_entry({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { + fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { + fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "create_file({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> { + fn create_file_batch( + &self, + entity_list: &Vec<models::FileEntity>, + autoaccept: Option<bool>, + editgroup: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + entity_list, + autoaccept, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> { + fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -322,73 +284,95 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { + fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { + fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", + "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, - limit, + entity, + editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> { + fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_stats({:?}) - X-Span-ID: {:?}", more, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "create_release({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { + fn create_release_batch( + &self, + entity_list: &Vec<models::ReleaseEntity>, + autoaccept: Option<bool>, + editgroup: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + entity_list, + autoaccept, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { + fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, + "create_work({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + editgroup, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { + fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + limit, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -398,10 +382,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { + fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", id, entity, editgroup, @@ -410,42 +394,58 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { + fn create_work_batch( + &self, + entity_list: &Vec<models::WorkEntity>, + autoaccept: Option<bool>, + editgroup: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", - id, - entity, + "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + entity_list, + autoaccept, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, - entity, editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } - fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { + fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", id, - entity, - editgroup, + limit, context.x_span_id.unwrap_or(String::from("<none>")).clone() ); Box::new(futures::failed("Generic failure".into())) } + fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( |