summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-10 15:05:21 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-10 15:05:21 -0700
commitaa6545c4125d800765fa2673a6b4a534cee54aad (patch)
tree735d728d396fa3c95d0e3c24578a02e923168be3 /rust/fatcat-api-spec/src
parentb07f92545eaf112db735903dac8f7809fe62440a (diff)
downloadfatcat-aa6545c4125d800765fa2673a6b4a534cee54aad.tar.gz
fatcat-aa6545c4125d800765fa2673a6b4a534cee54aad.zip
codegen extid changes (rust)
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r--rust/fatcat-api-spec/src/client.rs32
-rw-r--r--rust/fatcat-api-spec/src/lib.rs32
-rw-r--r--rust/fatcat-api-spec/src/models.rs114
-rw-r--r--rust/fatcat-api-spec/src/server.rs20
4 files changed, 106 insertions, 92 deletions
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index c4d6b687..057f1651 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -6017,11 +6017,11 @@ impl Api for Client {
param_isbn13: Option<String>,
param_pmid: Option<String>,
param_pmcid: Option<String>,
- param_core_id: Option<String>,
- param_arxiv_id: Option<String>,
- param_jstor_id: Option<String>,
- param_ark_id: Option<String>,
- param_mag_id: Option<String>,
+ param_core: Option<String>,
+ param_arxiv: Option<String>,
+ param_jstor: Option<String>,
+ param_ark: Option<String>,
+ param_mag: Option<String>,
param_expand: Option<String>,
param_hide: Option<String>,
context: &Context,
@@ -6032,27 +6032,27 @@ impl Api for Client {
let query_isbn13 = param_isbn13.map_or_else(String::new, |query| format!("isbn13={isbn13}&", isbn13 = query.to_string()));
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_ark_id = param_ark_id.map_or_else(String::new, |query| format!("ark_id={ark_id}&", ark_id = query.to_string()));
- let query_mag_id = param_mag_id.map_or_else(String::new, |query| format!("mag_id={mag_id}&", mag_id = query.to_string()));
+ let query_core = param_core.map_or_else(String::new, |query| format!("core={core}&", core = query.to_string()));
+ let query_arxiv = param_arxiv.map_or_else(String::new, |query| format!("arxiv={arxiv}&", arxiv = query.to_string()));
+ let query_jstor = param_jstor.map_or_else(String::new, |query| format!("jstor={jstor}&", jstor = query.to_string()));
+ let query_ark = param_ark.map_or_else(String::new, |query| format!("ark={ark}&", ark = query.to_string()));
+ let query_mag = param_mag.map_or_else(String::new, |query| format!("mag={mag}&", mag = 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}{arxiv_id}{jstor_id}{ark_id}{mag_id}{expand}{hide}",
+ "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core}{arxiv}{jstor}{ark}{mag}{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),
isbn13 = utf8_percent_encode(&query_isbn13, QUERY_ENCODE_SET),
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),
- ark_id = utf8_percent_encode(&query_ark_id, QUERY_ENCODE_SET),
- mag_id = utf8_percent_encode(&query_mag_id, QUERY_ENCODE_SET),
+ core = utf8_percent_encode(&query_core, QUERY_ENCODE_SET),
+ arxiv = utf8_percent_encode(&query_arxiv, QUERY_ENCODE_SET),
+ jstor = utf8_percent_encode(&query_jstor, QUERY_ENCODE_SET),
+ ark = utf8_percent_encode(&query_ark, QUERY_ENCODE_SET),
+ mag = utf8_percent_encode(&query_mag, 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 06d3cfdb..e01c4fd8 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -1577,11 +1577,11 @@ pub trait Api {
isbn13: Option<String>,
pmid: Option<String>,
pmcid: Option<String>,
- core_id: Option<String>,
- arxiv_id: Option<String>,
- jstor_id: Option<String>,
- ark_id: Option<String>,
- mag_id: Option<String>,
+ core: Option<String>,
+ arxiv: Option<String>,
+ jstor: Option<String>,
+ ark: Option<String>,
+ mag: Option<String>,
expand: Option<String>,
hide: Option<String>,
context: &Context,
@@ -1865,11 +1865,11 @@ pub trait ApiNoContext {
isbn13: Option<String>,
pmid: Option<String>,
pmcid: Option<String>,
- core_id: Option<String>,
- arxiv_id: Option<String>,
- jstor_id: Option<String>,
- ark_id: Option<String>,
- mag_id: Option<String>,
+ core: Option<String>,
+ arxiv: Option<String>,
+ jstor: Option<String>,
+ ark: Option<String>,
+ mag: Option<String>,
expand: Option<String>,
hide: Option<String>,
) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
@@ -2308,16 +2308,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
isbn13: Option<String>,
pmid: Option<String>,
pmcid: Option<String>,
- core_id: Option<String>,
- arxiv_id: Option<String>,
- jstor_id: Option<String>,
- ark_id: Option<String>,
- mag_id: Option<String>,
+ core: Option<String>,
+ arxiv: Option<String>,
+ jstor: Option<String>,
+ ark: Option<String>,
+ mag: Option<String>,
expand: Option<String>,
hide: Option<String>,
) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
self.api()
- .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, arxiv_id, jstor_id, ark_id, mag_id, expand, hide, &self.context())
+ .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, expand, hide, &self.context())
}
fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index bf989b84..1d6b5088 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -792,45 +792,8 @@ pub struct ReleaseEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub volume: Option<String>,
- #[serde(rename = "mag_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub mag_id: Option<String>,
-
- #[serde(rename = "ark_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub ark_id: Option<String>,
-
- #[serde(rename = "jstor_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub jstor_id: Option<String>,
-
- #[serde(rename = "arxiv_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub arxiv_id: Option<String>,
-
- #[serde(rename = "core_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub core_id: Option<String>,
-
- #[serde(rename = "pmcid")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub pmcid: Option<String>,
-
- #[serde(rename = "pmid")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub pmid: Option<String>,
-
- #[serde(rename = "isbn13")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub isbn13: Option<String>,
-
- #[serde(rename = "wikidata_qid")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub wikidata_qid: Option<String>,
-
- #[serde(rename = "doi")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub doi: Option<String>,
+ #[serde(rename = "ext_ids")]
+ pub ext_ids: models::ReleaseEntityExtIds,
#[serde(rename = "withdrawn_year")]
#[serde(skip_serializing_if = "Option::is_none")]
@@ -933,7 +896,7 @@ pub struct ReleaseEntity {
}
impl ReleaseEntity {
- pub fn new() -> ReleaseEntity {
+ pub fn new(ext_ids: models::ReleaseEntityExtIds) -> ReleaseEntity {
ReleaseEntity {
abstracts: None,
refs: None,
@@ -946,16 +909,7 @@ impl ReleaseEntity {
pages: None,
issue: None,
volume: None,
- mag_id: None,
- ark_id: None,
- jstor_id: None,
- arxiv_id: None,
- core_id: None,
- pmcid: None,
- pmid: None,
- isbn13: None,
- wikidata_qid: None,
- doi: None,
+ ext_ids: ext_ids,
withdrawn_year: None,
withdrawn_date: None,
withdrawn_status: None,
@@ -1013,6 +967,66 @@ impl ReleaseEntityAbstracts {
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct ReleaseEntityExtIds {
+ #[serde(rename = "doi")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub doi: Option<String>,
+
+ #[serde(rename = "wikidata_qid")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub wikidata_qid: Option<String>,
+
+ #[serde(rename = "isbn13")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub isbn13: Option<String>,
+
+ #[serde(rename = "pmid")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub pmid: Option<String>,
+
+ #[serde(rename = "pmcid")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub pmcid: Option<String>,
+
+ #[serde(rename = "core")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub core: Option<String>,
+
+ #[serde(rename = "arxiv")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub arxiv: Option<String>,
+
+ #[serde(rename = "jstor")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub jstor: Option<String>,
+
+ #[serde(rename = "ark")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ark: Option<String>,
+
+ #[serde(rename = "mag")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub mag: Option<String>,
+}
+
+impl ReleaseEntityExtIds {
+ pub fn new() -> ReleaseEntityExtIds {
+ ReleaseEntityExtIds {
+ doi: None,
+ wikidata_qid: None,
+ isbn13: None,
+ pmid: None,
+ pmcid: None,
+ core: None,
+ arxiv: None,
+ jstor: None,
+ ark: None,
+ mag: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ReleaseRef {
#[serde(rename = "index")]
#[serde(skip_serializing_if = "Option::is_none")]
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs
index 7379aed9..ffe3347b 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -8278,11 +8278,11 @@ where
let param_isbn13 = query_params.get("isbn13").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_pmid = query_params.get("pmid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_pmcid = query_params.get("pmcid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- let param_core_id = query_params.get("core_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- let param_arxiv_id = query_params.get("arxiv_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- let param_jstor_id = query_params.get("jstor_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- let param_ark_id = query_params.get("ark_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- let param_mag_id = query_params.get("mag_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_core = query_params.get("core").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_arxiv = query_params.get("arxiv").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_jstor = query_params.get("jstor").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_ark = query_params.get("ark").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_mag = query_params.get("mag").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());
@@ -8293,11 +8293,11 @@ where
param_isbn13,
param_pmid,
param_pmcid,
- param_core_id,
- param_arxiv_id,
- param_jstor_id,
- param_ark_id,
- param_mag_id,
+ param_core,
+ param_arxiv,
+ param_jstor,
+ param_ark,
+ param_mag,
param_expand,
param_hide,
context,