diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-09 13:18:38 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-09 13:18:38 -0800 |
commit | 17fe81ea8d58f93f129492dc44a38df9ab8d528e (patch) | |
tree | 3d4cb71fb5d2b1c3d15c6cfcf348f09a51b13543 | |
parent | 0624fce632da17b3f98f0d4ff98a736f05fa287b (diff) | |
download | fatcat-17fe81ea8d58f93f129492dc44a38df9ab8d528e.tar.gz fatcat-17fe81ea8d58f93f129492dc44a38df9ab8d528e.zip |
rust impl required editgroup_id
-rw-r--r-- | rust/fatcat-api-spec/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api.yaml | 42 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 126 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/client.rs | 42 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/server_lib/server.rs | 96 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 101 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 133 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 168 | ||||
-rw-r--r-- | rust/src/endpoints.rs | 36 | ||||
-rw-r--r-- | rust/tests/test_api_server_http.rs | 60 | ||||
-rw-r--r-- | rust/tests/test_old_python_tests.rs | 22 |
11 files changed, 471 insertions, 357 deletions
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index f8a6e817..3dcee270 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: 2019-01-08T01:49:55.777Z +- Build date: 2019-01-09T21:14:27.679Z 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 625a0143..38f06948 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -619,7 +619,7 @@ paths: $ref: "#/definitions/container_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -703,7 +703,7 @@ paths: $ref: "#/definitions/container_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -721,7 +721,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -877,7 +877,7 @@ paths: $ref: "#/definitions/creator_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -961,7 +961,7 @@ paths: $ref: "#/definitions/creator_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -979,7 +979,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1158,7 +1158,7 @@ paths: $ref: "#/definitions/file_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1242,7 +1242,7 @@ paths: $ref: "#/definitions/file_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1260,7 +1260,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1421,7 +1421,7 @@ paths: $ref: "#/definitions/fileset_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1505,7 +1505,7 @@ paths: $ref: "#/definitions/fileset_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1523,7 +1523,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1650,7 +1650,7 @@ paths: $ref: "#/definitions/webcapture_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1734,7 +1734,7 @@ paths: $ref: "#/definitions/webcapture_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1752,7 +1752,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1879,7 +1879,7 @@ paths: $ref: "#/definitions/release_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1963,7 +1963,7 @@ paths: $ref: "#/definitions/release_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -1981,7 +1981,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -2223,7 +2223,7 @@ paths: $ref: "#/definitions/work_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -2307,7 +2307,7 @@ paths: $ref: "#/definitions/work_entity" - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] @@ -2325,7 +2325,7 @@ paths: parameters: - name: editgroup_id in: query - required: false + required: true type: string security: - Bearer: [] diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 9d4767c0..7ee33725 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -41,10 +41,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -307,10 +307,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -390,10 +390,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -887,10 +887,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -1153,10 +1153,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -1236,10 +1236,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -1797,10 +1797,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -2063,10 +2063,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -2146,10 +2146,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -2656,10 +2656,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -2922,10 +2922,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -3005,10 +3005,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -3425,10 +3425,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -3691,10 +3691,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -3774,10 +3774,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -4194,10 +4194,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -4460,10 +4460,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -4543,10 +4543,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" @@ -5254,10 +5254,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 201: description: "Created Entity" @@ -5520,10 +5520,10 @@ paths: consumesJson: true - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Updated Entity" @@ -5603,10 +5603,10 @@ paths: example: "\"ident_example\".to_string()" - name: "editgroup_id" in: "query" - required: false + required: true type: "string" - formatString: "{:?}" - example: "Some(\"editgroup_id_example\".to_string())" + formatString: "\\\"{}\\\"" + example: "\"editgroup_id_example\".to_string()" responses: 200: description: "Deleted Entity" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index 5a43a33c..f5f336b0 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -137,7 +137,7 @@ fn main() { match matches.value_of("operation") { // Disabled because there's no example. // Some("CreateContainer") => { - // let result = client.create_container(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_container(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateContainerBatch") => { @@ -146,7 +146,7 @@ fn main() { } Some("DeleteContainer") => { - let result = client.delete_container("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_container("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -198,13 +198,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateContainer") => { - // let result = client.update_container("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_container("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, // Disabled because there's no example. // Some("CreateCreator") => { - // let result = client.create_creator(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_creator(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateCreatorBatch") => { @@ -213,7 +213,7 @@ fn main() { } Some("DeleteCreator") => { - let result = client.delete_creator("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_creator("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -270,7 +270,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateCreator") => { - // let result = client.update_creator("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_creator("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("AuthCheck") => { @@ -325,7 +325,7 @@ fn main() { // Disabled because there's no example. // Some("CreateFile") => { - // let result = client.create_file(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_file(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateFileBatch") => { @@ -334,7 +334,7 @@ fn main() { } Some("DeleteFile") => { - let result = client.delete_file("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_file("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -387,13 +387,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateFile") => { - // let result = client.update_file("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_file("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, // Disabled because there's no example. // Some("CreateFileset") => { - // let result = client.create_fileset(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_fileset(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateFilesetBatch") => { @@ -402,7 +402,7 @@ fn main() { } Some("DeleteFileset") => { - let result = client.delete_fileset("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_fileset("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -442,13 +442,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateFileset") => { - // let result = client.update_fileset("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_fileset("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, // Disabled because there's no example. // Some("CreateRelease") => { - // let result = client.create_release(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_release(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateReleaseBatch") => { @@ -458,11 +458,11 @@ fn main() { // Disabled because there's no example. // Some("CreateWork") => { - // let result = client.create_work(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_work(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("DeleteRelease") => { - let result = client.delete_release("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_release("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -533,13 +533,13 @@ fn main() { // Disabled because there's no example. // Some("UpdateRelease") => { - // let result = client.update_release("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_release("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, // Disabled because there's no example. // Some("CreateWebcapture") => { - // let result = client.create_webcapture(???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.create_webcapture(???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateWebcaptureBatch") => { @@ -548,7 +548,7 @@ fn main() { } Some("DeleteWebcapture") => { - let result = client.delete_webcapture("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_webcapture("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -588,7 +588,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateWebcapture") => { - // let result = client.update_webcapture("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_webcapture("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("CreateWorkBatch") => { @@ -597,7 +597,7 @@ fn main() { } Some("DeleteWork") => { - let result = client.delete_work("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + let result = client.delete_work("ident_example".to_string(), "editgroup_id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } @@ -642,7 +642,7 @@ fn main() { // Disabled because there's no example. // Some("UpdateWork") => { - // let result = client.update_work("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // let result = client.update_work("ident_example".to_string(), ???, "editgroup_id_example".to_string()).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, _ => panic!("Invalid operation provided"), diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index 73917351..febd61de 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -30,10 +30,10 @@ use fatcat::{ pub struct Server; impl Api for Server { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { + fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_container({:?}, {:?}) - X-Span-ID: {:?}", + "create_container({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -59,10 +59,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_container(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + fn delete_container(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_container(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -143,16 +143,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_container( - &self, - ident: String, - entity: models::ContainerEntity, - editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { + fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_container(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -161,10 +155,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_creator({:?}, {:?}) - X-Span-ID: {:?}", + "create_creator({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -190,10 +184,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_creator(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + fn delete_creator(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_creator(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -285,10 +279,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { + fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_creator(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -362,10 +356,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_file(&self, entity: models::FileEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { + fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_file({:?}, {:?}) - X-Span-ID: {:?}", + "create_file({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -391,10 +385,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_file(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { + fn delete_file(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_file(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -477,10 +471,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_file(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -489,10 +483,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_fileset({:?}, {:?}) - X-Span-ID: {:?}", + "create_fileset({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -518,10 +512,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_fileset(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + fn delete_fileset(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_fileset(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -582,10 +576,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_fileset(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -594,10 +588,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_release({:?}, {:?}) - X-Span-ID: {:?}", + "create_release({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -623,10 +617,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + fn create_work(&self, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_work({:?}, {:?}) - X-Span-ID: {:?}", + "create_work({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -634,10 +628,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_release(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + fn delete_release(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_release(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -759,10 +753,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { + fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_release(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -771,10 +765,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "create_webcapture({:?}, {:?}) - X-Span-ID: {:?}", + "create_webcapture({:?}, \"{}\") - X-Span-ID: {:?}", entity, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -800,10 +794,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + fn delete_webcapture(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_webcapture(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -864,16 +858,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_webcapture( - &self, - ident: String, - entity: models::WebcaptureEntity, - editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_webcapture(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, @@ -900,10 +888,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn delete_work(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { + fn delete_work(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", + "delete_work(\"{}\", \"{}\") - X-Span-ID: {:?}", ident, editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone() @@ -975,10 +963,10 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { + fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { let context = context.clone(); println!( - "update_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + "update_work(\"{}\", {:?}, \"{}\") - X-Span-ID: {:?}", ident, entity, editgroup_id, diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 7f364eb4..5937b7f2 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -173,9 +173,9 @@ impl Client { } impl Api for Client { - fn create_container(&self, param_entity: models::ContainerEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { + fn create_container(&self, param_entity: models::ContainerEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/container?{editgroup_id}", @@ -369,9 +369,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_container(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + fn delete_container(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/container/{ident}?{editgroup_id}", @@ -971,11 +971,11 @@ impl Api for Client { &self, param_ident: String, param_entity: models::ContainerEntity, - param_editgroup_id: Option<String>, + param_editgroup_id: String, context: &Context, ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/container/{ident}?{editgroup_id}", @@ -1068,9 +1068,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/creator?{editgroup_id}", @@ -1264,9 +1264,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_creator(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + fn delete_creator(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/creator/{ident}?{editgroup_id}", @@ -1934,11 +1934,11 @@ impl Api for Client { &self, param_ident: String, param_entity: models::CreatorEntity, - param_editgroup_id: Option<String>, + param_editgroup_id: String, context: &Context, ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/creator/{ident}?{editgroup_id}", @@ -2765,9 +2765,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_file(&self, param_entity: models::FileEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { + fn create_file(&self, param_entity: models::FileEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!("{}/v0/file?{editgroup_id}", self.base_path, editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET)); @@ -2957,9 +2957,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_file(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { + fn delete_file(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/file/{ident}?{editgroup_id}", @@ -3558,15 +3558,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn update_file( - &self, - param_ident: String, - param_entity: models::FileEntity, - param_editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + fn update_file(&self, param_ident: String, param_entity: models::FileEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/file/{ident}?{editgroup_id}", @@ -3659,9 +3653,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_fileset(&self, param_entity: models::FilesetEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + fn create_fileset(&self, param_entity: models::FilesetEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/fileset?{editgroup_id}", @@ -3855,9 +3849,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_fileset(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + fn delete_fileset(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/fileset/{ident}?{editgroup_id}", @@ -4377,11 +4371,11 @@ impl Api for Client { &self, param_ident: String, param_entity: models::FilesetEntity, - param_editgroup_id: Option<String>, + param_editgroup_id: String, context: &Context, ) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/fileset/{ident}?{editgroup_id}", @@ -4474,9 +4468,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/release?{editgroup_id}", @@ -4670,9 +4664,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_work(&self, param_entity: models::WorkEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + fn create_work(&self, param_entity: models::WorkEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!("{}/v0/work?{editgroup_id}", self.base_path, editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET)); @@ -4760,9 +4754,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_release(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + fn delete_release(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/release/{ident}?{editgroup_id}", @@ -5578,11 +5572,11 @@ impl Api for Client { &self, param_ident: String, param_entity: models::ReleaseEntity, - param_editgroup_id: Option<String>, + param_editgroup_id: String, context: &Context, ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/release/{ident}?{editgroup_id}", @@ -5675,14 +5669,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_webcapture( - &self, - param_entity: models::WebcaptureEntity, - param_editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + fn create_webcapture(&self, param_entity: models::WebcaptureEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/webcapture?{editgroup_id}", @@ -5876,9 +5865,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_webcapture(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + fn delete_webcapture(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/webcapture/{ident}?{editgroup_id}", @@ -6398,11 +6387,11 @@ impl Api for Client { &self, param_ident: String, param_entity: models::WebcaptureEntity, - param_editgroup_id: Option<String>, + param_editgroup_id: String, context: &Context, ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/webcapture/{ident}?{editgroup_id}", @@ -6597,9 +6586,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_work(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { + fn delete_work(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/work/{ident}?{editgroup_id}", @@ -7183,15 +7172,9 @@ impl Api for Client { Box::new(futures::done(result)) } - fn update_work( - &self, - param_ident: String, - param_entity: models::WorkEntity, - param_editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { + fn update_work(&self, param_ident: String, param_entity: models::WorkEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { // Query parameters - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); let url = format!( "{}/v0/work/{ident}?{editgroup_id}", diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index 17c74384..cd281a3d 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -1256,7 +1256,7 @@ pub enum UpdateWorkResponse { /// API pub trait Api { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>; + fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>; fn create_container_batch( &self, @@ -1266,7 +1266,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>; - fn delete_container(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; + fn delete_container(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; fn delete_container_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send>; @@ -1289,10 +1289,9 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; - fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option<String>, context: &Context) - -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; + fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>; + fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>; fn create_creator_batch( &self, @@ -1302,7 +1301,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>; - fn delete_creator(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; + fn delete_creator(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; fn delete_creator_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send>; @@ -1327,7 +1326,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; + fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; fn auth_check(&self, role: Option<String>, context: &Context) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send>; @@ -1349,7 +1348,7 @@ pub trait Api { fn get_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; - fn create_file(&self, entity: models::FileEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>; + fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>; fn create_file_batch( &self, @@ -1359,7 +1358,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>; - fn delete_file(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; + fn delete_file(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; fn delete_file_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send>; @@ -1383,9 +1382,9 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; + fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; fn create_fileset_batch( &self, @@ -1395,7 +1394,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send>; - fn delete_fileset(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; + fn delete_fileset(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; fn delete_fileset_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send>; @@ -1409,9 +1408,9 @@ pub trait Api { fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send>; - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; fn create_release_batch( &self, @@ -1421,9 +1420,9 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>; - fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>; + fn create_work(&self, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>; - fn delete_release(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; + fn delete_release(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; fn delete_release_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send>; @@ -1456,9 +1455,9 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; + fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; fn create_webcapture_batch( &self, @@ -1468,7 +1467,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send>; - fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; + fn delete_webcapture(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; fn delete_webcapture_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send>; @@ -1482,13 +1481,7 @@ pub trait Api { fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send>; - fn update_webcapture( - &self, - ident: String, - entity: models::WebcaptureEntity, - editgroup_id: Option<String>, - context: &Context, - ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; fn create_work_batch( &self, @@ -1498,7 +1491,7 @@ pub trait Api { context: &Context, ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>; - fn delete_work(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; + fn delete_work(&self, ident: String, editgroup_id: String, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; fn delete_work_edit(&self, edit_id: String, context: &Context) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send>; @@ -1514,12 +1507,12 @@ pub trait Api { fn get_work_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send>; - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; + fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; } /// API without a `Context` pub trait ApiNoContext { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>; + fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>; fn create_container_batch( &self, @@ -1528,7 +1521,7 @@ pub trait ApiNoContext { editgroup_id: Option<String>, ) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>; - fn delete_container(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; + fn delete_container(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; fn delete_container_edit(&self, edit_id: String) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send>; @@ -1550,9 +1543,9 @@ pub trait ApiNoContext { hide: Option<String>, ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; - fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; + fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>; + fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>; fn create_creator_batch( &self, @@ -1561,7 +1554,7 @@ pub trait ApiNoContext { editgroup_id: Option<String>, ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>; - fn delete_creator(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; + fn delete_creator(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; fn delete_creator_edit(&self, edit_id: String) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send>; @@ -1579,7 +1572,7 @@ pub trait ApiNoContext { fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; + fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; fn auth_check(&self, role: Option<String>) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send>; @@ -1601,11 +1594,11 @@ pub trait ApiNoContext { fn get_editgroup(&self, editgroup_id: String) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; - fn create_file(&self, entity: models::FileEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>; + fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>; fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>; - fn delete_file(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; + fn delete_file(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>; fn delete_file_edit(&self, edit_id: String) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send>; @@ -1628,9 +1621,9 @@ pub trait ApiNoContext { hide: Option<String>, ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>; - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; + fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; fn create_fileset_batch( &self, @@ -1639,7 +1632,7 @@ pub trait ApiNoContext { editgroup_id: Option<String>, ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send>; - fn delete_fileset(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; + fn delete_fileset(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; fn delete_fileset_edit(&self, edit_id: String) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send>; @@ -1653,9 +1646,9 @@ pub trait ApiNoContext { fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send>; - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; fn create_release_batch( &self, @@ -1664,9 +1657,9 @@ pub trait ApiNoContext { editgroup_id: Option<String>, ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>; - fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>; + fn create_work(&self, entity: models::WorkEntity, editgroup_id: String) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>; - fn delete_release(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; + fn delete_release(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; fn delete_release_edit(&self, edit_id: String) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send>; @@ -1698,9 +1691,9 @@ pub trait ApiNoContext { hide: Option<String>, ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; + fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; fn create_webcapture_batch( &self, @@ -1709,7 +1702,7 @@ pub trait ApiNoContext { editgroup_id: Option<String>, ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send>; - fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; + fn delete_webcapture(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; fn delete_webcapture_edit(&self, edit_id: String) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send>; @@ -1723,11 +1716,11 @@ pub trait ApiNoContext { fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send>; - fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>; - fn delete_work(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; + fn delete_work(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; fn delete_work_edit(&self, edit_id: String) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send>; @@ -1743,7 +1736,7 @@ pub trait ApiNoContext { fn get_work_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send>; - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; + fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; } /// Trait to extend an API to make it easy to bind it to a context. @@ -1762,7 +1755,7 @@ impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T { } impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { + fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { self.api().create_container(entity, editgroup_id, &self.context()) } @@ -1775,7 +1768,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_container_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_container(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + fn delete_container(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { self.api().delete_container(ident, editgroup_id, &self.context()) } @@ -1813,11 +1806,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().lookup_container(issnl, wikidata_qid, expand, hide, &self.context()) } - fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { + fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { self.api().update_container(ident, entity, editgroup_id, &self.context()) } - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { self.api().create_creator(entity, editgroup_id, &self.context()) } @@ -1830,7 +1823,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_creator_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_creator(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + fn delete_creator(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { self.api().delete_creator(ident, editgroup_id, &self.context()) } @@ -1866,7 +1859,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().lookup_creator(orcid, wikidata_qid, expand, hide, &self.context()) } - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { + fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { self.api().update_creator(ident, entity, editgroup_id, &self.context()) } @@ -1910,7 +1903,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_editgroup(editgroup_id, &self.context()) } - fn create_file(&self, entity: models::FileEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { + fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { self.api().create_file(entity, editgroup_id, &self.context()) } @@ -1918,7 +1911,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_file_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_file(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { + fn delete_file(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { self.api().delete_file(ident, editgroup_id, &self.context()) } @@ -1957,11 +1950,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().lookup_file(md5, sha1, sha256, expand, hide, &self.context()) } - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { self.api().update_file(ident, entity, editgroup_id, &self.context()) } - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { self.api().create_fileset(entity, editgroup_id, &self.context()) } @@ -1974,7 +1967,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_fileset_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_fileset(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + fn delete_fileset(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { self.api().delete_fileset(ident, editgroup_id, &self.context()) } @@ -2002,11 +1995,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_fileset_revision(rev_id, expand, hide, &self.context()) } - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { self.api().update_fileset(ident, entity, editgroup_id, &self.context()) } - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { self.api().create_release(entity, editgroup_id, &self.context()) } @@ -2019,11 +2012,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_release_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + fn create_work(&self, entity: models::WorkEntity, editgroup_id: String) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { self.api().create_work(entity, editgroup_id, &self.context()) } - fn delete_release(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + fn delete_release(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { self.api().delete_release(ident, editgroup_id, &self.context()) } @@ -2077,11 +2070,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, expand, hide, &self.context()) } - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { + fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { self.api().update_release(ident, entity, editgroup_id, &self.context()) } - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { self.api().create_webcapture(entity, editgroup_id, &self.context()) } @@ -2094,7 +2087,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_webcapture_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + fn delete_webcapture(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { self.api().delete_webcapture(ident, editgroup_id, &self.context()) } @@ -2122,7 +2115,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_webcapture_revision(rev_id, expand, hide, &self.context()) } - fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { self.api().update_webcapture(ident, entity, editgroup_id, &self.context()) } @@ -2130,7 +2123,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().create_work_batch(entity_list, autoaccept, editgroup_id, &self.context()) } - fn delete_work(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { + fn delete_work(&self, ident: String, editgroup_id: String) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { self.api().delete_work(ident, editgroup_id, &self.context()) } @@ -2162,7 +2155,7 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_work_revision(rev_id, expand, hide, &self.context()) } - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { + fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { self.api().update_work(ident, entity, editgroup_id, &self.context()) } } diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index d8fc7dc2..2f1c5d27 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -116,7 +116,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -412,7 +418,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_container(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -1184,7 +1196,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -1324,7 +1342,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -1620,7 +1644,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_creator(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -2485,7 +2515,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -3669,7 +3705,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -3965,7 +4007,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_file(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -4738,7 +4786,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -4878,7 +4932,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -5174,7 +5234,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_fileset(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -5865,7 +5931,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -6005,7 +6077,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -6286,7 +6364,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -6441,7 +6525,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_release(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -7499,7 +7589,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -7639,7 +7735,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -7935,7 +8037,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_webcapture(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -8626,7 +8734,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for @@ -8922,7 +9036,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; match api.delete_work(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { @@ -9706,7 +9826,13 @@ 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_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_editgroup_id = query_params + .get("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter editgroup_id".to_string())))? + .first() + .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter editgroup_id was empty".to_string())))? + .parse::<String>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for diff --git a/rust/src/endpoints.rs b/rust/src/endpoints.rs index 6e67eadc..ada13654 100644 --- a/rust/src/endpoints.rs +++ b/rust/src/endpoints.rs @@ -88,19 +88,16 @@ macro_rules! wrap_entity_handlers { fn $post_fn( &self, entity: models::$model, - editgroup_id: Option<String>, + editgroup_id: String, context: &Context, ) -> Box<Future<Item = $post_resp, Error = ApiError> + Send> { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { + let editgroup_id = FatCatId::from_str(&editgroup_id)?; let auth_context = self.auth_confectionary.require_auth(&conn, &context.auth_data, Some(stringify!($post_fn)))?; auth_context.require_role(FatcatRole::Editor)?; - let editgroup_id = if let Some(s) = editgroup_id { - let eg_id = FatCatId::from_str(&s)?; - auth_context.require_editgroup(&conn, eg_id)?; - Some(eg_id) - } else { None }; - let edit_context = make_edit_context(&conn, auth_context.editor_id, editgroup_id, false)?; + auth_context.require_editgroup(&conn, editgroup_id)?; + let edit_context = make_edit_context(&conn, auth_context.editor_id, Some(editgroup_id), false)?; edit_context.check(&conn)?; entity.db_create(&conn, &edit_context)?.into_model() }) { @@ -190,20 +187,17 @@ macro_rules! wrap_entity_handlers { &self, ident: String, entity: models::$model, - editgroup_id: Option<String>, + editgroup_id: String, context: &Context, ) -> Box<Future<Item = $update_resp, Error = ApiError> + Send> { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { + let editgroup_id = FatCatId::from_str(&editgroup_id)?; let auth_context = self.auth_confectionary.require_auth(&conn, &context.auth_data, Some(stringify!($update_fn)))?; auth_context.require_role(FatcatRole::Editor)?; let entity_id = FatCatId::from_str(&ident)?; - let editgroup_id = if let Some(s) = editgroup_id { - let eg_id = FatCatId::from_str(&s)?; - auth_context.require_editgroup(&conn, eg_id)?; - Some(eg_id) - } else { None }; - let edit_context = make_edit_context(&conn, auth_context.editor_id, editgroup_id, false)?; + auth_context.require_editgroup(&conn, editgroup_id)?; + let edit_context = make_edit_context(&conn, auth_context.editor_id, Some(editgroup_id), false)?; edit_context.check(&conn)?; entity.db_update(&conn, &edit_context, entity_id)?.into_model() }) { @@ -246,23 +240,17 @@ macro_rules! wrap_entity_handlers { fn $delete_fn( &self, ident: String, - editgroup_id: Option<String>, + editgroup_id: String, context: &Context, ) -> Box<Future<Item = $delete_resp, Error = ApiError> + Send> { let conn = self.db_pool.get().expect("db_pool error"); let ret = match conn.transaction(|| { + let editgroup_id = FatCatId::from_str(&editgroup_id)?; let auth_context = self.auth_confectionary.require_auth(&conn, &context.auth_data, Some(stringify!($delete_fn)))?; auth_context.require_role(FatcatRole::Editor)?; let entity_id = FatCatId::from_str(&ident)?; - let editgroup_id: Option<FatCatId> = match editgroup_id { - Some(s) => { - let editgroup_id = FatCatId::from_str(&s)?; - auth_context.require_editgroup(&conn, editgroup_id)?; - Some(editgroup_id) - }, - None => None, - }; - let edit_context = make_edit_context(&conn, auth_context.editor_id, editgroup_id, false)?; + auth_context.require_editgroup(&conn, editgroup_id)?; + let edit_context = make_edit_context(&conn, auth_context.editor_id, Some(editgroup_id), false)?; edit_context.check(&conn)?; $model::db_delete(&conn, &edit_context, entity_id)?.into_model() }) { diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs index e82037f0..7d4469af 100644 --- a/rust/tests/test_api_server_http.rs +++ b/rust/tests/test_api_server_http.rs @@ -538,7 +538,10 @@ fn test_post_file() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/file?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/file?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{ }"#, &router, @@ -605,7 +608,10 @@ fn test_post_fileset() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/fileset?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/fileset?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{ }"#, &router, @@ -662,7 +668,10 @@ fn test_post_webcapture() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/webcapture?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/webcapture?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{ "original_url": "https://fatcat.wiki", "timestamp": "2018-12-28T11:11:11Z" }"#, @@ -674,7 +683,10 @@ fn test_post_webcapture() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/webcapture?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/webcapture?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{"original_url": "https://bnewbold.net/", "timestamp": "2018-12-28T05:06:07Z", @@ -726,7 +738,10 @@ fn test_post_release() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), // TODO: target_release_id r#"{"title": "secret minimal paper", @@ -742,7 +757,10 @@ fn test_post_release() { // No work_id supplied (auto-created) helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), // TODO: target_release_id r#"{"title": "secret minimal paper the second", @@ -756,7 +774,10 @@ fn test_post_release() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), // TODO: target_release_id r#"{"title": "secret paper", @@ -918,7 +939,10 @@ fn test_accept_editgroup() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/container?editgroup_id={}", uuid2fcid(&editgroup_id)), + &format!( + "http://localhost:9411/v0/container?editgroup_id={}", + uuid2fcid(&editgroup_id) + ), headers.clone(), &format!( "{{\"name\": \"test journal 1\", \"editgroup_id\": \"{}\"}}", @@ -931,7 +955,10 @@ fn test_accept_editgroup() { ); helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/container?editgroup_id={}", uuid2fcid(&editgroup_id)), + &format!( + "http://localhost:9411/v0/container?editgroup_id={}", + uuid2fcid(&editgroup_id) + ), headers.clone(), &format!( "{{\"name\": \"test journal 2\", \"editgroup_id\": \"{}\"}}", @@ -1200,7 +1227,10 @@ fn test_abstracts() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{"title": "some paper", "doi": "10.1234/iiiiiii", @@ -1222,7 +1252,10 @@ fn test_abstracts() { // Same abstracts; checking that re-inserting works helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{"title": "some paper again", "abstracts": [ @@ -1292,7 +1325,10 @@ fn test_contribs() { helpers::check_http_response( request::post( - &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id), + &format!( + "http://localhost:9411/v0/release?editgroup_id={}", + editgroup_id + ), headers.clone(), r#"{"title": "some paper", "doi": "10.1234/iiiiiii", diff --git a/rust/tests/test_old_python_tests.rs b/rust/tests/test_old_python_tests.rs index ac9d4112..e0d15484 100644 --- a/rust/tests/test_old_python_tests.rs +++ b/rust/tests/test_old_python_tests.rs @@ -33,7 +33,7 @@ fn test_api_rich_create() { new_container.issnl = Some("2222-3333".to_string()); // extra=dict(a=2, i="zing"))), let resp = client - .create_container(new_container, Some(editgroup_id.clone())) + .create_container(new_container, editgroup_id.clone()) .wait() .unwrap(); let container_id = match resp { @@ -46,7 +46,7 @@ fn test_api_rich_create() { new_creator.orcid = Some("0000-0002-1825-0097".to_string()); // extra=dict(a=2, i="zing"))), let resp = client - .create_creator(new_creator, Some(editgroup_id.clone())) + .create_creator(new_creator, editgroup_id.clone()) .wait() .unwrap(); let creator_id = match resp { @@ -57,7 +57,7 @@ fn test_api_rich_create() { let new_work = WorkEntity::new(); // extra=dict(a=2, i="zing"))), let resp = client - .create_work(new_work, Some(editgroup_id.clone())) + .create_work(new_work, editgroup_id.clone()) .wait() .unwrap(); let work_id = match resp { @@ -79,7 +79,7 @@ fn test_api_rich_create() { new_release.refs = Some(vec![rref]); // extra=dict(a=2, i="zing"))), let resp = client - .create_release(new_release, Some(editgroup_id.clone())) + .create_release(new_release, editgroup_id.clone()) .wait() .unwrap(); let stub_release_id = match resp { @@ -102,7 +102,7 @@ fn test_api_rich_create() { new_release.refs = Some(vec![rref]); // extra=dict(f=7, b="loopy"))), let resp = client - .create_release(new_release, Some(editgroup_id.clone())) + .create_release(new_release, editgroup_id.clone()) .wait() .unwrap(); let release_id = match resp { @@ -116,7 +116,7 @@ fn test_api_rich_create() { new_file.release_ids = Some(vec![release_id.clone()]); // extra=dict(f=4, b="zing"))), let resp = client - .create_file(new_file, Some(editgroup_id.clone())) + .create_file(new_file, editgroup_id.clone()) .wait() .unwrap(); let file_id = match resp { @@ -203,7 +203,7 @@ fn test_merge_works() { // Create 2x works, each with releases; work_b has two releases let resp = client - .create_work(WorkEntity::new(), Some(editgroup_id.clone())) + .create_work(WorkEntity::new(), editgroup_id.clone()) .wait() .unwrap(); let work_a_id = match resp { @@ -216,7 +216,7 @@ fn test_merge_works() { new_release.work_id = Some(work_a_id.clone()); new_release.doi = Some("10.1234/A1".to_string()); let resp = client - .create_release(new_release, Some(editgroup_id.clone())) + .create_release(new_release, editgroup_id.clone()) .wait() .unwrap(); let _release_a1_id = match resp { @@ -225,7 +225,7 @@ fn test_merge_works() { }; let resp = client - .create_work(WorkEntity::new(), Some(editgroup_id.clone())) + .create_work(WorkEntity::new(), editgroup_id.clone()) .wait() .unwrap(); let work_b_id = match resp { @@ -239,7 +239,7 @@ fn test_merge_works() { new_release.work_id = Some(work_b_id.clone()); new_release.doi = Some("10.1234/B1".to_string()); let resp = client - .create_release(new_release, Some(editgroup_id.clone())) + .create_release(new_release, editgroup_id.clone()) .wait() .unwrap(); let _release_b1_id = match resp { @@ -253,7 +253,7 @@ fn test_merge_works() { new_release.work_id = Some(work_b_id.clone()); new_release.doi = Some("10.1234/B2".to_string()); let resp = client - .create_release(new_release, Some(editgroup_id.clone())) + .create_release(new_release, editgroup_id.clone()) .wait() .unwrap(); let _release_b2_id = match resp { |