From bf63870c88b5a62a2aad08929465b37d8be474dc Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 9 May 2019 00:05:29 -0700 Subject: rust codegen --- rust/fatcat-api-spec/src/client.rs | 8 ++++- rust/fatcat-api-spec/src/lib.rs | 8 ++++- rust/fatcat-api-spec/src/models.rs | 67 ++++++++++++++++++++++++++++++++++++-- rust/fatcat-api-spec/src/server.rs | 4 +++ 4 files changed, 82 insertions(+), 5 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 6d654146..c4d6b687 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -6020,6 +6020,8 @@ impl Api for Client { param_core_id: Option, param_arxiv_id: Option, param_jstor_id: Option, + param_ark_id: Option, + param_mag_id: Option, param_expand: Option, param_hide: Option, context: &Context, @@ -6033,11 +6035,13 @@ impl Api for Client { 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_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}{expand}{hide}", + "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core_id}{arxiv_id}{jstor_id}{ark_id}{mag_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), @@ -6047,6 +6051,8 @@ impl Api for Client { 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), 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 59129869..06d3cfdb 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -1580,6 +1580,8 @@ pub trait Api { core_id: Option, arxiv_id: Option, jstor_id: Option, + ark_id: Option, + mag_id: Option, expand: Option, hide: Option, context: &Context, @@ -1866,6 +1868,8 @@ pub trait ApiNoContext { core_id: Option, arxiv_id: Option, jstor_id: Option, + ark_id: Option, + mag_id: Option, expand: Option, hide: Option, ) -> Box + Send>; @@ -2307,11 +2311,13 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { core_id: Option, arxiv_id: Option, jstor_id: Option, + ark_id: Option, + mag_id: Option, expand: Option, hide: Option, ) -> Box + Send> { self.api() - .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, arxiv_id, jstor_id, expand, hide, &self.context()) + .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, arxiv_id, jstor_id, ark_id, mag_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/models.rs b/rust/fatcat-api-spec/src/models.rs index f1b657c2..cd418d99 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -706,6 +706,14 @@ pub struct ReleaseContrib { #[serde(skip_serializing_if = "Option::is_none")] pub raw_name: Option, + #[serde(rename = "given_name")] + #[serde(skip_serializing_if = "Option::is_none")] + pub given_name: Option, + + #[serde(rename = "surname")] + #[serde(skip_serializing_if = "Option::is_none")] + pub surname: Option, + #[serde(rename = "role")] #[serde(skip_serializing_if = "Option::is_none")] pub role: Option, @@ -727,6 +735,8 @@ impl ReleaseContrib { creator_id: None, creator: None, raw_name: None, + given_name: None, + surname: None, role: None, raw_affiliation: None, extra: None, @@ -762,6 +772,14 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub publisher: Option, + #[serde(rename = "version")] + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, + + #[serde(rename = "number")] + #[serde(skip_serializing_if = "Option::is_none")] + pub number: Option, + #[serde(rename = "pages")] #[serde(skip_serializing_if = "Option::is_none")] pub pages: Option, @@ -774,6 +792,14 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub volume: Option, + #[serde(rename = "mag_id")] + #[serde(skip_serializing_if = "Option::is_none")] + pub mag_id: Option, + + #[serde(rename = "ark_id")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ark_id: Option, + #[serde(rename = "jstor_id")] #[serde(skip_serializing_if = "Option::is_none")] pub jstor_id: Option, @@ -806,6 +832,18 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub doi: Option, + #[serde(rename = "withdrawn_year")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_year: Option, + + #[serde(rename = "withdrawn_date")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_date: Option, + + #[serde(rename = "withdrawn_state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_state: Option, + #[serde(rename = "release_year")] #[serde(skip_serializing_if = "Option::is_none")] pub release_year: Option, @@ -814,9 +852,9 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub release_date: Option, - #[serde(rename = "release_status")] + #[serde(rename = "release_stage")] #[serde(skip_serializing_if = "Option::is_none")] - pub release_status: Option, + pub release_stage: Option, #[serde(rename = "release_type")] #[serde(skip_serializing_if = "Option::is_none")] @@ -855,6 +893,11 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub original_title: Option, + /// Avoid this field if possible, and merge with title; usually English + #[serde(rename = "subtitle")] + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option, + /// Required for valid entities. The title used in citations and for display; usually English #[serde(rename = "title")] #[serde(skip_serializing_if = "Option::is_none")] @@ -898,9 +941,13 @@ impl ReleaseEntity { license_slug: None, language: None, publisher: None, + version: None, + number: None, pages: None, issue: None, volume: None, + mag_id: None, + ark_id: None, jstor_id: None, arxiv_id: None, core_id: None, @@ -909,9 +956,12 @@ impl ReleaseEntity { isbn13: None, wikidata_qid: None, doi: None, + withdrawn_year: None, + withdrawn_date: None, + withdrawn_state: None, release_year: None, release_date: None, - release_status: None, + release_stage: None, release_type: None, container_id: None, webcaptures: None, @@ -920,6 +970,7 @@ impl ReleaseEntity { container: None, work_id: None, original_title: None, + subtitle: None, title: None, state: None, ident: None, @@ -1132,12 +1183,20 @@ pub struct WebcaptureEntityCdx { #[serde(skip_serializing_if = "Option::is_none")] pub status_code: Option, + #[serde(rename = "size_bytes")] + #[serde(skip_serializing_if = "Option::is_none")] + pub size_bytes: Option, + #[serde(rename = "sha1")] pub sha1: String, #[serde(rename = "sha256")] #[serde(skip_serializing_if = "Option::is_none")] pub sha256: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, } impl WebcaptureEntityCdx { @@ -1148,8 +1207,10 @@ impl WebcaptureEntityCdx { url: url, mimetype: None, status_code: None, + size_bytes: None, sha1: sha1, sha256: None, + extra: None, } } } diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 90b4d19a..7379aed9 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -8281,6 +8281,8 @@ where 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_ark_id = query_params.get("ark_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_mag_id = query_params.get("mag_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()); @@ -8294,6 +8296,8 @@ where param_core_id, param_arxiv_id, param_jstor_id, + param_ark_id, + param_mag_id, param_expand, param_hide, context, -- cgit v1.2.3