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 /rust/fatcat-api-spec/src | |
parent | 0624fce632da17b3f98f0d4ff98a736f05fa287b (diff) | |
download | fatcat-17fe81ea8d58f93f129492dc44a38df9ab8d528e.tar.gz fatcat-17fe81ea8d58f93f129492dc44a38df9ab8d528e.zip |
rust impl required editgroup_id
Diffstat (limited to 'rust/fatcat-api-spec/src')
-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 |
3 files changed, 252 insertions, 150 deletions
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 |