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 --- python/fatcat_client/api/default_api.py | 72 ++++++++++--- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 60 +++++++++++ rust/fatcat-api-spec/api/swagger.yaml | 96 +++++++++++++++++ rust/fatcat-api-spec/examples/client.rs | 30 +++--- rust/fatcat-api-spec/examples/server_lib/server.rs | 103 +++++++++++++----- rust/fatcat-api-spec/src/client.rs | 116 +++++++++++++++------ rust/fatcat-api-spec/src/lib.rs | 96 ++++++++--------- rust/fatcat-api-spec/src/server.rs | 45 +++++--- 9 files changed, 482 insertions(+), 138 deletions(-) diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index d3ce3cee..f1b8502e 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -1971,6 +1971,7 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For containers, none accepted (yet). + :param str hide: List of entity fields to elide in response. For containers, none accepted (yet). :return: ContainerEntity If the method is called asynchronously, returns the request thread. @@ -1993,12 +1994,13 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For containers, none accepted (yet). + :param str hide: List of entity fields to elide in response. For containers, none accepted (yet). :return: ContainerEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'expand', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2027,6 +2029,8 @@ class DefaultApi(object): query_params = [] if 'expand' in params: query_params.append(('expand', params['expand'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -2173,6 +2177,7 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For creators, none accepted (yet). + :param str hide: List of entity fields to elide in response. For containers, none accepted (yet). :return: CreatorEntity If the method is called asynchronously, returns the request thread. @@ -2195,12 +2200,13 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For creators, none accepted (yet). + :param str hide: List of entity fields to elide in response. For containers, none accepted (yet). :return: CreatorEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'expand', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2229,6 +2235,8 @@ class DefaultApi(object): query_params = [] if 'expand' in params: query_params.append(('expand', params['expand'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -2374,6 +2382,7 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. @@ -2395,12 +2404,13 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2427,6 +2437,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -2771,6 +2783,7 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For files, none accepted (yet). + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, returns the request thread. @@ -2793,12 +2806,13 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For files, none accepted (yet). + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'expand', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2827,6 +2841,8 @@ class DefaultApi(object): query_params = [] if 'expand' in params: query_params.append(('expand', params['expand'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -2973,6 +2989,7 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For releases, 'files' and 'container' are valid. + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: ReleaseEntity If the method is called asynchronously, returns the request thread. @@ -2995,12 +3012,13 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For releases, 'files' and 'container' are valid. + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'expand', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3029,6 +3047,8 @@ class DefaultApi(object): query_params = [] if 'expand' in params: query_params.append(('expand', params['expand'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3073,6 +3093,7 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: list[FileEntity] If the method is called asynchronously, returns the request thread. @@ -3094,12 +3115,13 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: list[FileEntity] If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3126,6 +3148,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3365,6 +3389,7 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For works, none accepted (yet). + :param str hide: List of entity fields to elide in response. For works, none accepted (yet). :return: WorkEntity If the method is called asynchronously, returns the request thread. @@ -3387,12 +3412,13 @@ class DefaultApi(object): :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For works, none accepted (yet). + :param str hide: List of entity fields to elide in response. For works, none accepted (yet). :return: WorkEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'expand', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3421,6 +3447,8 @@ class DefaultApi(object): query_params = [] if 'expand' in params: query_params.append(('expand', params['expand'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3566,6 +3594,7 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. @@ -3587,12 +3616,13 @@ class DefaultApi(object): :param async bool :param str id: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3619,6 +3649,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3663,6 +3695,7 @@ class DefaultApi(object): :param async bool :param str issnl: (required) + :param str hide: List of entity fields to elide in response. For container, none accepted (yet). :return: ContainerEntity If the method is called asynchronously, returns the request thread. @@ -3684,12 +3717,13 @@ class DefaultApi(object): :param async bool :param str issnl: (required) + :param str hide: List of entity fields to elide in response. For container, none accepted (yet). :return: ContainerEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['issnl'] # noqa: E501 + all_params = ['issnl', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3724,6 +3758,8 @@ class DefaultApi(object): query_params = [] if 'issnl' in params: query_params.append(('issnl', params['issnl'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3768,6 +3804,7 @@ class DefaultApi(object): :param async bool :param str orcid: (required) + :param str hide: List of entity fields to elide in response. For creator, none accepted (yet). :return: CreatorEntity If the method is called asynchronously, returns the request thread. @@ -3789,12 +3826,13 @@ class DefaultApi(object): :param async bool :param str orcid: (required) + :param str hide: List of entity fields to elide in response. For creator, none accepted (yet). :return: CreatorEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['orcid'] # noqa: E501 + all_params = ['orcid', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3829,6 +3867,8 @@ class DefaultApi(object): query_params = [] if 'orcid' in params: query_params.append(('orcid', params['orcid'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3873,6 +3913,7 @@ class DefaultApi(object): :param async bool :param str sha1: (required) + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, returns the request thread. @@ -3894,12 +3935,13 @@ class DefaultApi(object): :param async bool :param str sha1: (required) + :param str hide: List of entity fields to elide in response. For files, none accepted (yet). :return: FileEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['sha1'] # noqa: E501 + all_params = ['sha1', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3926,6 +3968,8 @@ class DefaultApi(object): query_params = [] if 'sha1' in params: query_params.append(('sha1', params['sha1'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} @@ -3970,6 +4014,7 @@ class DefaultApi(object): :param async bool :param str doi: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: ReleaseEntity If the method is called asynchronously, returns the request thread. @@ -3991,12 +4036,13 @@ class DefaultApi(object): :param async bool :param str doi: (required) + :param str hide: List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid. :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['doi'] # noqa: E501 + all_params = ['doi', 'hide'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -4023,6 +4069,8 @@ class DefaultApi(object): query_params = [] if 'doi' in params: query_params.append(('doi', params['doi'])) # noqa: E501 + if 'hide' in params: + query_params.append(('hide', params['hide'])) # noqa: E501 header_params = {} diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index db4730fa..0be0b94c 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-11-13T20:46:32.121Z +- Build date: 2018-11-27T07:17:13.513Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index feaa87cd..d998b63b 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -502,6 +502,11 @@ paths: type: string required: false description: "List of sub-entities to expand in response. For containers, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For containers, none accepted (yet)." responses: 200: description: Found Entity @@ -576,6 +581,11 @@ paths: in: query required: true <<: *FATCATISSN + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For container, none accepted (yet)." responses: 200: description: Found Entity @@ -650,6 +660,11 @@ paths: type: string required: false description: "List of sub-entities to expand in response. For creators, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For containers, none accepted (yet)." responses: 200: description: Found Entity @@ -720,6 +735,11 @@ paths: in: path type: string required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." get: operationId: "get_creator_releases" tags: # TAGLINE @@ -742,6 +762,11 @@ paths: in: query required: true <<: *FATCATORCID + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For creator, none accepted (yet)." responses: 200: description: Found Entity @@ -816,6 +841,11 @@ paths: type: string required: false description: "List of sub-entities to expand in response. For files, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For files, none accepted (yet)." responses: 200: description: Found Entity @@ -890,6 +920,11 @@ paths: in: query type: string required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For files, none accepted (yet)." responses: 200: description: Found Entity @@ -964,6 +999,11 @@ paths: type: string required: false description: "List of sub-entities to expand in response. For releases, 'files' and 'container' are valid." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." responses: 200: description: Found Entity @@ -1034,6 +1074,11 @@ paths: in: path type: string required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For files, none accepted (yet)." get: operationId: "get_release_files" tags: # TAGLINE @@ -1056,6 +1101,11 @@ paths: in: query type: string required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." responses: 200: description: Found Entity @@ -1130,6 +1180,11 @@ paths: type: string required: false description: "List of sub-entities to expand in response. For works, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For works, none accepted (yet)." responses: 200: description: Found Entity @@ -1200,6 +1255,11 @@ paths: in: path type: string required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." get: operationId: "get_work_releases" tags: # TAGLINE diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index ded102e6..51f0630e 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -186,6 +186,14 @@ paths: type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For containers,\ + \ none accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -437,6 +445,14 @@ paths: pattern: "\\d{4}-\\d{3}[0-9X]" formatString: "\\\"{}\\\"" example: "\"issnl_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For container, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -644,6 +660,14 @@ paths: type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For containers,\ + \ none accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -892,6 +916,14 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"id_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, 'abstracts',\ + \ 'refs', and 'contribs' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found" @@ -951,6 +983,14 @@ paths: pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" formatString: "\\\"{}\\\"" example: "\"orcid_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For creator, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -1158,6 +1198,14 @@ paths: type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For files, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -1406,6 +1454,14 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"sha1_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For files, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -1613,6 +1669,14 @@ paths: type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, 'abstracts',\ + \ 'refs', and 'contribs' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -1861,6 +1925,14 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"id_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For files, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found" @@ -1917,6 +1989,14 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"doi_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, 'abstracts',\ + \ 'refs', and 'contribs' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -2124,6 +2204,14 @@ paths: type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For works, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found Entity" @@ -2372,6 +2460,14 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"id_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, 'abstracts',\ + \ 'refs', and 'contribs' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" responses: 200: description: "Found" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index cb025d5c..1273d892 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -104,7 +104,9 @@ fn main() { } Some("GetContainer") => { - let result = client.get_container("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_container("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -114,7 +116,7 @@ fn main() { } Some("LookupContainer") => { - let result = client.lookup_container("issnl_example".to_string()).wait(); + let result = client.lookup_container("issnl_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -140,7 +142,9 @@ fn main() { } Some("GetCreator") => { - let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_creator("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -150,12 +154,12 @@ fn main() { } Some("GetCreatorReleases") => { - let result = client.get_creator_releases("id_example".to_string()).wait(); + let result = client.get_creator_releases("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } Some("LookupCreator") => { - let result = client.lookup_creator("orcid_example".to_string()).wait(); + let result = client.lookup_creator("orcid_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -220,7 +224,7 @@ fn main() { } Some("GetFile") => { - let result = client.get_file("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client.get_file("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -230,7 +234,7 @@ fn main() { } Some("LookupFile") => { - let result = client.lookup_file("sha1_example".to_string()).wait(); + let result = client.lookup_file("sha1_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -261,12 +265,14 @@ fn main() { } Some("GetRelease") => { - let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client + .get_release("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } Some("GetReleaseFiles") => { - let result = client.get_release_files("id_example".to_string()).wait(); + let result = client.get_release_files("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -276,7 +282,7 @@ fn main() { } Some("LookupRelease") => { - let result = client.lookup_release("doi_example".to_string()).wait(); + let result = client.lookup_release("doi_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -296,7 +302,7 @@ fn main() { } Some("GetWork") => { - let result = client.get_work("id_example".to_string(), Some("expand_example".to_string())).wait(); + let result = client.get_work("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } @@ -306,7 +312,7 @@ fn main() { } Some("GetWorkReleases") => { - let result = client.get_work_releases("id_example".to_string()).wait(); + let result = client.get_work_releases("id_example".to_string(), Some("hide_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index dc669490..b11f26c3 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -63,9 +63,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - 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> { let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -80,9 +86,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_container(&self, issnl: String, context: &Context) -> Box + Send> { + fn lookup_container(&self, issnl: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}", + issnl, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -138,9 +149,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - 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> { let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -155,15 +172,25 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_creator_releases(&self, id: String, context: &Context) -> Box + Send> { + fn get_creator_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_creator_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn lookup_creator(&self, orcid: String, context: &Context) -> Box + Send> { + fn lookup_creator(&self, orcid: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + orcid, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -267,9 +294,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - 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> { let context = context.clone(); - println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -284,9 +317,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_file(&self, sha1: String, context: &Context) -> Box + Send> { + fn lookup_file(&self, sha1: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -353,15 +386,26 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - 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> { let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_release_files(&self, id: String, context: &Context) -> Box + Send> { + fn get_release_files(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_release_files(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -376,9 +420,9 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn lookup_release(&self, doi: String, context: &Context) -> Box + Send> { + fn lookup_release(&self, doi: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("")).clone()); + println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("")).clone()); Box::new(futures::failed("Generic failure".into())) } @@ -423,9 +467,15 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - 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> { let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } @@ -440,9 +490,14 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn get_work_releases(&self, id: String, context: &Context) -> Box + Send> { + fn get_work_releases(&self, id: String, hide: Option, context: &Context) -> Box + Send> { let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); + println!( + "get_work_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); Box::new(futures::failed("Generic failure".into())) } 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