aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-11-19 12:19:38 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-11-19 14:55:15 -0800
commit40b5d40bed9e20e5c7a40d1741601a8317e078d8 (patch)
tree67c46917c2d2be2dc4d30543656a39ca5a3c014e /rust
parentba4a85cf2ee51d775137541944e2e9d24b2e1bc9 (diff)
downloadfatcat-40b5d40bed9e20e5c7a40d1741601a8317e078d8.tar.gz
fatcat-40b5d40bed9e20e5c7a40d1741601a8317e078d8.zip
codegen rust schema crate
Diffstat (limited to 'rust')
-rw-r--r--rust/fatcat-openapi/examples/client.rs1
-rw-r--r--rust/fatcat-openapi/examples/server_lib/server.rs4
-rw-r--r--rust/fatcat-openapi/src/client.rs5
-rw-r--r--rust/fatcat-openapi/src/lib.rs5
-rw-r--r--rust/fatcat-openapi/src/models.rs6
-rw-r--r--rust/fatcat-openapi/src/server.rs2
6 files changed, 20 insertions, 3 deletions
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<String>,
doaj: Option<String>,
dblp: Option<String>,
+ oai: Option<String>,
expand: Option<String>,
hide: Option<String>,
context: &Context,
) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + 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("<none>")).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<String>,
param_doaj: Option<String>,
param_dblp: Option<String>,
+ param_oai: Option<String>,
param_expand: Option<String>,
param_hide: Option<String>,
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<String>,
doaj: Option<String>,
dblp: Option<String>,
+ oai: Option<String>,
expand: Option<String>,
hide: Option<String>,
context: &Context,
@@ -1812,6 +1813,7 @@ pub trait ApiNoContext {
mag: Option<String>,
doaj: Option<String>,
dblp: Option<String>,
+ oai: Option<String>,
expand: Option<String>,
hide: Option<String>,
) -> Box<dyn Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
@@ -2216,11 +2218,12 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
mag: Option<String>,
doaj: Option<String>,
dblp: Option<String>,
+ oai: Option<String>,
expand: Option<String>,
hide: Option<String>,
) -> Box<dyn Future<Item = LookupReleaseResponse, Error = ApiError> + 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<dyn Future<Item = UpdateReleaseResponse, Error = ApiError> + 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<String>,
+
+ /// 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<String>,
}
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::<String>().ok());
let param_doaj = query_params.get("doaj").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_dblp = query_params.get("dblp").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_oai = query_params.get("oai").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
@@ -8306,6 +8307,7 @@ where
param_mag,
param_doaj,
param_dblp,
+ param_oai,
param_expand,
param_hide,
context,