From 32cd25bf48d54f5ede4e327d073d2782e4a81524 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 26 Nov 2018 23:43:46 -0800 Subject: codegen hide changes --- rust/fatcat-api-spec/src/client.rs | 116 +++++++++++++++++++++++++++---------- rust/fatcat-api-spec/src/lib.rs | 96 +++++++++++++++--------------- rust/fatcat-api-spec/src/server.rs | 45 ++++++++++---- 3 files changed, 168 insertions(+), 89 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 aa5feba3..bc325361 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -382,15 +382,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_container(&self, param_id: String, param_expand: Option, context: &Context) -> Box + Send> { + fn get_container(&self, param_id: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters 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/{id}?{expand}", + "{}/v0/container/{id}?{expand}{hide}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET) + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -518,11 +520,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn lookup_container(&self, param_issnl: String, context: &Context) -> Box + Send> { + fn lookup_container(&self, param_issnl: String, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.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}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET)); + let url = format!( + "{}/v0/container/lookup?{issnl}{hide}", + self.base_path, + issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -876,15 +884,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_creator(&self, param_id: String, param_expand: Option, context: &Context) -> Box + Send> { + fn get_creator(&self, param_id: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters 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/{id}?{expand}", + "{}/v0/creator/{id}?{expand}{hide}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET) + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -1012,8 +1022,16 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_creator_releases(&self, param_id: String, context: &Context) -> Box + Send> { - let url = format!("{}/v0/creator/{id}/releases", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET)); + fn get_creator_releases(&self, param_id: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/creator/{id}/releases?{hide}", + self.base_path, + id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -1072,11 +1090,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box + Send> { + fn lookup_creator(&self, param_orcid: String, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.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}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET)); + let url = format!( + "{}/v0/creator/lookup?{orcid}{hide}", + self.base_path, + orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -1886,15 +1910,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_file(&self, param_id: String, param_expand: Option, context: &Context) -> Box + Send> { + fn get_file(&self, param_id: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters 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/{id}?{expand}", + "{}/v0/file/{id}?{expand}{hide}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET) + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -2022,11 +2048,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn lookup_file(&self, param_sha1: String, context: &Context) -> Box + Send> { + fn lookup_file(&self, param_sha1: String, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.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?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET)); + let url = format!( + "{}/v0/file/lookup?{sha1}{hide}", + self.base_path, + sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -2442,15 +2474,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release(&self, param_id: String, param_expand: Option, context: &Context) -> Box + Send> { + fn get_release(&self, param_id: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters 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/{id}?{expand}", + "{}/v0/release/{id}?{expand}{hide}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET) + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -2510,8 +2544,16 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_files(&self, param_id: String, context: &Context) -> Box + Send> { - let url = format!("{}/v0/release/{id}/files", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET)); + fn get_release_files(&self, param_id: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/{id}/files?{hide}", + self.base_path, + id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -2638,11 +2680,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn lookup_release(&self, param_doi: String, context: &Context) -> Box + Send> { + fn lookup_release(&self, param_doi: String, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters let query_doi = format!("doi={doi}&", doi = param_doi.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}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET)); + let url = format!( + "{}/v0/release/lookup?{doi}{hide}", + self.base_path, + doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); @@ -2928,15 +2976,17 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_work(&self, param_id: String, param_expand: Option, context: &Context) -> Box + Send> { + fn get_work(&self, param_id: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters 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/work/{id}?{expand}", + "{}/v0/work/{id}?{expand}{hide}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET) + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -3064,8 +3114,16 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_work_releases(&self, param_id: String, context: &Context) -> Box + Send> { - let url = format!("{}/v0/work/{id}/releases", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET)); + fn get_work_releases(&self, param_id: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/work/{id}/releases?{hide}", + self.base_path, + id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Get, &url); diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index baf130a1..1650fbe6 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -576,11 +576,11 @@ pub trait Api { fn delete_container(&self, id: String, editgroup: Option, context: &Context) -> Box + Send>; - fn get_container(&self, id: String, expand: Option, context: &Context) -> Box + Send>; + fn get_container(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_container_history(&self, id: String, limit: Option, context: &Context) -> Box + Send>; - fn lookup_container(&self, issnl: String, context: &Context) -> Box + Send>; + fn lookup_container(&self, issnl: String, hide: Option, context: &Context) -> Box + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option, context: &Context) -> Box + Send>; @@ -596,13 +596,13 @@ pub trait Api { fn delete_creator(&self, id: String, editgroup: Option, context: &Context) -> Box + Send>; - fn get_creator(&self, id: String, expand: Option, context: &Context) -> Box + Send>; + fn get_creator(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_creator_history(&self, id: String, limit: Option, context: &Context) -> Box + Send>; - fn get_creator_releases(&self, id: String, context: &Context) -> Box + Send>; + fn get_creator_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send>; - fn lookup_creator(&self, orcid: String, context: &Context) -> Box + Send>; + fn lookup_creator(&self, orcid: String, hide: Option, context: &Context) -> Box + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option, context: &Context) -> Box + Send>; @@ -634,11 +634,11 @@ pub trait Api { fn delete_file(&self, id: String, editgroup: Option, context: &Context) -> Box + Send>; - fn get_file(&self, id: String, expand: Option, context: &Context) -> Box + Send>; + fn get_file(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_file_history(&self, id: String, limit: Option, context: &Context) -> Box + Send>; - fn lookup_file(&self, sha1: String, context: &Context) -> Box + Send>; + fn lookup_file(&self, sha1: String, hide: Option, context: &Context) -> Box + Send>; fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option, context: &Context) -> Box + Send>; @@ -656,13 +656,13 @@ pub trait Api { fn delete_release(&self, id: String, editgroup: Option, context: &Context) -> Box + Send>; - fn get_release(&self, id: String, expand: Option, context: &Context) -> Box + Send>; + fn get_release(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; - fn get_release_files(&self, id: String, context: &Context) -> Box + Send>; + fn get_release_files(&self, id: String, hide: Option, context: &Context) -> Box + Send>; fn get_release_history(&self, id: String, limit: Option, context: &Context) -> Box + Send>; - fn lookup_release(&self, doi: String, context: &Context) -> Box + Send>; + fn lookup_release(&self, doi: String, hide: Option, context: &Context) -> Box + Send>; fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option, context: &Context) -> Box + Send>; @@ -676,11 +676,11 @@ pub trait Api { fn delete_work(&self, id: String, editgroup: Option, context: &Context) -> Box + Send>; - fn get_work(&self, id: String, expand: Option, context: &Context) -> Box + Send>; + fn get_work(&self, id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_work_history(&self, id: String, limit: Option, context: &Context) -> Box + Send>; - fn get_work_releases(&self, id: String, context: &Context) -> Box + Send>; + fn get_work_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send>; fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option, context: &Context) -> Box + Send>; } @@ -698,11 +698,11 @@ pub trait ApiNoContext { fn delete_container(&self, id: String, editgroup: Option) -> Box + Send>; - fn get_container(&self, id: String, expand: Option) -> Box + Send>; + fn get_container(&self, id: String, expand: Option, hide: Option) -> Box + Send>; fn get_container_history(&self, id: String, limit: Option) -> Box + Send>; - fn lookup_container(&self, issnl: String) -> Box + Send>; + fn lookup_container(&self, issnl: String, hide: Option) -> Box + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option) -> Box + Send>; @@ -717,13 +717,13 @@ pub trait ApiNoContext { fn delete_creator(&self, id: String, editgroup: Option) -> Box + Send>; - fn get_creator(&self, id: String, expand: Option) -> Box + Send>; + fn get_creator(&self, id: String, expand: Option, hide: Option) -> Box + Send>; fn get_creator_history(&self, id: String, limit: Option) -> Box + Send>; - fn get_creator_releases(&self, id: String) -> Box + Send>; + fn get_creator_releases(&self, id: String, hide: Option) -> Box + Send>; - fn lookup_creator(&self, orcid: String) -> Box + Send>; + fn lookup_creator(&self, orcid: String, hide: Option) -> Box + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option) -> Box + Send>; @@ -749,11 +749,11 @@ pub trait ApiNoContext { fn delete_file(&self, id: String, editgroup: Option) -> Box + Send>; - fn get_file(&self, id: String, expand: Option) -> Box + Send>; + fn get_file(&self, id: String, expand: Option, hide: Option) -> Box + Send>; fn get_file_history(&self, id: String, limit: Option) -> Box + Send>; - fn lookup_file(&self, sha1: String) -> Box + Send>; + fn lookup_file(&self, sha1: String, hide: Option) -> Box + Send>; fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option) -> Box + Send>; @@ -770,13 +770,13 @@ pub trait ApiNoContext { fn delete_release(&self, id: String, editgroup: Option) -> Box + Send>; - fn get_release(&self, id: String, expand: Option) -> Box + Send>; + fn get_release(&self, id: String, expand: Option, hide: Option) -> Box + Send>; - fn get_release_files(&self, id: String) -> Box + Send>; + fn get_release_files(&self, id: String, hide: Option) -> Box + Send>; fn get_release_history(&self, id: String, limit: Option) -> Box + Send>; - fn lookup_release(&self, doi: String) -> Box + Send>; + fn lookup_release(&self, doi: String, hide: Option) -> Box + Send>; fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option) -> Box + Send>; @@ -784,11 +784,11 @@ pub trait ApiNoContext { fn delete_work(&self, id: String, editgroup: Option) -> Box + Send>; - fn get_work(&self, id: String, expand: Option) -> Box + Send>; + fn get_work(&self, id: String, expand: Option, hide: Option) -> Box + Send>; fn get_work_history(&self, id: String, limit: Option) -> Box + Send>; - fn get_work_releases(&self, id: String) -> Box + Send>; + fn get_work_releases(&self, id: String, hide: Option) -> Box + Send>; fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option) -> Box + Send>; } @@ -826,16 +826,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().delete_container(id, editgroup, &self.context()) } - fn get_container(&self, id: String, expand: Option) -> Box + Send> { - self.api().get_container(id, expand, &self.context()) + fn get_container(&self, id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_container(id, expand, hide, &self.context()) } fn get_container_history(&self, id: String, limit: Option) -> Box + Send> { self.api().get_container_history(id, limit, &self.context()) } - fn lookup_container(&self, issnl: String) -> Box + Send> { - self.api().lookup_container(issnl, &self.context()) + fn lookup_container(&self, issnl: String, hide: Option) -> Box + Send> { + self.api().lookup_container(issnl, hide, &self.context()) } fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option) -> Box + Send> { @@ -859,20 +859,20 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().delete_creator(id, editgroup, &self.context()) } - fn get_creator(&self, id: String, expand: Option) -> Box + Send> { - self.api().get_creator(id, expand, &self.context()) + fn get_creator(&self, id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_creator(id, expand, hide, &self.context()) } fn get_creator_history(&self, id: String, limit: Option) -> Box + Send> { self.api().get_creator_history(id, limit, &self.context()) } - fn get_creator_releases(&self, id: String) -> Box + Send> { - self.api().get_creator_releases(id, &self.context()) + fn get_creator_releases(&self, id: String, hide: Option) -> Box + Send> { + self.api().get_creator_releases(id, hide, &self.context()) } - fn lookup_creator(&self, orcid: String) -> Box + Send> { - self.api().lookup_creator(orcid, &self.context()) + fn lookup_creator(&self, orcid: String, hide: Option) -> Box + Send> { + self.api().lookup_creator(orcid, hide, &self.context()) } fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option) -> Box + Send> { @@ -923,16 +923,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().delete_file(id, editgroup, &self.context()) } - fn get_file(&self, id: String, expand: Option) -> Box + Send> { - self.api().get_file(id, expand, &self.context()) + fn get_file(&self, id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_file(id, expand, hide, &self.context()) } fn get_file_history(&self, id: String, limit: Option) -> Box + Send> { self.api().get_file_history(id, limit, &self.context()) } - fn lookup_file(&self, sha1: String) -> Box + Send> { - self.api().lookup_file(sha1, &self.context()) + fn lookup_file(&self, sha1: String, hide: Option) -> Box + Send> { + self.api().lookup_file(sha1, hide, &self.context()) } fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option) -> Box + Send> { @@ -960,20 +960,20 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().delete_release(id, editgroup, &self.context()) } - fn get_release(&self, id: String, expand: Option) -> Box + Send> { - self.api().get_release(id, expand, &self.context()) + fn get_release(&self, id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_release(id, expand, hide, &self.context()) } - fn get_release_files(&self, id: String) -> Box + Send> { - self.api().get_release_files(id, &self.context()) + fn get_release_files(&self, id: String, hide: Option) -> Box + Send> { + self.api().get_release_files(id, hide, &self.context()) } fn get_release_history(&self, id: String, limit: Option) -> Box + Send> { self.api().get_release_history(id, limit, &self.context()) } - fn lookup_release(&self, doi: String) -> Box + Send> { - self.api().lookup_release(doi, &self.context()) + fn lookup_release(&self, doi: String, hide: Option) -> Box + Send> { + self.api().lookup_release(doi, hide, &self.context()) } fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option) -> Box + Send> { @@ -988,16 +988,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().delete_work(id, editgroup, &self.context()) } - fn get_work(&self, id: String, expand: Option) -> Box + Send> { - self.api().get_work(id, expand, &self.context()) + fn get_work(&self, id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_work(id, expand, hide, &self.context()) } fn get_work_history(&self, id: String, limit: Option) -> Box + Send> { self.api().get_work_history(id, limit, &self.context()) } - fn get_work_releases(&self, id: String) -> Box + Send> { - self.api().get_work_releases(id, &self.context()) + fn get_work_releases(&self, id: String, hide: Option) -> Box + Send> { + self.api().get_work_releases(id, hide, &self.context()) } fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option) -> Box + Send> { diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index db8dcd7c..c4f491de 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -437,8 +437,9 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); 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.get_container(param_id, param_expand, context).wait() { + match api.get_container(param_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { GetContainerResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -614,8 +615,9 @@ where .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter issnl was empty".to_string())))? .parse::() .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter issnl - doesn't match schema: {}", e))))?; + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.lookup_container(param_issnl, context).wait() { + match api.lookup_container(param_issnl, 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"); @@ -1146,8 +1148,9 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); 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.get_creator(param_id, param_expand, context).wait() { + match api.get_creator(param_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { GetCreatorResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1329,7 +1332,11 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))? }; - match api.get_creator_releases(param_id, context).wait() { + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_creator_releases(param_id, param_hide, context).wait() { Ok(rsp) => match rsp { GetCreatorReleasesResponse::Found(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1412,8 +1419,9 @@ where .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter orcid was empty".to_string())))? .parse::() .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter orcid - doesn't match schema: {}", e))))?; + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.lookup_creator(param_orcid, context).wait() { + match api.lookup_creator(param_orcid, 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"); @@ -2599,8 +2607,9 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); 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.get_file(param_id, param_expand, context).wait() { + match api.get_file(param_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { GetFileResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2776,8 +2785,9 @@ where .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter sha1 was empty".to_string())))? .parse::() .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter sha1 - doesn't match schema: {}", e))))?; + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.lookup_file(param_sha1, context).wait() { + match api.lookup_file(param_sha1, 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"); @@ -3418,8 +3428,9 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); 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.get_release(param_id, param_expand, context).wait() { + match api.get_release(param_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { GetReleaseResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3508,7 +3519,11 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))? }; - match api.get_release_files(param_id, context).wait() { + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_files(param_id, param_hide, context).wait() { Ok(rsp) => match rsp { GetReleaseFilesResponse::Found(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -3684,8 +3699,9 @@ where .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))? .parse::() .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?; + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.lookup_release(param_doi, context).wait() { + match api.lookup_release(param_doi, 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"); @@ -4106,8 +4122,9 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); 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.get_work(param_id, param_expand, context).wait() { + match api.get_work(param_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { GetWorkResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4289,7 +4306,11 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))? }; - match api.get_work_releases(param_id, context).wait() { + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_work_releases(param_id, param_hide, context).wait() { Ok(rsp) => match rsp { GetWorkReleasesResponse::Found(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); -- cgit v1.2.3