From 0a71247fb61a91c1f6d519762013c1445713a728 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 13 Oct 2021 17:42:41 -0700 Subject: codegen for API schema v0.4.0 --- fatcat-openapi/examples/client/main.rs | 21 ++++++++++++++++---- fatcat-openapi/examples/server/server.rs | 33 ++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 10 deletions(-) (limited to 'fatcat-openapi/examples') diff --git a/fatcat-openapi/examples/client/main.rs b/fatcat-openapi/examples/client/main.rs index 14a1bdf..716cbe1 100644 --- a/fatcat-openapi/examples/client/main.rs +++ b/fatcat-openapi/examples/client/main.rs @@ -29,10 +29,10 @@ use fatcat_openapi::{ GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, - LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, - UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, - UpdateWorkResponse, + LookupContainerResponse, LookupCreatorResponse, LookupEditorResponse, LookupFileResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, + UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, + UpdateWebcaptureResponse, UpdateWorkResponse, }; #[allow(unused_imports)] use futures::{future, stream, Stream}; @@ -128,6 +128,7 @@ fn main() { "GetWorkRevision", "LookupContainer", "LookupCreator", + "LookupEditor", "LookupFile", "LookupRelease", ]) @@ -991,6 +992,9 @@ fn main() { Some("LookupContainer") => { let result = rt.block_on(client.lookup_container( Some("issnl_example".to_string()), + Some("issne_example".to_string()), + Some("issnp_example".to_string()), + Some("issn_example".to_string()), Some("wikidata_qid_example".to_string()), Some("expand_example".to_string()), Some("hide_example".to_string()), @@ -1014,6 +1018,14 @@ fn main() { (client.context() as &dyn Has).get().clone() ); } + Some("LookupEditor") => { + let result = rt.block_on(client.lookup_editor(Some("username_example".to_string()))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has).get().clone() + ); + } Some("LookupFile") => { let result = rt.block_on(client.lookup_file( Some("md5_example".to_string()), @@ -1043,6 +1055,7 @@ fn main() { Some("doaj_example".to_string()), Some("dblp_example".to_string()), Some("oai_example".to_string()), + Some("hdl_example".to_string()), Some("expand_example".to_string()), Some("hide_example".to_string()), )); diff --git a/fatcat-openapi/examples/server/server.rs b/fatcat-openapi/examples/server/server.rs index 981487e..d09b080 100644 --- a/fatcat-openapi/examples/server/server.rs +++ b/fatcat-openapi/examples/server/server.rs @@ -132,10 +132,10 @@ use fatcat_openapi::{ GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, - GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, - LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, - UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, - UpdateWebcaptureResponse, UpdateWorkResponse, + GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupEditorResponse, + LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, + UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, + UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; use std::error::Error; use swagger::ApiError; @@ -1442,6 +1442,9 @@ where async fn lookup_container( &self, issnl: Option, + issne: Option, + issnp: Option, + issn: Option, wikidata_qid: Option, expand: Option, hide: Option, @@ -1449,8 +1452,11 @@ where ) -> Result { let context = context.clone(); info!( - "lookup_container({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "lookup_container({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", issnl, + issne, + issnp, + issn, wikidata_qid, expand, hide, @@ -1479,6 +1485,20 @@ where Err("Generic failuare".into()) } + async fn lookup_editor( + &self, + username: Option, + context: &C, + ) -> Result { + let context = context.clone(); + info!( + "lookup_editor({:?}) - X-Span-ID: {:?}", + username, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + async fn lookup_file( &self, md5: Option, @@ -1516,12 +1536,13 @@ where doaj: Option, dblp: Option, oai: Option, + hdl: Option, expand: Option, hide: Option, context: &C, ) -> Result { let context = context.clone(); - info!("lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, oai, expand, hide, context.get().0.clone()); + info!("lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, oai, hdl, expand, hide, context.get().0.clone()); Err("Generic failuare".into()) } -- cgit v1.2.3