diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-26 23:47:58 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-26 23:47:58 -0800 |
commit | e82f0cf5c4f27c099a8c52eeaec015fb78b7dde3 (patch) | |
tree | 410e0a97a445587adfb21a1387778ad68f802976 /rust/fatcat-api-spec | |
parent | 00480a0eef176c4732ac627e5e905ef00bbfcc17 (diff) | |
download | fatcat-e82f0cf5c4f27c099a8c52eeaec015fb78b7dde3.tar.gz fatcat-e82f0cf5c4f27c099a8c52eeaec015fb78b7dde3.zip |
codegen
Diffstat (limited to 'rust/fatcat-api-spec')
-rw-r--r-- | rust/fatcat-api-spec/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api.yaml | 264 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 116 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/client.rs | 30 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/server_lib/server.rs | 103 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 116 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 96 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 45 |
8 files changed, 534 insertions, 238 deletions
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 7f98de30..1599deb7 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-09-23T00:19:26.675Z +- Build date: 2018-11-27T07:47:25.619Z 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 f8d16f5b..57b0ba17 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -14,19 +14,19 @@ consumes: produces: - application/json -tags: - - name: containers - descriptions: "Container entities: such as journals, conferences, book series" - - name: creators - descriptions: "Creator entities: such as authors" - - name: files - descriptions: "File entities" - - name: releases - descriptions: "Release entities: individual articles, pre-prints, books" - - name: works - descriptions: "Work entities: grouping releases which are variants of the same work" - - name: edit-lifecycle - descriptions: "Endpoints relating to global edit submission and history" +tags: # TAGLINE + - name: containers # TAGLINE + descriptions: "Container entities: such as journals, conferences, book series" # TAGLINE + - name: creators # TAGLINE + descriptions: "Creator entities: such as authors" # TAGLINE + - name: files # TAGLINE + descriptions: "File entities" # TAGLINE + - name: releases # TAGLINE + descriptions: "Release entities: individual articles, pre-prints, books" # TAGLINE + - name: works # TAGLINE + descriptions: "Work entities: grouping releases which are variants of the same work" # TAGLINE + - name: edit-lifecycle # TAGLINE + descriptions: "Endpoints relating to global edit submission and history" # TAGLINE # don't want these to be rust types (at least for now) x-fatcat-ident: &FATCATIDENT @@ -438,8 +438,8 @@ paths: /container: post: operationId: "create_container" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: entity in: body @@ -459,8 +459,8 @@ paths: /container/batch: post: operationId: "create_container_batch" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: autoaccept in: query @@ -495,14 +495,19 @@ paths: required: true get: operationId: "get_container" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: expand in: query type: string required: false - description: "List of sub-entities to expand in response. For now, only 'all' accepted." + 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 @@ -511,8 +516,8 @@ paths: <<: *ENTITYRESPONSES put: operationId: "update_container" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: entity in: body @@ -531,8 +536,8 @@ paths: <<: *ENTITYRESPONSES delete: operationId: "delete_container" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: editgroup in: query @@ -556,8 +561,8 @@ paths: format: int64 required: false get: - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE operationId: "get_container_history" responses: 200: @@ -570,13 +575,18 @@ paths: /container/lookup: get: operationId: "lookup_container" - tags: - - containers + tags: # TAGLINE + - containers # TAGLINE parameters: - name: issnl 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 @@ -586,8 +596,8 @@ paths: /creator: post: operationId: "create_creator" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: entity in: body @@ -607,8 +617,8 @@ paths: /creator/batch: post: operationId: "create_creator_batch" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: autoaccept in: query @@ -643,14 +653,19 @@ paths: required: true get: operationId: "get_creator" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: expand in: query type: string required: false - description: "List of sub-entities to expand in response. For now, only 'all' accepted." + 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 @@ -659,8 +674,8 @@ paths: <<: *ENTITYRESPONSES put: operationId: "update_creator" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: entity in: body @@ -679,8 +694,8 @@ paths: <<: *ENTITYRESPONSES delete: operationId: "delete_creator" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: editgroup in: query @@ -705,8 +720,8 @@ paths: required: false get: operationId: "get_creator_history" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE responses: 200: description: Found Entity History @@ -721,10 +736,15 @@ 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: - - creators + tags: # TAGLINE + - creators # TAGLINE responses: 200: description: Found @@ -736,13 +756,18 @@ paths: /creator/lookup: get: operationId: "lookup_creator" - tags: - - creators + tags: # TAGLINE + - creators # TAGLINE parameters: - name: orcid 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 @@ -752,8 +777,8 @@ paths: /file: post: operationId: "create_file" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: entity in: body @@ -773,8 +798,8 @@ paths: /file/batch: post: operationId: "create_file_batch" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: autoaccept in: query @@ -809,14 +834,19 @@ paths: required: true get: operationId: "get_file" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: expand in: query type: string required: false - description: "List of sub-entities to expand in response. For now, only 'all' accepted." + 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 @@ -825,8 +855,8 @@ paths: <<: *ENTITYRESPONSES put: operationId: "update_file" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: entity in: body @@ -845,8 +875,8 @@ paths: <<: *ENTITYRESPONSES delete: operationId: "delete_file" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: editgroup in: query @@ -871,8 +901,8 @@ paths: required: false get: operationId: "get_file_history" - tags: - - files + tags: # TAGLINE + - files # TAGLINE responses: 200: description: Found Entity History @@ -884,13 +914,18 @@ paths: /file/lookup: get: operationId: "lookup_file" - tags: - - files + tags: # TAGLINE + - files # TAGLINE parameters: - name: sha1 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 @@ -900,8 +935,8 @@ paths: /release: post: operationId: "create_release" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: entity in: body @@ -921,8 +956,8 @@ paths: /release/batch: post: operationId: "create_release_batch" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: autoaccept in: query @@ -957,14 +992,19 @@ paths: required: true get: operationId: "get_release" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: expand in: query type: string required: false - description: "List of sub-entities to expand in response. For now, only 'all' accepted." + 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 @@ -973,8 +1013,8 @@ paths: <<: *ENTITYRESPONSES put: operationId: "update_release" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: entity in: body @@ -993,8 +1033,8 @@ paths: <<: *ENTITYRESPONSES delete: operationId: "delete_release" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: editgroup in: query @@ -1019,8 +1059,8 @@ paths: required: false get: operationId: "get_release_history" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE responses: 200: description: Found Entity History @@ -1035,10 +1075,15 @@ 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: - - releases + tags: # TAGLINE + - releases # TAGLINE responses: 200: description: Found @@ -1050,13 +1095,18 @@ paths: /release/lookup: get: operationId: "lookup_release" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: doi 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 @@ -1066,8 +1116,8 @@ paths: /work: post: operationId: "create_work" - tags: - - releases + tags: # TAGLINE + - releases # TAGLINE parameters: - name: entity in: body @@ -1087,8 +1137,8 @@ paths: /work/batch: post: operationId: "create_work_batch" - tags: - - works + tags: # TAGLINE + - works # TAGLINE parameters: - name: autoaccept in: query @@ -1123,14 +1173,19 @@ paths: required: true get: operationId: "get_work" - tags: - - works + tags: # TAGLINE + - works # TAGLINE parameters: - name: expand in: query type: string required: false - description: "List of sub-entities to expand in response. For now, only 'all' accepted." + 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 @@ -1139,8 +1194,8 @@ paths: <<: *ENTITYRESPONSES put: operationId: "update_work" - tags: - - works + tags: # TAGLINE + - works # TAGLINE parameters: - name: entity in: body @@ -1159,8 +1214,8 @@ paths: <<: *ENTITYRESPONSES delete: operationId: "delete_work" - tags: - - works + tags: # TAGLINE + - works # TAGLINE parameters: - name: editgroup in: query @@ -1185,8 +1240,8 @@ paths: required: false get: operationId: "get_work_history" - tags: - - works + tags: # TAGLINE + - works # TAGLINE responses: 200: description: Found Entity History @@ -1201,10 +1256,15 @@ 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: - - works + tags: # TAGLINE + - works # TAGLINE responses: 200: description: Found @@ -1268,8 +1328,8 @@ paths: /editgroup: post: operationId: "create_editgroup" - tags: - - edit-lifecycle + tags: # TAGLINE + - edit-lifecycle # TAGLINE parameters: - name: editgroup in: body @@ -1297,8 +1357,8 @@ paths: <<: *FATCATIDENT get: operationId: "get_editgroup" - tags: - - edit-lifecycle + tags: # TAGLINE + - edit-lifecycle # TAGLINE responses: 200: description: Found @@ -1324,8 +1384,8 @@ paths: <<: *FATCATIDENT post: operationId: "accept_editgroup" - tags: - - edit-lifecycle + tags: # TAGLINE + - edit-lifecycle # TAGLINE responses: 200: description: Merged Successfully @@ -1356,8 +1416,8 @@ paths: required: false get: operationId: "get_changelog" - tags: - - edit-lifecycle + tags: # TAGLINE + - edit-lifecycle # TAGLINE responses: 200: description: Success @@ -1378,8 +1438,8 @@ paths: required: true get: operationId: "get_changelog_entry" - tags: - - edit-lifecycle + tags: # TAGLINE + - edit-lifecycle # TAGLINE responses: 200: description: Found Changelog Entry diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index f0f4cf05..797df063 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -179,12 +179,20 @@ paths: example: "\"id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For now, only 'all'\ - \ accepted." + description: "List of sub-entities to expand in response. For containers,\ + \ none accepted (yet)." required: false 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" @@ -436,6 +444,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" @@ -637,12 +653,20 @@ paths: example: "\"id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For now, only 'all'\ - \ accepted." + description: "List of sub-entities to expand in response. For creators, none\ + \ accepted (yet)." required: false 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" @@ -891,6 +915,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" @@ -950,6 +982,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" @@ -1151,12 +1191,20 @@ paths: example: "\"id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For now, only 'all'\ - \ accepted." + description: "List of sub-entities to expand in response. For files, none\ + \ accepted (yet)." required: false 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" @@ -1405,6 +1453,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" @@ -1606,12 +1662,20 @@ paths: example: "\"id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For now, only 'all'\ - \ accepted." + description: "List of sub-entities to expand in response. For releases, 'files'\ + \ and 'container' are valid." required: false 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" @@ -1860,6 +1924,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" @@ -1916,6 +1988,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" @@ -2117,12 +2197,20 @@ paths: example: "\"id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For now, only 'all'\ - \ accepted." + description: "List of sub-entities to expand in response. For works, none\ + \ accepted (yet)." required: false 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" @@ -2371,6 +2459,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 43f002fc..5a684a7e 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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } 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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } 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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } @@ -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("<none>"))); } 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<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { + fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + fn lookup_container(&self, issnl: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}", + issnl, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { + fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { + fn get_creator_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_creator_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + fn lookup_creator(&self, orcid: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + orcid, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { + fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<Future<Item = LookupFileResponse, Error = ApiError> + Send> { + fn lookup_file(&self, sha1: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("<none>")).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<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { + fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); Box::new(futures::failed("Generic failure".into())) } - fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { + fn get_release_files(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_release_files(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { + fn lookup_release(&self, doi: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("<none>")).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<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { + fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + fn get_work_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + println!( + "get_work_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + id, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).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<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { + fn get_container(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + 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<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + fn lookup_container(&self, param_issnl: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { + fn get_creator(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + 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<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + 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<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + fn lookup_creator(&self, param_orcid: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { + fn get_file(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + 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<Future<Item = LookupFileResponse, Error = ApiError> + Send> { + fn lookup_file(&self, param_sha1: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { + fn get_release(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + 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<Future<Item = GetReleaseFilesResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + 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<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { + fn lookup_release(&self, param_doi: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { + fn get_work(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + 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<Future<Item = GetWorkReleasesResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; - fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>; + fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>; fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>; - fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; + fn lookup_container(&self, issnl: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; @@ -596,13 +596,13 @@ pub trait Api { fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; - fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; + fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>; - fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; + fn get_creator_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; - fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; + fn lookup_creator(&self, orcid: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; @@ -634,11 +634,11 @@ pub trait Api { fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; - fn get_file(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>; + fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>; fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>; - fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; + fn lookup_file(&self, sha1: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; @@ -656,13 +656,13 @@ pub trait Api { fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; - fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; + fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; - fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_release_files(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>; - fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; + fn lookup_release(&self, doi: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; @@ -676,11 +676,11 @@ pub trait Api { fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; - fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; + fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>; - fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; + fn get_work_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; } @@ -698,11 +698,11 @@ pub trait ApiNoContext { fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; - fn get_container(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>; + fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>; fn get_container_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>; - fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; + fn lookup_container(&self, issnl: String, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; @@ -717,13 +717,13 @@ pub trait ApiNoContext { fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; - fn get_creator(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; + fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>; - fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; + fn get_creator_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; - fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; + fn lookup_creator(&self, orcid: String, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; @@ -749,11 +749,11 @@ pub trait ApiNoContext { fn delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; - fn get_file(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>; + fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>; fn get_file_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>; - fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; + fn lookup_file(&self, sha1: String, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; @@ -770,13 +770,13 @@ pub trait ApiNoContext { fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; - fn get_release(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; + fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; - fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_release_files(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>; - fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; + fn lookup_release(&self, doi: String, hide: Option<String>) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; @@ -784,11 +784,11 @@ pub trait ApiNoContext { fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; - fn get_work(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; + fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>; - fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; + fn get_work_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { - self.api().get_container(id, expand, &self.context()) + fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { + self.api().get_container(id, expand, hide, &self.context()) } fn get_container_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { self.api().get_container_history(id, limit, &self.context()) } - fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { - self.api().lookup_container(issnl, &self.context()) + fn lookup_container(&self, issnl: String, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + self.api().lookup_container(issnl, hide, &self.context()) } fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { - self.api().get_creator(id, expand, &self.context()) + fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { + self.api().get_creator(id, expand, hide, &self.context()) } fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { self.api().get_creator_history(id, limit, &self.context()) } - fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { - self.api().get_creator_releases(id, &self.context()) + fn get_creator_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { + self.api().get_creator_releases(id, hide, &self.context()) } - fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { - self.api().lookup_creator(orcid, &self.context()) + fn lookup_creator(&self, orcid: String, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + self.api().lookup_creator(orcid, hide, &self.context()) } fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { - self.api().get_file(id, expand, &self.context()) + fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { + self.api().get_file(id, expand, hide, &self.context()) } fn get_file_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> { self.api().get_file_history(id, limit, &self.context()) } - fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { - self.api().lookup_file(sha1, &self.context()) + fn lookup_file(&self, sha1: String, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { + self.api().lookup_file(sha1, hide, &self.context()) } fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { - self.api().get_release(id, expand, &self.context()) + fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { + self.api().get_release(id, expand, hide, &self.context()) } - fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { - self.api().get_release_files(id, &self.context()) + fn get_release_files(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { + self.api().get_release_files(id, hide, &self.context()) } fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { self.api().get_release_history(id, limit, &self.context()) } - fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { - self.api().lookup_release(doi, &self.context()) + fn lookup_release(&self, doi: String, hide: Option<String>) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { + self.api().lookup_release(doi, hide, &self.context()) } fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { - self.api().get_work(id, expand, &self.context()) + fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { + self.api().get_work(id, expand, hide, &self.context()) } fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { self.api().get_work_history(id, limit, &self.context()) } - fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { - self.api().get_work_releases(id, &self.context()) + fn get_work_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + self.api().get_work_releases(id, hide, &self.context()) } fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + 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::<UrlEncodedQuery>().unwrap_or_default(); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); - match api.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::<String>() .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::<String>().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::<UrlEncodedQuery>().unwrap_or_default(); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); - match api.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::<UrlEncodedQuery>().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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::<String>() .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::<String>().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::<UrlEncodedQuery>().unwrap_or_default(); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); - match api.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::<String>() .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::<String>().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::<UrlEncodedQuery>().unwrap_or_default(); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); - match api.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::<UrlEncodedQuery>().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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::<String>() .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::<String>().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::<UrlEncodedQuery>().unwrap_or_default(); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); - match api.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::<UrlEncodedQuery>().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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"); |