diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-12-14 17:36:08 +0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-12-14 17:36:08 +0800 |
commit | f6b7f0afbee988f46ee8f23c8c81224c65407679 (patch) | |
tree | 01c2c61f4464d9e905a71134d2cb65342c0bb0c5 /rust/fatcat-api-spec/src | |
parent | 9ca1bdfdba5de8191ad598ef0cc288eff4d50975 (diff) | |
download | fatcat-f6b7f0afbee988f46ee8f23c8c81224c65407679.tar.gz fatcat-f6b7f0afbee988f46ee8f23c8c81224c65407679.zip |
rust codegen
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 23 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 71 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 16 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 64 |
4 files changed, 130 insertions, 44 deletions
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 5a5f4693..b3b1a922 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -795,19 +795,22 @@ impl Api for Client { &self, param_issnl: Option<String>, param_wikidata_qid: Option<String>, + param_expand: Option<String>, param_hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { // Query parameters let query_issnl = param_issnl.map_or_else(String::new, |query| format!("issnl={issnl}&", issnl = query.to_string())); let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = 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/container/lookup?{issnl}{wikidata_qid}{hide}", + "{}/v0/container/lookup?{issnl}{wikidata_qid}{expand}{hide}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET), wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); @@ -1637,19 +1640,22 @@ impl Api for Client { &self, param_orcid: Option<String>, param_wikidata_qid: Option<String>, + param_expand: Option<String>, param_hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { // Query parameters let query_orcid = param_orcid.map_or_else(String::new, |query| format!("orcid={orcid}&", orcid = query.to_string())); let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = 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/creator/lookup?{orcid}{wikidata_qid}{hide}", + "{}/v0/creator/lookup?{orcid}{wikidata_qid}{expand}{hide}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET), wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); @@ -2862,6 +2868,7 @@ impl Api for Client { param_md5: Option<String>, param_sha1: Option<String>, param_sha256: Option<String>, + param_expand: Option<String>, param_hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { @@ -2869,14 +2876,16 @@ impl Api for Client { let query_md5 = param_md5.map_or_else(String::new, |query| format!("md5={md5}&", md5 = query.to_string())); let query_sha1 = param_sha1.map_or_else(String::new, |query| format!("sha1={sha1}&", sha1 = query.to_string())); let query_sha256 = param_sha256.map_or_else(String::new, |query| format!("sha256={sha256}&", sha256 = 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/file/lookup?{md5}{sha1}{sha256}{hide}", + "{}/v0/file/lookup?{md5}{sha1}{sha256}{expand}{hide}", self.base_path, md5 = utf8_percent_encode(&query_md5, QUERY_ENCODE_SET), sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET), sha256 = utf8_percent_encode(&query_sha256, QUERY_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); @@ -3771,6 +3780,8 @@ impl Api for Client { param_isbn13: Option<String>, param_pmid: Option<String>, param_pmcid: Option<String>, + param_core_id: Option<String>, + param_expand: Option<String>, param_hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { @@ -3780,16 +3791,20 @@ 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_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}{hide}", + "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core_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), 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), + 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 dcc6e813..4e06616f 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -828,7 +828,14 @@ pub trait Api { fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send>; - fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; + fn lookup_container( + &self, + issnl: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &Context, + ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; @@ -858,7 +865,14 @@ pub trait Api { fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send>; - fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; + fn lookup_creator( + &self, + orcid: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &Context, + ) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; @@ -907,6 +921,7 @@ pub trait Api { md5: Option<String>, sha1: Option<String>, sha256: Option<String>, + expand: Option<String>, hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; @@ -948,6 +963,8 @@ pub trait Api { isbn13: Option<String>, pmid: Option<String>, pmcid: Option<String>, + core_id: Option<String>, + expand: Option<String>, hide: Option<String>, context: &Context, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; @@ -1006,7 +1023,13 @@ pub trait ApiNoContext { fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send>; - fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; + fn lookup_container( + &self, + issnl: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; @@ -1035,7 +1058,7 @@ pub trait ApiNoContext { fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send>; - fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; + fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; @@ -1073,7 +1096,14 @@ pub trait ApiNoContext { fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send>; - fn lookup_file(&self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; + fn lookup_file( + &self, + md5: Option<String>, + sha1: Option<String>, + sha256: Option<String>, + expand: Option<String>, + hide: Option<String>, + ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; @@ -1111,6 +1141,8 @@ pub trait ApiNoContext { isbn13: Option<String>, pmid: Option<String>, pmcid: Option<String>, + core_id: Option<String>, + expand: Option<String>, hide: Option<String>, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; @@ -1194,8 +1226,14 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_container_revision(id, expand, hide, &self.context()) } - fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { - self.api().lookup_container(issnl, wikidata_qid, hide, &self.context()) + fn lookup_container( + &self, + issnl: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + self.api().lookup_container(issnl, wikidata_qid, expand, hide, &self.context()) } fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { @@ -1247,8 +1285,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_creator_revision(id, expand, hide, &self.context()) } - fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { - self.api().lookup_creator(orcid, wikidata_qid, hide, &self.context()) + fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + self.api().lookup_creator(orcid, wikidata_qid, expand, hide, &self.context()) } fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { @@ -1323,8 +1361,15 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_file_revision(id, expand, hide, &self.context()) } - fn lookup_file(&self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { - self.api().lookup_file(md5, sha1, sha256, hide, &self.context()) + fn lookup_file( + &self, + md5: Option<String>, + sha1: Option<String>, + sha256: Option<String>, + expand: Option<String>, + hide: Option<String>, + ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { + self.api().lookup_file(md5, sha1, sha256, expand, hide, &self.context()) } fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { @@ -1387,9 +1432,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { isbn13: Option<String>, pmid: Option<String>, pmcid: Option<String>, + core_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, hide, &self.context()) + self.api().lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, expand, hide, &self.context()) } fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<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 6e374746..5b9010cd 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -514,9 +514,9 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub volume: Option<String>, - #[serde(rename = "wikidata_qid")] + #[serde(rename = "core_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub wikidata_qid: Option<String>, + pub core_id: Option<String>, #[serde(rename = "pmcid")] #[serde(skip_serializing_if = "Option::is_none")] @@ -526,14 +526,14 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub pmid: Option<String>, - #[serde(rename = "core_id")] - #[serde(skip_serializing_if = "Option::is_none")] - pub core_id: 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>, @@ -613,11 +613,11 @@ impl ReleaseEntity { pages: None, issue: None, volume: None, - wikidata_qid: None, + core_id: None, pmcid: None, pmid: None, - core_id: None, isbn13: None, + wikidata_qid: None, doi: None, release_date: None, release_status: None, diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index e8d8e1eb..84c691ef 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -128,7 +128,8 @@ where let param_entity: Option<models::ContainerEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -239,7 +240,8 @@ where let param_entity_list: Option<Vec<models::ContainerEntity>> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; param_entity_list } else { @@ -974,9 +976,10 @@ where let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); let param_issnl = query_params.get("issnl").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); let param_wikidata_qid = query_params.get("wikidata_qid").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()); - match api.lookup_container(param_issnl, param_wikidata_qid, param_hide, context).wait() { + match api.lookup_container(param_issnl, param_wikidata_qid, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { LookupContainerResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1085,7 +1088,8 @@ where let param_entity: Option<models::ContainerEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -1195,7 +1199,8 @@ where let param_entity: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -1306,7 +1311,8 @@ where let param_entity_list: Option<Vec<models::CreatorEntity>> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; param_entity_list } else { @@ -2134,9 +2140,10 @@ where let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); let param_orcid = query_params.get("orcid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); let param_wikidata_qid = query_params.get("wikidata_qid").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()); - match api.lookup_creator(param_orcid, param_wikidata_qid, param_hide, context).wait() { + match api.lookup_creator(param_orcid, param_wikidata_qid, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { LookupCreatorResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2245,7 +2252,8 @@ where let param_entity: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -2686,7 +2694,8 @@ where let param_editgroup: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - doesn't match schema: {}", e))))?; param_editgroup } else { @@ -3010,7 +3019,8 @@ where let param_entity: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -3121,7 +3131,8 @@ where let param_entity_list: Option<Vec<models::FileEntity>> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; param_entity_list } else { @@ -3857,9 +3868,10 @@ where let param_md5 = query_params.get("md5").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); let param_sha1 = query_params.get("sha1").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); let param_sha256 = query_params.get("sha256").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()); - match api.lookup_file(param_md5, param_sha1, param_sha256, param_hide, context).wait() { + match api.lookup_file(param_md5, param_sha1, param_sha256, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { LookupFileResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3968,7 +3980,8 @@ where let param_entity: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -4078,7 +4091,8 @@ where let param_entity: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -4189,7 +4203,8 @@ where let param_entity_list: Option<Vec<models::ReleaseEntity>> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; param_entity_list } else { @@ -4299,7 +4314,8 @@ where let param_entity: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -5130,9 +5146,14 @@ 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_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()); - match api.lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_hide, context).wait() { + match api + .lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_core_id, param_expand, param_hide, context) + .wait() + { Ok(rsp) => match rsp { LookupReleaseResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5241,7 +5262,8 @@ where let param_entity: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { @@ -5352,7 +5374,8 @@ where let param_entity_list: Option<Vec<models::WorkEntity>> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; param_entity_list } else { @@ -6211,7 +6234,8 @@ where let param_entity: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); - }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; param_entity } else { |