From 061e66c4c41063e6b7321f1f421b5152e9e5a84d Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 13 Dec 2018 19:36:25 +0800 Subject: schema tweaks, and rust codegen --- rust/fatcat-api-spec/examples/server_lib/server.rs | 213 +++++++++++++++++++-- 1 file changed, 200 insertions(+), 13 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 b11f26c3..7341e528 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -12,11 +12,14 @@ use swagger; use fatcat::models; use fatcat::{ AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse, - DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse, - GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse, - GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, - LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, + CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, + DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse, + GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, + GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, + GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse, + GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse, GetWorkHistoryResponse, + GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, }; #[derive(Copy, Clone)] @@ -63,6 +66,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn delete_container_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_container(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -75,6 +84,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_container_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_container_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -86,11 +101,30 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_container(&self, issnl: String, hide: Option, context: &Context) -> Box + Send> { + fn get_container_redirects(&self, id: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_container_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_container_revision(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}", + "get_container_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn lookup_container(&self, issnl: Option, wikidata_qid: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "lookup_container({:?}, {:?}, {:?}) - X-Span-ID: {:?}", issnl, + wikidata_qid, hide, context.x_span_id.unwrap_or(String::from("")).clone() ); @@ -149,6 +183,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn delete_creator_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_creator(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -161,6 +201,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_creator_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_creator_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -172,6 +218,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_creator_redirects(&self, id: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_creator_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_creator_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -183,11 +235,24 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_creator(&self, orcid: String, hide: Option, context: &Context) -> Box + Send> { + fn get_creator_revision(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( - "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + "get_creator_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn lookup_creator(&self, orcid: Option, wikidata_qid: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "lookup_creator({:?}, {:?}, {:?}) - X-Span-ID: {:?}", orcid, + wikidata_qid, hide, context.x_span_id.unwrap_or(String::from("")).clone() ); @@ -294,6 +359,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn delete_file_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_file(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -306,6 +377,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_file_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_file_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -317,9 +394,41 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_file(&self, sha1: String, hide: Option, context: &Context) -> Box + Send> { + fn get_file_redirects(&self, id: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_file_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_file_revision(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_file_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn lookup_file( + &self, + md5: Option, + sha1: Option, + sha256: Option, + hide: Option, + context: &Context, + ) -> Box + Send> { let context = context.clone(); - println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "lookup_file({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + md5, + sha1, + sha256, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -386,6 +495,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn delete_release_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_release(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -398,6 +513,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_release_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_release_files(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -420,9 +541,45 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_release(&self, doi: String, hide: Option, context: &Context) -> Box + Send> { + fn get_release_redirects(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("get_release_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_release_revision(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_release_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn lookup_release( + &self, + doi: Option, + wikidata_qid: Option, + isbn13: Option, + pmid: Option, + pmcid: Option, + hide: Option, + context: &Context, + ) -> Box + Send> { + let context = context.clone(); + println!( + "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + doi, + wikidata_qid, + isbn13, + pmid, + pmcid, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -467,6 +624,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn delete_work_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_work(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -479,6 +642,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_work_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_work_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -490,6 +659,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_work_redirects(&self, id: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_work_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn get_work_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -501,6 +676,18 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_work_revision(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_work_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + 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, editgroup: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( -- cgit v1.2.3