From 40b5d40bed9e20e5c7a40d1741601a8317e078d8 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 19 Nov 2020 12:19:38 -0800 Subject: codegen rust schema crate --- rust/fatcat-openapi/examples/client.rs | 1 + rust/fatcat-openapi/examples/server_lib/server.rs | 4 +++- rust/fatcat-openapi/src/client.rs | 5 ++++- rust/fatcat-openapi/src/lib.rs | 5 ++++- rust/fatcat-openapi/src/models.rs | 6 ++++++ rust/fatcat-openapi/src/server.rs | 2 ++ 6 files changed, 20 insertions(+), 3 deletions(-) (limited to 'rust') diff --git a/rust/fatcat-openapi/examples/client.rs b/rust/fatcat-openapi/examples/client.rs index 3fb833bd..eaaf26a6 100644 --- a/rust/fatcat-openapi/examples/client.rs +++ b/rust/fatcat-openapi/examples/client.rs @@ -560,6 +560,7 @@ fn main() { Some("mag_example".to_string()), Some("doaj_example".to_string()), Some("dblp_example".to_string()), + Some("oai_example".to_string()), Some("expand_example".to_string()), Some("hide_example".to_string()), ) diff --git a/rust/fatcat-openapi/examples/server_lib/server.rs b/rust/fatcat-openapi/examples/server_lib/server.rs index 6b681c7e..56b82cc5 100644 --- a/rust/fatcat-openapi/examples/server_lib/server.rs +++ b/rust/fatcat-openapi/examples/server_lib/server.rs @@ -818,13 +818,14 @@ impl Api for Server { mag: Option, doaj: Option, dblp: Option, + oai: Option, expand: Option, hide: Option, context: &Context, ) -> Box + Send> { let context = context.clone(); println!( - "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, @@ -837,6 +838,7 @@ impl Api for Server { mag, doaj, dblp, + oai, expand, hide, context.x_span_id.unwrap_or(String::from("")).clone() diff --git a/rust/fatcat-openapi/src/client.rs b/rust/fatcat-openapi/src/client.rs index 45591b9a..fdb03405 100644 --- a/rust/fatcat-openapi/src/client.rs +++ b/rust/fatcat-openapi/src/client.rs @@ -5879,6 +5879,7 @@ impl Api for Client { param_mag: Option, param_doaj: Option, param_dblp: Option, + param_oai: Option, param_expand: Option, param_hide: Option, context: &Context, @@ -5896,11 +5897,12 @@ impl Api for Client { let query_mag = param_mag.map_or_else(String::new, |query| format!("mag={mag}&", mag = query.to_string())); let query_doaj = param_doaj.map_or_else(String::new, |query| format!("doaj={doaj}&", doaj = query.to_string())); let query_dblp = param_dblp.map_or_else(String::new, |query| format!("dblp={dblp}&", dblp = query.to_string())); + let query_oai = param_oai.map_or_else(String::new, |query| format!("oai={oai}&", oai = query.to_string())); let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); let url = format!( - "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core}{arxiv}{jstor}{ark}{mag}{doaj}{dblp}{expand}{hide}", + "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core}{arxiv}{jstor}{ark}{mag}{doaj}{dblp}{oai}{expand}{hide}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET), wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET), @@ -5914,6 +5916,7 @@ impl Api for Client { mag = utf8_percent_encode(&query_mag, QUERY_ENCODE_SET), doaj = utf8_percent_encode(&query_doaj, QUERY_ENCODE_SET), dblp = utf8_percent_encode(&query_dblp, QUERY_ENCODE_SET), + oai = utf8_percent_encode(&query_oai, QUERY_ENCODE_SET), expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); diff --git a/rust/fatcat-openapi/src/lib.rs b/rust/fatcat-openapi/src/lib.rs index d82b7368..4fe878e1 100644 --- a/rust/fatcat-openapi/src/lib.rs +++ b/rust/fatcat-openapi/src/lib.rs @@ -1559,6 +1559,7 @@ pub trait Api { mag: Option, doaj: Option, dblp: Option, + oai: Option, expand: Option, hide: Option, context: &Context, @@ -1812,6 +1813,7 @@ pub trait ApiNoContext { mag: Option, doaj: Option, dblp: Option, + oai: Option, expand: Option, hide: Option, ) -> Box + Send>; @@ -2216,11 +2218,12 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { mag: Option, doaj: Option, dblp: Option, + oai: Option, expand: Option, hide: Option, ) -> Box + Send> { self.api() - .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, expand, hide, &self.context()) + .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, oai, expand, hide, &self.context()) } fn update_release(&self, editgroup_id: String, ident: String, entity: models::ReleaseEntity) -> Box + Send> { diff --git a/rust/fatcat-openapi/src/models.rs b/rust/fatcat-openapi/src/models.rs index c539339e..965caacf 100644 --- a/rust/fatcat-openapi/src/models.rs +++ b/rust/fatcat-openapi/src/models.rs @@ -1240,6 +1240,11 @@ pub struct ReleaseExtIds { #[serde(rename = "dblp")] #[serde(skip_serializing_if = "Option::is_none")] pub dblp: Option, + + /// OAI-PMH identifier; only used when an OAI-PMH record is the only authoritative metadata (eg, journal OAI-PMH feeds w/o DOIs) + #[serde(rename = "oai")] + #[serde(skip_serializing_if = "Option::is_none")] + pub oai: Option, } impl ReleaseExtIds { @@ -1257,6 +1262,7 @@ impl ReleaseExtIds { mag: None, doaj: None, dblp: None, + oai: None, } } } diff --git a/rust/fatcat-openapi/src/server.rs b/rust/fatcat-openapi/src/server.rs index 230aea45..59e83124 100644 --- a/rust/fatcat-openapi/src/server.rs +++ b/rust/fatcat-openapi/src/server.rs @@ -8289,6 +8289,7 @@ where let param_mag = query_params.get("mag").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_doaj = query_params.get("doaj").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_dblp = query_params.get("dblp").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_oai = query_params.get("oai").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); @@ -8306,6 +8307,7 @@ where param_mag, param_doaj, param_dblp, + param_oai, param_expand, param_hide, context, -- cgit v1.2.3