From 2027162f9871ebe43a40b0ac4615149141b7a571 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 21 Jan 2019 12:23:08 -0800 Subject: allow arxiv and jstor lookups --- rust/fatcat-api-spec/src/client.rs | 8 +++++++- rust/fatcat-api-spec/src/lib.rs | 9 ++++++++- rust/fatcat-api-spec/src/server.rs | 16 +++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) (limited to 'rust/fatcat-api-spec/src') diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index a3e97fb3..df9d2127 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -5988,6 +5988,8 @@ impl Api for Client { param_pmid: Option, param_pmcid: Option, param_core_id: Option, + param_arxiv_id: Option, + param_jstor_id: Option, param_expand: Option, param_hide: Option, context: &Context, @@ -5999,11 +6001,13 @@ impl Api for Client { let query_pmid = param_pmid.map_or_else(String::new, |query| format!("pmid={pmid}&", pmid = query.to_string())); let query_pmcid = param_pmcid.map_or_else(String::new, |query| format!("pmcid={pmcid}&", pmcid = query.to_string())); let query_core_id = param_core_id.map_or_else(String::new, |query| format!("core_id={core_id}&", core_id = query.to_string())); + let query_arxiv_id = param_arxiv_id.map_or_else(String::new, |query| format!("arxiv_id={arxiv_id}&", arxiv_id = query.to_string())); + let query_jstor_id = param_jstor_id.map_or_else(String::new, |query| format!("jstor_id={jstor_id}&", jstor_id = 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_id}{expand}{hide}", + "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core_id}{arxiv_id}{jstor_id}{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), @@ -6011,6 +6015,8 @@ impl Api for Client { pmid = utf8_percent_encode(&query_pmid, QUERY_ENCODE_SET), pmcid = utf8_percent_encode(&query_pmcid, QUERY_ENCODE_SET), core_id = utf8_percent_encode(&query_core_id, QUERY_ENCODE_SET), + arxiv_id = utf8_percent_encode(&query_arxiv_id, QUERY_ENCODE_SET), + jstor_id = utf8_percent_encode(&query_jstor_id, 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-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index 9585f1c0..20e53f62 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -1568,6 +1568,8 @@ pub trait Api { pmid: Option, pmcid: Option, core_id: Option, + arxiv_id: Option, + jstor_id: Option, expand: Option, hide: Option, context: &Context, @@ -1833,6 +1835,8 @@ pub trait ApiNoContext { pmid: Option, pmcid: Option, core_id: Option, + arxiv_id: Option, + jstor_id: Option, expand: Option, hide: Option, ) -> Box + Send>; @@ -2248,10 +2252,13 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { pmid: Option, pmcid: Option, core_id: Option, + arxiv_id: Option, + jstor_id: Option, expand: Option, hide: Option, ) -> Box + Send> { - self.api().lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, expand, hide, &self.context()) + self.api() + .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, arxiv_id, jstor_id, expand, hide, &self.context()) } fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box + Send> { diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 495c7b20..c3d018d1 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -8256,11 +8256,25 @@ where let param_pmid = query_params.get("pmid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_pmcid = query_params.get("pmcid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_core_id = query_params.get("core_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_arxiv_id = query_params.get("arxiv_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_jstor_id = query_params.get("jstor_id").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()); match api - .lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_core_id, param_expand, param_hide, context) + .lookup_release( + param_doi, + param_wikidata_qid, + param_isbn13, + param_pmid, + param_pmcid, + param_core_id, + param_arxiv_id, + param_jstor_id, + param_expand, + param_hide, + context, + ) .wait() { Ok(rsp) => match rsp { -- cgit v1.2.3