From 43ebd22582c33e95479572c213657a781e1eca3f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 14 May 2019 17:09:35 -0700 Subject: rust codegen --- rust/fatcat-api-spec/src/client.rs | 577 ++++++----------- rust/fatcat-api-spec/src/lib.rs | 476 +++++--------- rust/fatcat-api-spec/src/mimetypes.rs | 196 +++--- rust/fatcat-api-spec/src/models.rs | 126 ++++ rust/fatcat-api-spec/src/server.rs | 1119 +++++++++++++++++---------------- 5 files changed, 1167 insertions(+), 1327 deletions(-) (limited to 'rust/fatcat-api-spec/src') diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 057f1651..378c546f 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -35,9 +35,9 @@ use swagger::{ApiError, Context, XSpanId}; use models; use { - AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, - CreateEditgroupAnnotationResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, - CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerAutoBatchResponse, CreateContainerResponse, CreateCreatorAutoBatchResponse, CreateCreatorResponse, + CreateEditgroupAnnotationResponse, CreateEditgroupResponse, CreateFileAutoBatchResponse, CreateFileResponse, CreateFilesetAutoBatchResponse, CreateFilesetResponse, CreateReleaseAutoBatchResponse, + CreateReleaseResponse, CreateWebcaptureAutoBatchResponse, CreateWebcaptureResponse, CreateWorkAutoBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, @@ -173,14 +173,11 @@ impl Client { } impl Api for Client { - fn create_container(&self, param_entity: models::ContainerEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn create_container(&self, param_editgroup_id: String, param_entity: models::ContainerEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/container?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/container", self.base_path, - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -267,31 +264,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_container_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); - - let url = format!( - "{}/v0/container/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); + fn create_container_auto_batch(&self, param_auto_batch: models::ContainerAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/container/batch", self.base_path); - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -299,27 +275,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_CONTAINER_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_CONTAINER_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateContainerBatchResponse::CreatedEntities(body)) + Ok(CreateContainerAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateContainerBatchResponse::BadRequest(body)) + Ok(CreateContainerAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -331,7 +307,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateContainerBatchResponse::NotAuthorized { + Ok(CreateContainerAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -341,21 +317,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateContainerBatchResponse::Forbidden(body)) + Ok(CreateContainerAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateContainerBatchResponse::NotFound(body)) + Ok(CreateContainerAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateContainerBatchResponse::GenericError(body)) + Ok(CreateContainerAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -375,15 +351,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_container(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_container(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/container/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/container/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -465,10 +438,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_container_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_container_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/container/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/container/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -975,19 +949,16 @@ impl Api for Client { fn update_container( &self, + param_editgroup_id: String, param_ident: String, param_entity: models::ContainerEntity, - param_editgroup_id: String, context: &Context, ) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - let url = format!( - "{}/v0/container/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/container/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -1074,14 +1045,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn create_creator(&self, param_editgroup_id: String, param_entity: models::CreatorEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/creator?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/creator", self.base_path, - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -1168,31 +1136,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_creator_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); - - let url = format!( - "{}/v0/creator/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); + fn create_creator_auto_batch(&self, param_auto_batch: models::CreatorAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/creator/batch", self.base_path); - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -1200,27 +1147,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateCreatorBatchResponse::CreatedEntities(body)) + Ok(CreateCreatorAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateCreatorBatchResponse::BadRequest(body)) + Ok(CreateCreatorAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -1232,7 +1179,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateCreatorBatchResponse::NotAuthorized { + Ok(CreateCreatorAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -1242,21 +1189,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateCreatorBatchResponse::Forbidden(body)) + Ok(CreateCreatorAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateCreatorBatchResponse::NotFound(body)) + Ok(CreateCreatorAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateCreatorBatchResponse::GenericError(body)) + Ok(CreateCreatorAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1276,15 +1223,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_creator(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_creator(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/creator/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/creator/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -1366,10 +1310,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_creator_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_creator_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/creator/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/creator/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -1944,19 +1889,16 @@ impl Api for Client { fn update_creator( &self, + param_editgroup_id: String, param_ident: String, param_entity: models::CreatorEntity, - param_editgroup_id: String, context: &Context, ) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - let url = format!( - "{}/v0/creator/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/creator/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -3281,11 +3223,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_file(&self, param_entity: models::FileEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - 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)); + fn create_file(&self, param_editgroup_id: String, param_entity: models::FileEntity, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/editgroup/{editgroup_id}/file", + self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -3371,31 +3314,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_file_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); + fn create_file_auto_batch(&self, param_auto_batch: models::FileAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/file/batch", self.base_path); - let url = format!( - "{}/v0/file/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); - - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -3403,27 +3325,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateFileBatchResponse::CreatedEntities(body)) + Ok(CreateFileAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFileBatchResponse::BadRequest(body)) + Ok(CreateFileAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -3435,7 +3357,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateFileBatchResponse::NotAuthorized { + Ok(CreateFileAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -3445,21 +3367,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFileBatchResponse::Forbidden(body)) + Ok(CreateFileAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFileBatchResponse::NotFound(body)) + Ok(CreateFileAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFileBatchResponse::GenericError(body)) + Ok(CreateFileAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3479,15 +3401,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_file(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_file(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/file/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/file/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -3569,10 +3488,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_file_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_file_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/file/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/file/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -4080,15 +4000,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn update_file(&self, param_ident: String, param_entity: models::FileEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn update_file(&self, param_editgroup_id: String, param_ident: String, param_entity: models::FileEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/file/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/file/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -4175,14 +4092,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_fileset(&self, param_entity: models::FilesetEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn create_fileset(&self, param_editgroup_id: String, param_entity: models::FilesetEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/fileset?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/fileset", self.base_path, - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -4269,31 +4183,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_fileset_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); + fn create_fileset_auto_batch(&self, param_auto_batch: models::FilesetAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/fileset/batch", self.base_path); - let url = format!( - "{}/v0/fileset/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); - - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -4301,27 +4194,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_FILESET_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_FILESET_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateFilesetBatchResponse::CreatedEntities(body)) + Ok(CreateFilesetAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFilesetBatchResponse::BadRequest(body)) + Ok(CreateFilesetAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -4333,7 +4226,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateFilesetBatchResponse::NotAuthorized { + Ok(CreateFilesetAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -4343,21 +4236,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFilesetBatchResponse::Forbidden(body)) + Ok(CreateFilesetAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFilesetBatchResponse::NotFound(body)) + Ok(CreateFilesetAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateFilesetBatchResponse::GenericError(body)) + Ok(CreateFilesetAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -4377,15 +4270,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_fileset(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_fileset(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/fileset/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/fileset/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -4467,10 +4357,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_fileset_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_fileset_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/fileset/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/fileset/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -4897,19 +4788,16 @@ impl Api for Client { fn update_fileset( &self, + param_editgroup_id: String, param_ident: String, param_entity: models::FilesetEntity, - param_editgroup_id: String, context: &Context, ) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - let url = format!( - "{}/v0/fileset/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/fileset/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -4996,14 +4884,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn create_release(&self, param_editgroup_id: String, param_entity: models::ReleaseEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/release", self.base_path, - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -5090,31 +4975,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_release_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); - - let url = format!( - "{}/v0/release/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); + fn create_release_auto_batch(&self, param_auto_batch: models::ReleaseAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/release/batch", self.base_path); - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -5122,27 +4986,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::CreatedEntities(body)) + Ok(CreateReleaseAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::BadRequest(body)) + Ok(CreateReleaseAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -5154,7 +5018,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateReleaseBatchResponse::NotAuthorized { + Ok(CreateReleaseAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -5164,21 +5028,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::Forbidden(body)) + Ok(CreateReleaseAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::NotFound(body)) + Ok(CreateReleaseAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::GenericError(body)) + Ok(CreateReleaseAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -5198,11 +5062,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_work(&self, param_entity: models::WorkEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - 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)); + fn create_work(&self, param_editgroup_id: String, param_entity: models::WorkEntity, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/editgroup/{editgroup_id}/work", + self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -5288,15 +5153,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_release(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_release(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/release/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -5378,10 +5240,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_release_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_release_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/release/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -6116,19 +5979,16 @@ impl Api for Client { fn update_release( &self, + param_editgroup_id: String, param_ident: String, param_entity: models::ReleaseEntity, - param_editgroup_id: String, context: &Context, ) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - let url = format!( - "{}/v0/release/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/release/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -6215,14 +6075,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_webcapture(&self, param_entity: models::WebcaptureEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn create_webcapture(&self, param_editgroup_id: String, param_entity: models::WebcaptureEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/webcapture?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/webcapture", self.base_path, - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -6309,31 +6166,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_webcapture_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); + fn create_webcapture_auto_batch(&self, param_auto_batch: models::WebcaptureAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/webcapture/batch", self.base_path); - let url = format!( - "{}/v0/webcapture/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); - - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -6341,27 +6177,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_WEBCAPTURE_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_WEBCAPTURE_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateWebcaptureBatchResponse::CreatedEntities(body)) + Ok(CreateWebcaptureAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWebcaptureBatchResponse::BadRequest(body)) + Ok(CreateWebcaptureAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -6373,7 +6209,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateWebcaptureBatchResponse::NotAuthorized { + Ok(CreateWebcaptureAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -6383,21 +6219,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWebcaptureBatchResponse::Forbidden(body)) + Ok(CreateWebcaptureAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWebcaptureBatchResponse::NotFound(body)) + Ok(CreateWebcaptureAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWebcaptureBatchResponse::GenericError(body)) + Ok(CreateWebcaptureAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -6417,15 +6253,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_webcapture(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_webcapture(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/webcapture/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/webcapture/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -6507,10 +6340,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_webcapture_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_webcapture_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/webcapture/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/webcapture/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -6937,19 +6771,16 @@ impl Api for Client { fn update_webcapture( &self, + param_editgroup_id: String, param_ident: String, param_entity: models::WebcaptureEntity, - param_editgroup_id: String, context: &Context, ) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - let url = format!( - "{}/v0/webcapture/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/webcapture/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); @@ -7036,31 +6867,10 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_work_batch( - &self, - param_entity_list: &Vec, - param_autoaccept: Option, - param_editgroup_id: Option, - param_description: Option, - param_extra: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - 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_description = param_description.map_or_else(String::new, |query| format!("description={description}&", description = query.to_string())); - let query_extra = param_extra.map_or_else(String::new, |query| format!("extra={extra}&", extra = query.to_string())); + fn create_work_auto_batch(&self, param_auto_batch: models::WorkAutoBatch, context: &Context) -> Box + Send> { + let url = format!("{}/v0/editgroup/auto/work/batch", self.base_path); - let url = format!( - "{}/v0/work/batch?{autoaccept}{editgroup_id}{description}{extra}", - self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET), - description = utf8_percent_encode(&query_description, QUERY_ENCODE_SET), - extra = utf8_percent_encode(&query_extra, QUERY_ENCODE_SET) - ); - - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_auto_batch).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); let request = hyper_client.request(hyper::method::Method::Post, &url); @@ -7068,27 +6878,27 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK_BATCH.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK_AUTO_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkBatchResponse::CreatedEntities(body)) + Ok(CreateWorkAutoBatchResponse::CreatedEditgroup(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkBatchResponse::BadRequest(body)) + Ok(CreateWorkAutoBatchResponse::BadRequest(body)) } 401 => { let mut buf = String::new(); @@ -7100,7 +6910,7 @@ impl Api for Client { .get::() .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?; - Ok(CreateWorkBatchResponse::NotAuthorized { + Ok(CreateWorkAutoBatchResponse::NotAuthorized { body: body, www_authenticate: response_www_authenticate.0.clone(), }) @@ -7110,21 +6920,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkBatchResponse::Forbidden(body)) + Ok(CreateWorkAutoBatchResponse::Forbidden(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkBatchResponse::NotFound(body)) + Ok(CreateWorkAutoBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkBatchResponse::GenericError(body)) + Ok(CreateWorkAutoBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -7144,15 +6954,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_work(&self, param_ident: String, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn delete_work(&self, param_editgroup_id: String, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/work/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/work/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -7234,10 +7041,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_work_edit(&self, param_edit_id: String, context: &Context) -> Box + Send> { + fn delete_work_edit(&self, param_editgroup_id: String, param_edit_id: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/work/edit/{edit_id}", + "{}/v0/editgroup/{editgroup_id}/work/edit/{edit_id}", self.base_path, + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); @@ -7730,15 +7538,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn update_work(&self, param_ident: String, param_entity: models::WorkEntity, param_editgroup_id: String, context: &Context) -> Box + Send> { - // Query parameters - let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string()); - + fn update_work(&self, param_editgroup_id: String, param_ident: String, param_entity: models::WorkEntity, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/work/{ident}?{editgroup_id}", + "{}/v0/editgroup/{editgroup_id}/work/{ident}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(¶m_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET), + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index e01c4fd8..b19b5793 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -49,9 +49,9 @@ pub enum CreateContainerResponse { } #[derive(Debug, PartialEq)] -pub enum CreateContainerBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateContainerAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -201,9 +201,9 @@ pub enum CreateCreatorResponse { } #[derive(Debug, PartialEq)] -pub enum CreateCreatorBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateCreatorAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -581,9 +581,9 @@ pub enum CreateFileResponse { } #[derive(Debug, PartialEq)] -pub enum CreateFileBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateFileAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -733,9 +733,9 @@ pub enum CreateFilesetResponse { } #[derive(Debug, PartialEq)] -pub enum CreateFilesetBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateFilesetAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -873,9 +873,9 @@ pub enum CreateReleaseResponse { } #[derive(Debug, PartialEq)] -pub enum CreateReleaseBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateReleaseAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -1077,9 +1077,9 @@ pub enum CreateWebcaptureResponse { } #[derive(Debug, PartialEq)] -pub enum CreateWebcaptureBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateWebcaptureAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -1201,9 +1201,9 @@ pub enum UpdateWebcaptureResponse { } #[derive(Debug, PartialEq)] -pub enum CreateWorkBatchResponse { - /// Created Entities - CreatedEntities(Vec), +pub enum CreateWorkAutoBatchResponse { + /// Created Editgroup + CreatedEditgroup(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Authorized @@ -1338,21 +1338,13 @@ pub enum UpdateWorkResponse { /// API pub trait Api { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_container(&self, editgroup_id: String, entity: models::ContainerEntity, context: &Context) -> Box + Send>; - fn create_container_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_container_auto_batch(&self, auto_batch: models::ContainerAutoBatch, context: &Context) -> Box + Send>; - fn delete_container(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_container(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_container_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_container_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_container(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1373,23 +1365,15 @@ pub trait Api { context: &Context, ) -> Box + Send>; - fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_container(&self, editgroup_id: String, ident: String, entity: models::ContainerEntity, context: &Context) -> Box + Send>; - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_creator(&self, editgroup_id: String, entity: models::CreatorEntity, context: &Context) -> Box + Send>; - fn create_creator_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_creator_auto_batch(&self, auto_batch: models::CreatorAutoBatch, context: &Context) -> Box + Send>; - fn delete_creator(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_creator(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_creator_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_creator_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_creator(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1412,7 +1396,7 @@ pub trait Api { context: &Context, ) -> Box + Send>; - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_creator(&self, editgroup_id: String, ident: String, entity: models::CreatorEntity, context: &Context) -> Box + Send>; fn auth_check(&self, role: Option, context: &Context) -> Box + Send>; @@ -1470,21 +1454,13 @@ pub trait Api { context: &Context, ) -> Box + Send>; - fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_file(&self, editgroup_id: String, entity: models::FileEntity, context: &Context) -> Box + Send>; - fn create_file_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_file_auto_batch(&self, auto_batch: models::FileAutoBatch, context: &Context) -> Box + Send>; - fn delete_file(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_file(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_file_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_file_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_file(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1506,23 +1482,15 @@ pub trait Api { context: &Context, ) -> Box + Send>; - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_file(&self, editgroup_id: String, ident: String, entity: models::FileEntity, context: &Context) -> Box + Send>; - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_fileset(&self, editgroup_id: String, entity: models::FilesetEntity, context: &Context) -> Box + Send>; - fn create_fileset_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_fileset_auto_batch(&self, auto_batch: models::FilesetAutoBatch, context: &Context) -> Box + Send>; - fn delete_fileset(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_fileset(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_fileset_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_fileset_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_fileset(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1534,25 +1502,17 @@ pub trait Api { fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_fileset(&self, editgroup_id: String, ident: String, entity: models::FilesetEntity, context: &Context) -> Box + Send>; - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_release(&self, editgroup_id: String, entity: models::ReleaseEntity, context: &Context) -> Box + Send>; - fn create_release_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_release_auto_batch(&self, auto_batch: models::ReleaseAutoBatch, context: &Context) -> Box + Send>; - fn create_work(&self, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_work(&self, editgroup_id: String, entity: models::WorkEntity, context: &Context) -> Box + Send>; - fn delete_release(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_release(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_release_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_release_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_release(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1587,23 +1547,15 @@ pub trait Api { context: &Context, ) -> Box + Send>; - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_release(&self, editgroup_id: String, ident: String, entity: models::ReleaseEntity, context: &Context) -> Box + Send>; - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn create_webcapture(&self, editgroup_id: String, entity: models::WebcaptureEntity, context: &Context) -> Box + Send>; - fn create_webcapture_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_webcapture_auto_batch(&self, auto_batch: models::WebcaptureAutoBatch, context: &Context) -> Box + Send>; - fn delete_webcapture(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_webcapture(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_webcapture_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_webcapture_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_webcapture(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1615,21 +1567,13 @@ pub trait Api { fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; - fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_webcapture(&self, editgroup_id: String, ident: String, entity: models::WebcaptureEntity, context: &Context) -> Box + Send>; - fn create_work_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - context: &Context, - ) -> Box + Send>; + fn create_work_auto_batch(&self, auto_batch: models::WorkAutoBatch, context: &Context) -> Box + Send>; - fn delete_work(&self, ident: String, editgroup_id: String, context: &Context) -> Box + Send>; + fn delete_work(&self, editgroup_id: String, ident: String, context: &Context) -> Box + Send>; - fn delete_work_edit(&self, edit_id: String, context: &Context) -> Box + Send>; + fn delete_work_edit(&self, editgroup_id: String, edit_id: String, context: &Context) -> Box + Send>; fn get_work(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; @@ -1643,25 +1587,18 @@ pub trait Api { fn get_work_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String, context: &Context) -> Box + Send>; + fn update_work(&self, editgroup_id: String, ident: String, entity: models::WorkEntity, context: &Context) -> Box + Send>; } /// API without a `Context` pub trait ApiNoContext { - fn create_container(&self, entity: models::ContainerEntity, editgroup_id: String) -> Box + Send>; + fn create_container(&self, editgroup_id: String, entity: models::ContainerEntity) -> Box + Send>; - fn create_container_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_container_auto_batch(&self, auto_batch: models::ContainerAutoBatch) -> Box + Send>; - fn delete_container(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_container(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_container_edit(&self, edit_id: String) -> Box + Send>; + fn delete_container_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_container(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1681,22 +1618,15 @@ pub trait ApiNoContext { hide: Option, ) -> Box + Send>; - fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: String) -> Box + Send>; + fn update_container(&self, editgroup_id: String, ident: String, entity: models::ContainerEntity) -> Box + Send>; - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String) -> Box + Send>; + fn create_creator(&self, editgroup_id: String, entity: models::CreatorEntity) -> Box + Send>; - fn create_creator_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_creator_auto_batch(&self, auto_batch: models::CreatorAutoBatch) -> Box + Send>; - fn delete_creator(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_creator(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_creator_edit(&self, edit_id: String) -> Box + Send>; + fn delete_creator_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_creator(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1712,7 +1642,7 @@ pub trait ApiNoContext { fn lookup_creator(&self, orcid: Option, wikidata_qid: Option, expand: Option, hide: Option) -> Box + Send>; - fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: String) -> Box + Send>; + fn update_creator(&self, editgroup_id: String, ident: String, entity: models::CreatorEntity) -> Box + Send>; fn auth_check(&self, role: Option) -> Box + Send>; @@ -1762,20 +1692,13 @@ pub trait ApiNoContext { since: Option>, ) -> Box + Send>; - fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box + Send>; + fn create_file(&self, editgroup_id: String, entity: models::FileEntity) -> Box + Send>; - fn create_file_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_file_auto_batch(&self, auto_batch: models::FileAutoBatch) -> Box + Send>; - fn delete_file(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_file(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_file_edit(&self, edit_id: String) -> Box + Send>; + fn delete_file_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_file(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1796,22 +1719,15 @@ pub trait ApiNoContext { hide: Option, ) -> Box + Send>; - fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: String) -> Box + Send>; + fn update_file(&self, editgroup_id: String, ident: String, entity: models::FileEntity) -> Box + Send>; - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String) -> Box + Send>; + fn create_fileset(&self, editgroup_id: String, entity: models::FilesetEntity) -> Box + Send>; - fn create_fileset_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_fileset_auto_batch(&self, auto_batch: models::FilesetAutoBatch) -> Box + Send>; - fn delete_fileset(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_fileset(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_fileset_edit(&self, edit_id: String) -> Box + Send>; + fn delete_fileset_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_fileset(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1823,24 +1739,17 @@ pub trait ApiNoContext { fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; - fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: String) -> Box + Send>; + fn update_fileset(&self, editgroup_id: String, ident: String, entity: models::FilesetEntity) -> Box + Send>; - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String) -> Box + Send>; + fn create_release(&self, editgroup_id: String, entity: models::ReleaseEntity) -> Box + Send>; - fn create_release_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_release_auto_batch(&self, auto_batch: models::ReleaseAutoBatch) -> Box + Send>; - fn create_work(&self, entity: models::WorkEntity, editgroup_id: String) -> Box + Send>; + fn create_work(&self, editgroup_id: String, entity: models::WorkEntity) -> Box + Send>; - fn delete_release(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_release(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_release_edit(&self, edit_id: String) -> Box + Send>; + fn delete_release_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_release(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1874,22 +1783,15 @@ pub trait ApiNoContext { hide: Option, ) -> Box + Send>; - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box + Send>; + fn update_release(&self, editgroup_id: String, ident: String, entity: models::ReleaseEntity) -> Box + Send>; - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String) -> Box + Send>; + fn create_webcapture(&self, editgroup_id: String, entity: models::WebcaptureEntity) -> Box + Send>; - fn create_webcapture_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_webcapture_auto_batch(&self, auto_batch: models::WebcaptureAutoBatch) -> Box + Send>; - fn delete_webcapture(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_webcapture(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_webcapture_edit(&self, edit_id: String) -> Box + Send>; + fn delete_webcapture_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_webcapture(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1901,20 +1803,13 @@ pub trait ApiNoContext { fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; - fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: String) -> Box + Send>; + fn update_webcapture(&self, editgroup_id: String, ident: String, entity: models::WebcaptureEntity) -> Box + Send>; - fn create_work_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send>; + fn create_work_auto_batch(&self, auto_batch: models::WorkAutoBatch) -> Box + Send>; - fn delete_work(&self, ident: String, editgroup_id: String) -> Box + Send>; + fn delete_work(&self, editgroup_id: String, ident: String) -> Box + Send>; - fn delete_work_edit(&self, edit_id: String) -> Box + Send>; + fn delete_work_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send>; fn get_work(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; @@ -1928,7 +1823,7 @@ pub trait ApiNoContext { fn get_work_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; - fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: String) -> Box + Send>; + fn update_work(&self, editgroup_id: String, ident: String, entity: models::WorkEntity) -> Box + Send>; } /// Trait to extend an API to make it easy to bind it to a context. @@ -1947,27 +1842,20 @@ 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: String) -> Box + Send> { - self.api().create_container(entity, editgroup_id, &self.context()) + fn create_container(&self, editgroup_id: String, entity: models::ContainerEntity) -> Box + Send> { + self.api().create_container(editgroup_id, entity, &self.context()) } - fn create_container_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_container_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_container_auto_batch(&self, auto_batch: models::ContainerAutoBatch) -> Box + Send> { + self.api().create_container_auto_batch(auto_batch, &self.context()) } - fn delete_container(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_container(ident, editgroup_id, &self.context()) + fn delete_container(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_container(editgroup_id, ident, &self.context()) } - fn delete_container_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_container_edit(edit_id, &self.context()) + fn delete_container_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_container_edit(editgroup_id, edit_id, &self.context()) } fn get_container(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2000,31 +1888,24 @@ 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: String) -> Box + Send> { - self.api().update_container(ident, entity, editgroup_id, &self.context()) + fn update_container(&self, editgroup_id: String, ident: String, entity: models::ContainerEntity) -> Box + Send> { + self.api().update_container(editgroup_id, ident, entity, &self.context()) } - fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: String) -> Box + Send> { - self.api().create_creator(entity, editgroup_id, &self.context()) + fn create_creator(&self, editgroup_id: String, entity: models::CreatorEntity) -> Box + Send> { + self.api().create_creator(editgroup_id, entity, &self.context()) } - fn create_creator_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_creator_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_creator_auto_batch(&self, auto_batch: models::CreatorAutoBatch) -> Box + Send> { + self.api().create_creator_auto_batch(auto_batch, &self.context()) } - fn delete_creator(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_creator(ident, editgroup_id, &self.context()) + fn delete_creator(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_creator(editgroup_id, ident, &self.context()) } - fn delete_creator_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_creator_edit(edit_id, &self.context()) + fn delete_creator_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_creator_edit(editgroup_id, edit_id, &self.context()) } fn get_creator(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2055,8 +1936,8 @@ 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: String) -> Box + Send> { - self.api().update_creator(ident, entity, editgroup_id, &self.context()) + fn update_creator(&self, editgroup_id: String, ident: String, entity: models::CreatorEntity) -> Box + Send> { + self.api().update_creator(editgroup_id, ident, entity, &self.context()) } fn auth_check(&self, role: Option) -> Box + Send> { @@ -2137,27 +2018,20 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_editor_annotations(editor_id, limit, before, since, &self.context()) } - fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box + Send> { - self.api().create_file(entity, editgroup_id, &self.context()) + fn create_file(&self, editgroup_id: String, entity: models::FileEntity) -> Box + Send> { + self.api().create_file(editgroup_id, entity, &self.context()) } - fn create_file_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_file_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_file_auto_batch(&self, auto_batch: models::FileAutoBatch) -> Box + Send> { + self.api().create_file_auto_batch(auto_batch, &self.context()) } - fn delete_file(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_file(ident, editgroup_id, &self.context()) + fn delete_file(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_file(editgroup_id, ident, &self.context()) } - fn delete_file_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_file_edit(edit_id, &self.context()) + fn delete_file_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_file_edit(editgroup_id, edit_id, &self.context()) } fn get_file(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2191,31 +2065,24 @@ 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: String) -> Box + Send> { - self.api().update_file(ident, entity, editgroup_id, &self.context()) + fn update_file(&self, editgroup_id: String, ident: String, entity: models::FileEntity) -> Box + Send> { + self.api().update_file(editgroup_id, ident, entity, &self.context()) } - fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: String) -> Box + Send> { - self.api().create_fileset(entity, editgroup_id, &self.context()) + fn create_fileset(&self, editgroup_id: String, entity: models::FilesetEntity) -> Box + Send> { + self.api().create_fileset(editgroup_id, entity, &self.context()) } - fn create_fileset_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_fileset_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_fileset_auto_batch(&self, auto_batch: models::FilesetAutoBatch) -> Box + Send> { + self.api().create_fileset_auto_batch(auto_batch, &self.context()) } - fn delete_fileset(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_fileset(ident, editgroup_id, &self.context()) + fn delete_fileset(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_fileset(editgroup_id, ident, &self.context()) } - fn delete_fileset_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_fileset_edit(edit_id, &self.context()) + fn delete_fileset_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_fileset_edit(editgroup_id, edit_id, &self.context()) } fn get_fileset(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2238,35 +2105,28 @@ 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: String) -> Box + Send> { - self.api().update_fileset(ident, entity, editgroup_id, &self.context()) + fn update_fileset(&self, editgroup_id: String, ident: String, entity: models::FilesetEntity) -> Box + Send> { + self.api().update_fileset(editgroup_id, ident, entity, &self.context()) } - fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: String) -> Box + Send> { - self.api().create_release(entity, editgroup_id, &self.context()) + fn create_release(&self, editgroup_id: String, entity: models::ReleaseEntity) -> Box + Send> { + self.api().create_release(editgroup_id, entity, &self.context()) } - fn create_release_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_release_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_release_auto_batch(&self, auto_batch: models::ReleaseAutoBatch) -> Box + Send> { + self.api().create_release_auto_batch(auto_batch, &self.context()) } - fn create_work(&self, entity: models::WorkEntity, editgroup_id: String) -> Box + Send> { - self.api().create_work(entity, editgroup_id, &self.context()) + fn create_work(&self, editgroup_id: String, entity: models::WorkEntity) -> Box + Send> { + self.api().create_work(editgroup_id, entity, &self.context()) } - fn delete_release(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_release(ident, editgroup_id, &self.context()) + fn delete_release(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_release(editgroup_id, ident, &self.context()) } - fn delete_release_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_release_edit(edit_id, &self.context()) + fn delete_release_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_release_edit(editgroup_id, edit_id, &self.context()) } fn get_release(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2320,31 +2180,24 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { .lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, expand, hide, &self.context()) } - fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: String) -> Box + Send> { - self.api().update_release(ident, entity, editgroup_id, &self.context()) + fn update_release(&self, editgroup_id: String, ident: String, entity: models::ReleaseEntity) -> Box + Send> { + self.api().update_release(editgroup_id, ident, entity, &self.context()) } - fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: String) -> Box + Send> { - self.api().create_webcapture(entity, editgroup_id, &self.context()) + fn create_webcapture(&self, editgroup_id: String, entity: models::WebcaptureEntity) -> Box + Send> { + self.api().create_webcapture(editgroup_id, entity, &self.context()) } - fn create_webcapture_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_webcapture_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_webcapture_auto_batch(&self, auto_batch: models::WebcaptureAutoBatch) -> Box + Send> { + self.api().create_webcapture_auto_batch(auto_batch, &self.context()) } - fn delete_webcapture(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_webcapture(ident, editgroup_id, &self.context()) + fn delete_webcapture(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_webcapture(editgroup_id, ident, &self.context()) } - fn delete_webcapture_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_webcapture_edit(edit_id, &self.context()) + fn delete_webcapture_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_webcapture_edit(editgroup_id, edit_id, &self.context()) } fn get_webcapture(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2367,27 +2220,20 @@ 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: String) -> Box + Send> { - self.api().update_webcapture(ident, entity, editgroup_id, &self.context()) + fn update_webcapture(&self, editgroup_id: String, ident: String, entity: models::WebcaptureEntity) -> Box + Send> { + self.api().update_webcapture(editgroup_id, ident, entity, &self.context()) } - fn create_work_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup_id: Option, - description: Option, - extra: Option, - ) -> Box + Send> { - self.api().create_work_batch(entity_list, autoaccept, editgroup_id, description, extra, &self.context()) + fn create_work_auto_batch(&self, auto_batch: models::WorkAutoBatch) -> Box + Send> { + self.api().create_work_auto_batch(auto_batch, &self.context()) } - fn delete_work(&self, ident: String, editgroup_id: String) -> Box + Send> { - self.api().delete_work(ident, editgroup_id, &self.context()) + fn delete_work(&self, editgroup_id: String, ident: String) -> Box + Send> { + self.api().delete_work(editgroup_id, ident, &self.context()) } - fn delete_work_edit(&self, edit_id: String) -> Box + Send> { - self.api().delete_work_edit(edit_id, &self.context()) + fn delete_work_edit(&self, editgroup_id: String, edit_id: String) -> Box + Send> { + self.api().delete_work_edit(editgroup_id, edit_id, &self.context()) } fn get_work(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { @@ -2414,8 +2260,8 @@ 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: String) -> Box + Send> { - self.api().update_work(ident, entity, editgroup_id, &self.context()) + fn update_work(&self, editgroup_id: String, ident: String, entity: models::WorkEntity) -> Box + Send> { + self.api().update_work(editgroup_id, ident, entity, &self.context()) } } diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 5c916e47..0676f63b 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -28,29 +28,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateContainerBatch + /// Create Mime objects for the response content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteContainer lazy_static! { @@ -244,29 +244,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateCreatorBatch + /// Create Mime objects for the response content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteCreator lazy_static! { @@ -788,29 +788,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFileBatch + /// Create Mime objects for the response content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFile lazy_static! { @@ -1004,29 +1004,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_FILESET_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateFilesetBatch + /// Create Mime objects for the response content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteFileset lazy_static! { @@ -1204,29 +1204,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateReleaseBatch + /// Create Mime objects for the response content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreateWork lazy_static! { @@ -1492,29 +1492,29 @@ pub mod responses { lazy_static! { pub static ref CREATE_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWebcaptureBatch + /// Create Mime objects for the response content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWebcapture lazy_static! { @@ -1668,29 +1668,29 @@ pub mod responses { lazy_static! { pub static ref UPDATE_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_CREATED_EDITGROUP: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_NOT_AUTHORIZED: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_FORBIDDEN: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_FORBIDDEN: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_NOT_FOUND: Mime = mime!(Application / Json); } - /// Create Mime objects for the response content types for CreateWorkBatch + /// Create Mime objects for the response content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for DeleteWork lazy_static! { @@ -1869,9 +1869,9 @@ pub mod requests { lazy_static! { pub static ref CREATE_CONTAINER: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateContainerBatch + /// Create Mime objects for the request content types for CreateContainerAutoBatch lazy_static! { - pub static ref CREATE_CONTAINER_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_CONTAINER_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateContainer lazy_static! { @@ -1881,9 +1881,9 @@ pub mod requests { lazy_static! { pub static ref CREATE_CREATOR: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateCreatorBatch + /// Create Mime objects for the request content types for CreateCreatorAutoBatch lazy_static! { - pub static ref CREATE_CREATOR_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_CREATOR_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateCreator lazy_static! { @@ -1913,9 +1913,9 @@ pub mod requests { lazy_static! { pub static ref CREATE_FILE: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateFileBatch + /// Create Mime objects for the request content types for CreateFileAutoBatch lazy_static! { - pub static ref CREATE_FILE_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_FILE_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateFile lazy_static! { @@ -1925,9 +1925,9 @@ pub mod requests { lazy_static! { pub static ref CREATE_FILESET: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateFilesetBatch + /// Create Mime objects for the request content types for CreateFilesetAutoBatch lazy_static! { - pub static ref CREATE_FILESET_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_FILESET_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateFileset lazy_static! { @@ -1937,9 +1937,9 @@ pub mod requests { lazy_static! { pub static ref CREATE_RELEASE: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateReleaseBatch + /// Create Mime objects for the request content types for CreateReleaseAutoBatch lazy_static! { - pub static ref CREATE_RELEASE_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_RELEASE_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for CreateWork lazy_static! { @@ -1953,17 +1953,17 @@ pub mod requests { lazy_static! { pub static ref CREATE_WEBCAPTURE: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateWebcaptureBatch + /// Create Mime objects for the request content types for CreateWebcaptureAutoBatch lazy_static! { - pub static ref CREATE_WEBCAPTURE_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_WEBCAPTURE_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateWebcapture lazy_static! { pub static ref UPDATE_WEBCAPTURE: Mime = mime!(Application / Json); } - /// Create Mime objects for the request content types for CreateWorkBatch + /// Create Mime objects for the request content types for CreateWorkAutoBatch lazy_static! { - pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json); + pub static ref CREATE_WORK_AUTO_BATCH: Mime = mime!(Application / Json); } /// Create Mime objects for the request content types for UpdateWork lazy_static! { diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 41b9f95e..ce559ccc 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -77,6 +77,24 @@ impl ChangelogEntry { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct ContainerAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl ContainerAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> ContainerAutoBatch { + ContainerAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ContainerEntity { #[serde(rename = "wikidata_qid")] @@ -148,6 +166,24 @@ impl ContainerEntity { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct CreatorAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl CreatorAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> CreatorAutoBatch { + CreatorAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct CreatorEntity { #[serde(rename = "wikidata_qid")] @@ -495,6 +531,24 @@ impl ErrorResponse { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FileAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl FileAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> FileAutoBatch { + FileAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct FileEntity { #[serde(rename = "release_ids")] @@ -589,6 +643,24 @@ impl FileUrl { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FilesetAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl FilesetAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> FilesetAutoBatch { + FilesetAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct FilesetEntity { #[serde(rename = "release_ids")] @@ -731,6 +803,24 @@ impl ReleaseAbstract { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct ReleaseAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl ReleaseAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> ReleaseAutoBatch { + ReleaseAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ReleaseContrib { #[serde(rename = "index")] @@ -1107,6 +1197,24 @@ impl Success { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl WebcaptureAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> WebcaptureAutoBatch { + WebcaptureAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct WebcaptureCdxLine { #[serde(rename = "surt")] @@ -1239,6 +1347,24 @@ impl WebcaptureUrl { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WorkAutoBatch { + #[serde(rename = "editgroup")] + pub editgroup: models::Editgroup, + + #[serde(rename = "entity_list")] + pub entity_list: Vec, +} + +impl WorkAutoBatch { + pub fn new(editgroup: models::Editgroup, entity_list: Vec) -> WorkAutoBatch { + WorkAutoBatch { + editgroup: editgroup, + entity_list: entity_list, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct WorkEntity { #[serde(rename = "edit_extra")] diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index ffe3347b..102b6e41 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -37,9 +37,9 @@ use swagger::{ApiError, Context, XSpanId}; #[allow(unused_imports)] use models; use { - AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, - CreateEditgroupAnnotationResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, - CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerAutoBatchResponse, CreateContainerResponse, CreateCreatorAutoBatchResponse, CreateCreatorResponse, + CreateEditgroupAnnotationResponse, CreateEditgroupResponse, CreateFileAutoBatchResponse, CreateFileResponse, CreateFilesetAutoBatchResponse, CreateFilesetResponse, CreateReleaseAutoBatchResponse, + CreateReleaseResponse, CreateWebcaptureAutoBatchResponse, CreateWebcaptureResponse, CreateWorkAutoBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, @@ -99,7 +99,7 @@ where { let api_clone = api.clone(); router.post( - "/v0/container", + "/v0/editgroup/:editgroup_id/container", move |req: &mut Request| { let mut context = Context::default(); @@ -114,15 +114,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -149,7 +154,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_container(param_entity, param_editgroup_id, context).wait() { + match api.create_container(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateContainerResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -245,7 +250,7 @@ where let api_clone = api.clone(); router.post( - "/v0/container/batch", + "/v0/editgroup/auto/container/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -260,53 +265,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_container_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_container_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateContainerBatchResponse::CreatedEntities(body) => { + CreateContainerAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -314,11 +304,11 @@ where } Ok(response) } - CreateContainerBatchResponse::BadRequest(body) => { + CreateContainerAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -326,14 +316,14 @@ where } Ok(response) } - CreateContainerBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateContainerAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -341,11 +331,11 @@ where } Ok(response) } - CreateContainerBatchResponse::Forbidden(body) => { + CreateContainerAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -353,11 +343,11 @@ where } Ok(response) } - CreateContainerBatchResponse::NotFound(body) => { + CreateContainerAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -365,11 +355,11 @@ where } Ok(response) } - CreateContainerBatchResponse::GenericError(body) => { + CreateContainerAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -391,12 +381,12 @@ where Ok(response) }) }, - "CreateContainerBatch", + "CreateContainerAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/container/:ident", + "/v0/editgroup/:editgroup_id/container/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -412,6 +402,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -426,17 +429,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_container(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteContainerResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -520,7 +513,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/container/edit/:edit_id", + "/v0/editgroup/:editgroup_id/container/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -536,6 +529,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -550,7 +556,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_container_edit(param_edit_id, context).wait() { + match api.delete_container_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteContainerEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1179,7 +1185,7 @@ where let api_clone = api.clone(); router.put( - "/v0/container/:ident", + "/v0/editgroup/:editgroup_id/container/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -1195,6 +1201,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -1209,16 +1228,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -1244,7 +1253,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_container(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_container(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateContainerResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1340,7 +1349,7 @@ where let api_clone = api.clone(); router.post( - "/v0/creator", + "/v0/editgroup/:editgroup_id/creator", move |req: &mut Request| { let mut context = Context::default(); @@ -1355,15 +1364,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -1390,7 +1404,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_creator(param_entity, param_editgroup_id, context).wait() { + match api.create_creator(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateCreatorResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1486,7 +1500,7 @@ where let api_clone = api.clone(); router.post( - "/v0/creator/batch", + "/v0/editgroup/auto/creator/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -1501,53 +1515,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_creator_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_creator_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateCreatorBatchResponse::CreatedEntities(body) => { + CreateCreatorAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1555,11 +1554,11 @@ where } Ok(response) } - CreateCreatorBatchResponse::BadRequest(body) => { + CreateCreatorAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1567,14 +1566,14 @@ where } Ok(response) } - CreateCreatorBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateCreatorAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1582,11 +1581,11 @@ where } Ok(response) } - CreateCreatorBatchResponse::Forbidden(body) => { + CreateCreatorAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1594,11 +1593,11 @@ where } Ok(response) } - CreateCreatorBatchResponse::NotFound(body) => { + CreateCreatorAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1606,11 +1605,11 @@ where } Ok(response) } - CreateCreatorBatchResponse::GenericError(body) => { + CreateCreatorAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1632,12 +1631,12 @@ where Ok(response) }) }, - "CreateCreatorBatch", + "CreateCreatorAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/creator/:ident", + "/v0/editgroup/:editgroup_id/creator/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -1653,6 +1652,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -1667,17 +1679,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_creator(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteCreatorResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -1761,7 +1763,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/creator/edit/:edit_id", + "/v0/editgroup/:editgroup_id/creator/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -1777,6 +1779,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -1791,7 +1806,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_creator_edit(param_edit_id, context).wait() { + match api.delete_creator_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteCreatorEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -2513,7 +2528,7 @@ where let api_clone = api.clone(); router.put( - "/v0/creator/:ident", + "/v0/editgroup/:editgroup_id/creator/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -2529,6 +2544,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -2543,16 +2571,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -2578,7 +2596,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_creator(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_creator(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateCreatorResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4432,7 +4450,7 @@ where let api_clone = api.clone(); router.post( - "/v0/file", + "/v0/editgroup/:editgroup_id/file", move |req: &mut Request| { let mut context = Context::default(); @@ -4447,15 +4465,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -4482,7 +4505,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_file(param_entity, param_editgroup_id, context).wait() { + match api.create_file(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateFileResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4578,7 +4601,7 @@ where let api_clone = api.clone(); router.post( - "/v0/file/batch", + "/v0/editgroup/auto/file/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -4593,53 +4616,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_file_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_file_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateFileBatchResponse::CreatedEntities(body) => { + CreateFileAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4647,11 +4655,11 @@ where } Ok(response) } - CreateFileBatchResponse::BadRequest(body) => { + CreateFileAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4659,14 +4667,14 @@ where } Ok(response) } - CreateFileBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateFileAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4674,11 +4682,11 @@ where } Ok(response) } - CreateFileBatchResponse::Forbidden(body) => { + CreateFileAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4686,11 +4694,11 @@ where } Ok(response) } - CreateFileBatchResponse::NotFound(body) => { + CreateFileAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4698,11 +4706,11 @@ where } Ok(response) } - CreateFileBatchResponse::GenericError(body) => { + CreateFileAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4724,12 +4732,12 @@ where Ok(response) }) }, - "CreateFileBatch", + "CreateFileAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/file/:ident", + "/v0/editgroup/:editgroup_id/file/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -4745,6 +4753,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -4759,17 +4780,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_file(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteFileResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -4853,7 +4864,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/file/edit/:edit_id", + "/v0/editgroup/:editgroup_id/file/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -4869,6 +4880,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -4883,7 +4907,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_file_edit(param_edit_id, context).wait() { + match api.delete_file_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteFileEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5513,7 +5537,7 @@ where let api_clone = api.clone(); router.put( - "/v0/file/:ident", + "/v0/editgroup/:editgroup_id/file/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -5529,6 +5553,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -5543,16 +5580,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -5578,7 +5605,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_file(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_file(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateFileResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5674,7 +5701,7 @@ where let api_clone = api.clone(); router.post( - "/v0/fileset", + "/v0/editgroup/:editgroup_id/fileset", move |req: &mut Request| { let mut context = Context::default(); @@ -5689,15 +5716,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -5724,7 +5756,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_fileset(param_entity, param_editgroup_id, context).wait() { + match api.create_fileset(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateFilesetResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -5820,7 +5852,7 @@ where let api_clone = api.clone(); router.post( - "/v0/fileset/batch", + "/v0/editgroup/auto/fileset/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -5835,53 +5867,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_fileset_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_fileset_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateFilesetBatchResponse::CreatedEntities(body) => { + CreateFilesetAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5889,11 +5906,11 @@ where } Ok(response) } - CreateFilesetBatchResponse::BadRequest(body) => { + CreateFilesetAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5901,14 +5918,14 @@ where } Ok(response) } - CreateFilesetBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateFilesetAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5916,11 +5933,11 @@ where } Ok(response) } - CreateFilesetBatchResponse::Forbidden(body) => { + CreateFilesetAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5928,11 +5945,11 @@ where } Ok(response) } - CreateFilesetBatchResponse::NotFound(body) => { + CreateFilesetAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5940,11 +5957,11 @@ where } Ok(response) } - CreateFilesetBatchResponse::GenericError(body) => { + CreateFilesetAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5966,12 +5983,12 @@ where Ok(response) }) }, - "CreateFilesetBatch", + "CreateFilesetAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/fileset/:ident", + "/v0/editgroup/:editgroup_id/fileset/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -5987,6 +6004,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -6001,17 +6031,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_fileset(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteFilesetResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6095,7 +6115,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/fileset/edit/:edit_id", + "/v0/editgroup/:editgroup_id/fileset/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -6111,6 +6131,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -6125,7 +6158,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_fileset_edit(param_edit_id, context).wait() { + match api.delete_fileset_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteFilesetEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6673,7 +6706,7 @@ where let api_clone = api.clone(); router.put( - "/v0/fileset/:ident", + "/v0/editgroup/:editgroup_id/fileset/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -6689,6 +6722,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -6703,16 +6749,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -6738,7 +6774,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_fileset(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_fileset(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateFilesetResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6834,7 +6870,7 @@ where let api_clone = api.clone(); router.post( - "/v0/release", + "/v0/editgroup/:editgroup_id/release", move |req: &mut Request| { let mut context = Context::default(); @@ -6849,15 +6885,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -6884,7 +6925,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_release(param_entity, param_editgroup_id, context).wait() { + match api.create_release(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateReleaseResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -6980,7 +7021,7 @@ where let api_clone = api.clone(); router.post( - "/v0/release/batch", + "/v0/editgroup/auto/release/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -6995,53 +7036,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_release_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_release_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateReleaseBatchResponse::CreatedEntities(body) => { + CreateReleaseAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7049,11 +7075,11 @@ where } Ok(response) } - CreateReleaseBatchResponse::BadRequest(body) => { + CreateReleaseAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7061,14 +7087,14 @@ where } Ok(response) } - CreateReleaseBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateReleaseAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7076,11 +7102,11 @@ where } Ok(response) } - CreateReleaseBatchResponse::Forbidden(body) => { + CreateReleaseAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7088,11 +7114,11 @@ where } Ok(response) } - CreateReleaseBatchResponse::NotFound(body) => { + CreateReleaseAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7100,11 +7126,11 @@ where } Ok(response) } - CreateReleaseBatchResponse::GenericError(body) => { + CreateReleaseAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -7126,12 +7152,12 @@ where Ok(response) }) }, - "CreateReleaseBatch", + "CreateReleaseAutoBatch", ); let api_clone = api.clone(); router.post( - "/v0/work", + "/v0/editgroup/:editgroup_id/work", move |req: &mut Request| { let mut context = Context::default(); @@ -7146,15 +7172,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -7181,7 +7212,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_work(param_entity, param_editgroup_id, context).wait() { + match api.create_work(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateWorkResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7277,7 +7308,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/release/:ident", + "/v0/editgroup/:editgroup_id/release/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -7293,6 +7324,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -7307,17 +7351,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_release(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteReleaseResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -7401,7 +7435,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/release/edit/:edit_id", + "/v0/editgroup/:editgroup_id/release/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -7417,6 +7451,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -7431,7 +7478,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_release_edit(param_edit_id, context).wait() { + match api.delete_release_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteReleaseEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8364,7 +8411,7 @@ where let api_clone = api.clone(); router.put( - "/v0/release/:ident", + "/v0/editgroup/:editgroup_id/release/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -8380,6 +8427,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -8394,16 +8454,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -8429,7 +8479,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_release(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_release(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateReleaseResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8525,7 +8575,7 @@ where let api_clone = api.clone(); router.post( - "/v0/webcapture", + "/v0/editgroup/:editgroup_id/webcapture", move |req: &mut Request| { let mut context = Context::default(); @@ -8540,15 +8590,20 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter editgroup_id - doesn't match schema: {}", e))))?; + // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", 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 @@ -8575,7 +8630,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_webcapture(param_entity, param_editgroup_id, context).wait() { + match api.create_webcapture(param_editgroup_id, param_entity, context).wait() { Ok(rsp) => match rsp { CreateWebcaptureResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8671,7 +8726,7 @@ where let api_clone = api.clone(); router.post( - "/v0/webcapture/batch", + "/v0/editgroup/auto/webcapture/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -8686,53 +8741,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_webcapture_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_webcapture_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateWebcaptureBatchResponse::CreatedEntities(body) => { + CreateWebcaptureAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8740,11 +8780,11 @@ where } Ok(response) } - CreateWebcaptureBatchResponse::BadRequest(body) => { + CreateWebcaptureAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8752,14 +8792,14 @@ where } Ok(response) } - CreateWebcaptureBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateWebcaptureAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8767,11 +8807,11 @@ where } Ok(response) } - CreateWebcaptureBatchResponse::Forbidden(body) => { + CreateWebcaptureAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8779,11 +8819,11 @@ where } Ok(response) } - CreateWebcaptureBatchResponse::NotFound(body) => { + CreateWebcaptureAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8791,11 +8831,11 @@ where } Ok(response) } - CreateWebcaptureBatchResponse::GenericError(body) => { + CreateWebcaptureAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -8817,12 +8857,12 @@ where Ok(response) }) }, - "CreateWebcaptureBatch", + "CreateWebcaptureAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/webcapture/:ident", + "/v0/editgroup/:editgroup_id/webcapture/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -8838,6 +8878,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -8852,17 +8905,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_webcapture(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteWebcaptureResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -8946,7 +8989,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/webcapture/edit/:edit_id", + "/v0/editgroup/:editgroup_id/webcapture/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -8962,6 +9005,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -8976,7 +9032,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_webcapture_edit(param_edit_id, context).wait() { + match api.delete_webcapture_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteWebcaptureEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9524,7 +9580,7 @@ where let api_clone = api.clone(); router.put( - "/v0/webcapture/:ident", + "/v0/editgroup/:editgroup_id/webcapture/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -9540,6 +9596,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -9554,16 +9623,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -9589,7 +9648,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_webcapture(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_webcapture(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateWebcaptureResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9685,7 +9744,7 @@ where let api_clone = api.clone(); router.post( - "/v0/work/batch", + "/v0/editgroup/auto/work/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -9700,53 +9759,38 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_autoaccept = query_params - .get("autoaccept") - .and_then(|list| list.first()) - .and_then(|x| Some(x.to_lowercase().parse::())) - .map_or_else(|| Ok(None), |x| x.map(|v| Some(v))) - .map_err(|x| Response::with((status::BadRequest, "unparsable query parameter (expected boolean)".to_string())))?; - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_description = query_params.get("description").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_extra = query_params.get("extra").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. - let param_entity_list = req + let param_auto_batch = req .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - not valid UTF-8: {}", e))))?; let mut unused_elements = Vec::new(); - let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + let param_auto_batch = if let Some(param_auto_batch_raw) = param_auto_batch { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_auto_batch_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_auto_batch: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter auto_batch - doesn't match schema: {}", e))))?; - param_entity_list + param_auto_batch } else { None }; - let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + let param_auto_batch = param_auto_batch.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter auto_batch".to_string())))?; - match api - .create_work_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, param_description, param_extra, context) - .wait() - { + match api.create_work_auto_batch(param_auto_batch, context).wait() { Ok(rsp) => match rsp { - CreateWorkBatchResponse::CreatedEntities(body) => { + CreateWorkAutoBatchResponse::CreatedEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_CREATED_ENTITIES.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_CREATED_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9754,11 +9798,11 @@ where } Ok(response) } - CreateWorkBatchResponse::BadRequest(body) => { + CreateWorkAutoBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9766,14 +9810,14 @@ where } Ok(response) } - CreateWorkBatchResponse::NotAuthorized { body, www_authenticate } => { + CreateWorkAutoBatchResponse::NotAuthorized { body, www_authenticate } => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(401), body_string)); header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] } response.headers.set(ResponseWwwAuthenticate(www_authenticate)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_NOT_AUTHORIZED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_NOT_AUTHORIZED.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9781,11 +9825,11 @@ where } Ok(response) } - CreateWorkBatchResponse::Forbidden(body) => { + CreateWorkAutoBatchResponse::Forbidden(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(403), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_FORBIDDEN.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_FORBIDDEN.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9793,11 +9837,11 @@ where } Ok(response) } - CreateWorkBatchResponse::NotFound(body) => { + CreateWorkAutoBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9805,11 +9849,11 @@ where } Ok(response) } - CreateWorkBatchResponse::GenericError(body) => { + CreateWorkAutoBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_AUTO_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -9831,12 +9875,12 @@ where Ok(response) }) }, - "CreateWorkBatch", + "CreateWorkAutoBatch", ); let api_clone = api.clone(); router.delete( - "/v0/work/:ident", + "/v0/editgroup/:editgroup_id/work/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -9852,6 +9896,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -9866,17 +9923,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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() { + match api.delete_work(param_editgroup_id, param_ident, context).wait() { Ok(rsp) => match rsp { DeleteWorkResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -9960,7 +10007,7 @@ where let api_clone = api.clone(); router.delete( - "/v0/work/edit/:edit_id", + "/v0/editgroup/:editgroup_id/work/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -9976,6 +10023,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_edit_id = { let param = req .extensions @@ -9990,7 +10050,7 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_work_edit(param_edit_id, context).wait() { + match api.delete_work_edit(param_editgroup_id, param_edit_id, context).wait() { Ok(rsp) => match rsp { DeleteWorkEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); @@ -10631,7 +10691,7 @@ where let api_clone = api.clone(); router.put( - "/v0/work/:ident", + "/v0/editgroup/:editgroup_id/work/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -10647,6 +10707,19 @@ where let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?; // Path parameters + let param_editgroup_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("editgroup_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editgroup_id: {}", e))))? + }; let param_ident = { let param = req .extensions @@ -10661,16 +10734,6 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_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::() - .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 // any unused fields. @@ -10696,7 +10759,7 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_work(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_work(param_editgroup_id, param_ident, param_entity, context).wait() { Ok(rsp) => match rsp { UpdateWorkResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); -- cgit v1.2.3