diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/fatcat-api-spec/README.md | 2 | ||||
| -rw-r--r-- | rust/fatcat-api-spec/api.yaml | 60 | ||||
| -rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 96 | ||||
| -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, 422 insertions, 126 deletions
| 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("<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"); | 
