diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-09 00:05:29 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-09 00:05:29 -0700 |
commit | bf63870c88b5a62a2aad08929465b37d8be474dc (patch) | |
tree | ff1b2d78e9cce854563f89ab5828e63fa5f4fb94 /rust/fatcat-api-spec/src | |
parent | 8888e6ea1af818a0a5dfb7414fa767ae176d092f (diff) | |
download | fatcat-bf63870c88b5a62a2aad08929465b37d8be474dc.tar.gz fatcat-bf63870c88b5a62a2aad08929465b37d8be474dc.zip |
rust codegen
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 8 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 8 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 67 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 4 |
4 files changed, 82 insertions, 5 deletions
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<String>, param_arxiv_id: Option<String>, param_jstor_id: Option<String>, + param_ark_id: Option<String>, + param_mag_id: Option<String>, param_expand: Option<String>, param_hide: Option<String>, 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<String>, arxiv_id: Option<String>, jstor_id: Option<String>, + ark_id: Option<String>, + mag_id: Option<String>, expand: Option<String>, hide: Option<String>, context: &Context, @@ -1866,6 +1868,8 @@ pub trait ApiNoContext { core_id: Option<String>, arxiv_id: Option<String>, jstor_id: Option<String>, + ark_id: Option<String>, + mag_id: Option<String>, expand: Option<String>, hide: Option<String>, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; @@ -2307,11 +2311,13 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { core_id: Option<String>, arxiv_id: Option<String>, jstor_id: Option<String>, + ark_id: Option<String>, + mag_id: 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, 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<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 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<String>, + #[serde(rename = "given_name")] + #[serde(skip_serializing_if = "Option::is_none")] + pub given_name: Option<String>, + + #[serde(rename = "surname")] + #[serde(skip_serializing_if = "Option::is_none")] + pub surname: Option<String>, + #[serde(rename = "role")] #[serde(skip_serializing_if = "Option::is_none")] pub role: Option<String>, @@ -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<String>, + #[serde(rename = "version")] + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option<String>, + + #[serde(rename = "number")] + #[serde(skip_serializing_if = "Option::is_none")] + pub number: Option<String>, + #[serde(rename = "pages")] #[serde(skip_serializing_if = "Option::is_none")] pub pages: Option<String>, @@ -774,6 +792,14 @@ 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>, @@ -806,6 +832,18 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub doi: Option<String>, + #[serde(rename = "withdrawn_year")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_year: Option<i64>, + + #[serde(rename = "withdrawn_date")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_date: Option<chrono::NaiveDate>, + + #[serde(rename = "withdrawn_state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub withdrawn_state: Option<String>, + #[serde(rename = "release_year")] #[serde(skip_serializing_if = "Option::is_none")] pub release_year: Option<i64>, @@ -814,9 +852,9 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub release_date: Option<chrono::NaiveDate>, - #[serde(rename = "release_status")] + #[serde(rename = "release_stage")] #[serde(skip_serializing_if = "Option::is_none")] - pub release_status: Option<String>, + pub release_stage: Option<String>, #[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<String>, + /// Avoid this field if possible, and merge with title; usually English + #[serde(rename = "subtitle")] + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option<String>, + /// 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<i64>, + #[serde(rename = "size_bytes")] + #[serde(skip_serializing_if = "Option::is_none")] + pub size_bytes: Option<i64>, + #[serde(rename = "sha1")] pub sha1: String, #[serde(rename = "sha256")] #[serde(skip_serializing_if = "Option::is_none")] pub sha256: Option<String>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, } 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::<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_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()); @@ -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, |