diff options
Diffstat (limited to 'rust/fatcat-api/src')
-rw-r--r-- | rust/fatcat-api/src/client.rs | 164 | ||||
-rw-r--r-- | rust/fatcat-api/src/lib.rs | 238 | ||||
-rw-r--r-- | rust/fatcat-api/src/mimetypes.rs | 134 | ||||
-rw-r--r-- | rust/fatcat-api/src/server.rs | 310 |
4 files changed, 537 insertions, 309 deletions
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs index 6666d6f4..f4b9e671 100644 --- a/rust/fatcat-api/src/client.rs +++ b/rust/fatcat-api/src/client.rs @@ -180,7 +180,7 @@ 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::<models::ContainerEntity>(&buf)?; - Ok(ContainerIdGetResponse::FetchASingleContainerById(body)) + Ok(ContainerIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -189,12 +189,19 @@ impl Api for Client { Ok(ContainerIdGetResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(ContainerIdGetResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(ContainerIdGetResponse::GenericErrorResponse(body)) + Ok(ContainerIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -236,7 +243,7 @@ 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::<models::ContainerEntity>(&buf)?; - Ok(ContainerLookupGetResponse::FindASingleContainerByExternalIdentifer(body)) + Ok(ContainerLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -250,14 +257,14 @@ 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::<models::Error>(&buf)?; - Ok(ContainerLookupGetResponse::NoSuchContainer(body)) + Ok(ContainerLookupGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(ContainerLookupGetResponse::GenericErrorResponse(body)) + Ok(ContainerLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -301,7 +308,7 @@ 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::<models::EntityEdit>(&buf)?; - Ok(ContainerPostResponse::Created(body)) + Ok(ContainerPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -310,12 +317,19 @@ impl Api for Client { Ok(ContainerPostResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(ContainerPostResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(ContainerPostResponse::GenericErrorResponse(body)) + Ok(ContainerPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -354,7 +368,7 @@ 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::<models::CreatorEntity>(&buf)?; - Ok(CreatorIdGetResponse::FetchASingleCreatorById(body)) + Ok(CreatorIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -363,12 +377,19 @@ impl Api for Client { Ok(CreatorIdGetResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(CreatorIdGetResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(CreatorIdGetResponse::GenericErrorResponse(body)) + Ok(CreatorIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -410,7 +431,7 @@ 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::<models::CreatorEntity>(&buf)?; - Ok(CreatorLookupGetResponse::FindASingleCreatorByExternalIdentifer(body)) + Ok(CreatorLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -424,14 +445,14 @@ 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::<models::Error>(&buf)?; - Ok(CreatorLookupGetResponse::NoSuchCreator(body)) + Ok(CreatorLookupGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(CreatorLookupGetResponse::GenericErrorResponse(body)) + Ok(CreatorLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -475,7 +496,7 @@ 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::<models::EntityEdit>(&buf)?; - Ok(CreatorPostResponse::Created(body)) + Ok(CreatorPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -484,12 +505,19 @@ impl Api for Client { Ok(CreatorPostResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(CreatorPostResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(CreatorPostResponse::GenericErrorResponse(body)) + Ok(CreatorPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -528,28 +556,28 @@ 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::<models::Success>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::MergedEditgroupSuccessfully_(body)) + Ok(EditgroupIdAcceptPostResponse::MergedSuccessfully(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::<models::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::EditgroupIsInAnUnmergableState(body)) + Ok(EditgroupIdAcceptPostResponse::Unmergable(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::<models::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::NoSuchEditgroup(body)) + Ok(EditgroupIdAcceptPostResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::GenericErrorResponse(body)) + Ok(EditgroupIdAcceptPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -588,21 +616,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::<models::Editgroup>(&buf)?; - Ok(EditgroupIdGetResponse::FetchEditgroupByIdentifier(body)) + Ok(EditgroupIdGetResponse::FoundEditgroup(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::<models::Error>(&buf)?; - Ok(EditgroupIdGetResponse::NoSuchEditgroup(body)) + Ok(EditgroupIdGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(EditgroupIdGetResponse::GenericErrorResponse(body)) + Ok(EditgroupIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -648,14 +676,14 @@ 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::<models::Error>(&buf)?; - Ok(EditgroupPostResponse::InvalidRequestParameters(body)) + Ok(EditgroupPostResponse::BadRequest(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(EditgroupPostResponse::GenericErrorResponse(body)) + Ok(EditgroupPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -698,21 +726,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::<models::Changelogentry>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::FindChanges_(body)) + Ok(EditorUsernameChangelogGetResponse::FoundMergedChanges(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::<models::Error>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::UsernameNotFound(body)) + Ok(EditorUsernameChangelogGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::GenericErrorResponse(body)) + Ok(EditorUsernameChangelogGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -755,21 +783,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::<models::Editor>(&buf)?; - Ok(EditorUsernameGetResponse::FetchGenericInformationAboutAnEditor(body)) + Ok(EditorUsernameGetResponse::FoundEditor(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::<models::Error>(&buf)?; - Ok(EditorUsernameGetResponse::UsernameNotFound(body)) + Ok(EditorUsernameGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(EditorUsernameGetResponse::GenericErrorResponse(body)) + Ok(EditorUsernameGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -808,7 +836,7 @@ 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::<models::FileEntity>(&buf)?; - Ok(FileIdGetResponse::FetchASingleFileById(body)) + Ok(FileIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -817,12 +845,19 @@ impl Api for Client { Ok(FileIdGetResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(FileIdGetResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(FileIdGetResponse::GenericErrorResponse(body)) + Ok(FileIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -864,7 +899,7 @@ 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::<models::FileEntity>(&buf)?; - Ok(FileLookupGetResponse::FindASingleFileByExternalIdentifer(body)) + Ok(FileLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -878,14 +913,14 @@ 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::<models::Error>(&buf)?; - Ok(FileLookupGetResponse::NoSuchFile(body)) + Ok(FileLookupGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(FileLookupGetResponse::GenericErrorResponse(body)) + Ok(FileLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -929,7 +964,7 @@ 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::<models::EntityEdit>(&buf)?; - Ok(FilePostResponse::Created(body)) + Ok(FilePostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -938,12 +973,19 @@ impl Api for Client { Ok(FilePostResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(FilePostResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(FilePostResponse::GenericErrorResponse(body)) + Ok(FilePostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -982,7 +1024,7 @@ 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::<models::ReleaseEntity>(&buf)?; - Ok(ReleaseIdGetResponse::FetchASingleReleaseById(body)) + Ok(ReleaseIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -991,12 +1033,19 @@ impl Api for Client { Ok(ReleaseIdGetResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(ReleaseIdGetResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(ReleaseIdGetResponse::GenericErrorResponse(body)) + Ok(ReleaseIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1038,7 +1087,7 @@ 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::<models::ReleaseEntity>(&buf)?; - Ok(ReleaseLookupGetResponse::FindASingleReleaseByExternalIdentifer(body)) + Ok(ReleaseLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -1052,14 +1101,14 @@ 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::<models::Error>(&buf)?; - Ok(ReleaseLookupGetResponse::NoSuchRelease(body)) + Ok(ReleaseLookupGetResponse::NotFound(body)) } 0 => { 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::<models::Error>(&buf)?; - Ok(ReleaseLookupGetResponse::GenericErrorResponse(body)) + Ok(ReleaseLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1103,7 +1152,7 @@ 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::<models::EntityEdit>(&buf)?; - Ok(ReleasePostResponse::Created(body)) + Ok(ReleasePostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -1112,12 +1161,19 @@ impl Api for Client { Ok(ReleasePostResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(ReleasePostResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(ReleasePostResponse::GenericErrorResponse(body)) + Ok(ReleasePostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1156,7 +1212,7 @@ 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::<models::WorkEntity>(&buf)?; - Ok(WorkIdGetResponse::FetchASingleWorkById(body)) + Ok(WorkIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -1165,12 +1221,19 @@ impl Api for Client { Ok(WorkIdGetResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(WorkIdGetResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(WorkIdGetResponse::GenericErrorResponse(body)) + Ok(WorkIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1214,7 +1277,7 @@ 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::<models::EntityEdit>(&buf)?; - Ok(WorkPostResponse::Created(body)) + Ok(WorkPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -1223,12 +1286,19 @@ impl Api for Client { Ok(WorkPostResponse::BadRequest(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::<models::Error>(&buf)?; + + Ok(WorkPostResponse::NotFound(body)) + } 0 => { 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::<models::Error>(&buf)?; - Ok(WorkPostResponse::GenericErrorResponse(body)) + Ok(WorkPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs index 151c3a4a..17dd6c76 100644 --- a/rust/fatcat-api/src/lib.rs +++ b/rust/fatcat-api/src/lib.rs @@ -34,202 +34,222 @@ pub use swagger::{ApiError, Context, ContextWrapper}; #[derive(Debug, PartialEq)] pub enum ContainerIdGetResponse { - /// fetch a single container by id - FetchASingleContainerById(models::ContainerEntity), - /// bad request + /// Found Entity + FoundEntity(models::ContainerEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ContainerLookupGetResponse { - /// find a single container by external identifer - FindASingleContainerByExternalIdentifer(models::ContainerEntity), - /// bad request + /// Found Entity + FoundEntity(models::ContainerEntity), + /// Bad Request BadRequest(models::Error), - /// no such container - NoSuchContainer(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ContainerPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorIdGetResponse { - /// fetch a single creator by id - FetchASingleCreatorById(models::CreatorEntity), - /// bad request + /// Found Entity + FoundEntity(models::CreatorEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorLookupGetResponse { - /// find a single creator by external identifer - FindASingleCreatorByExternalIdentifer(models::CreatorEntity), - /// bad request + /// Found Entity + FoundEntity(models::CreatorEntity), + /// Bad Request BadRequest(models::Error), - /// no such creator - NoSuchCreator(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupIdAcceptPostResponse { - /// merged editgroup successfully (\"live\") - MergedEditgroupSuccessfully_(models::Success), - /// editgroup is in an unmergable state - EditgroupIsInAnUnmergableState(models::Error), - /// no such editgroup - NoSuchEditgroup(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Merged Successfully + MergedSuccessfully(models::Success), + /// Unmergable + Unmergable(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupIdGetResponse { - /// fetch editgroup by identifier - FetchEditgroupByIdentifier(models::Editgroup), - /// no such editgroup - NoSuchEditgroup(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Editgroup + FoundEditgroup(models::Editgroup), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupPostResponse { - /// successfully created + /// Successfully Created SuccessfullyCreated(models::Editgroup), - /// invalid request parameters - InvalidRequestParameters(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Bad Request + BadRequest(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditorUsernameChangelogGetResponse { - /// find changes (editgroups) by this editor which have been merged - FindChanges_(models::Changelogentry), - /// username not found - UsernameNotFound(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Merged Changes + FoundMergedChanges(models::Changelogentry), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditorUsernameGetResponse { - /// fetch generic information about an editor - FetchGenericInformationAboutAnEditor(models::Editor), - /// username not found - UsernameNotFound(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Editor + FoundEditor(models::Editor), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FileIdGetResponse { - /// fetch a single file by id - FetchASingleFileById(models::FileEntity), - /// bad request + /// Found Entity + FoundEntity(models::FileEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FileLookupGetResponse { - /// find a single file by external identifer - FindASingleFileByExternalIdentifer(models::FileEntity), - /// bad request + /// Found Entity + FoundEntity(models::FileEntity), + /// Bad Request BadRequest(models::Error), - /// no such file - NoSuchFile(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FilePostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleaseIdGetResponse { - /// fetch a single release by id - FetchASingleReleaseById(models::ReleaseEntity), - /// bad request + /// Found Entity + FoundEntity(models::ReleaseEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleaseLookupGetResponse { - /// find a single release by external identifer - FindASingleReleaseByExternalIdentifer(models::ReleaseEntity), - /// bad request + /// Found Entity + FoundEntity(models::ReleaseEntity), + /// Bad Request BadRequest(models::Error), - /// no such release - NoSuchRelease(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleasePostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum WorkIdGetResponse { - /// fetch a single work by id - FetchASingleWorkById(models::WorkEntity), - /// bad request + /// Found Entity + FoundEntity(models::WorkEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum WorkPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } /// API diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs index cc362421..9d3d91a8 100644 --- a/rust/fatcat-api/src/mimetypes.rs +++ b/rust/fatcat-api/src/mimetypes.rs @@ -6,7 +6,7 @@ pub mod responses { // The macro is called per-operation to beat the recursion limit /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { - pub static ref CONTAINER_ID_GET_FETCH_A_SINGLE_CONTAINER_BY_ID: Mime = mime!(Application / Json); + pub static ref CONTAINER_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { @@ -14,11 +14,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { - pub static ref CONTAINER_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ContainerIdGet + lazy_static! { + pub static ref CONTAINER_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_FIND_A_SINGLE_CONTAINER_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { @@ -26,15 +30,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_NO_SUCH_CONTAINER: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerPost lazy_static! { - pub static ref CONTAINER_POST_CREATED: Mime = mime!(Application / Json); + pub static ref CONTAINER_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerPost lazy_static! { @@ -42,11 +46,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerPost lazy_static! { - pub static ref CONTAINER_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ContainerPost + lazy_static! { + pub static ref CONTAINER_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { - pub static ref CREATOR_ID_GET_FETCH_A_SINGLE_CREATOR_BY_ID: Mime = mime!(Application / Json); + pub static ref CREATOR_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { @@ -54,11 +62,15 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { - pub static ref CREATOR_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreatorIdGet + lazy_static! { + pub static ref CREATOR_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_FIND_A_SINGLE_CREATOR_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { @@ -66,15 +78,15 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_NO_SUCH_CREATOR: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorPost lazy_static! { - pub static ref CREATOR_POST_CREATED: Mime = mime!(Application / Json); + pub static ref CREATOR_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorPost lazy_static! { @@ -82,35 +94,39 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorPost lazy_static! { - pub static ref CREATOR_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreatorPost + lazy_static! { + pub static ref CREATOR_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_EDITGROUP_SUCCESSFULLY_: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_EDITGROUP_IS_IN_AN_UNMERGABLE_STATE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_UNMERGABLE: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_NO_SUCH_EDITGROUP: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_FETCH_EDITGROUP_BY_IDENTIFIER: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_FOUND_EDITGROUP: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_NO_SUCH_EDITGROUP: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { @@ -118,39 +134,39 @@ pub mod responses { } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { - pub static ref EDITGROUP_POST_INVALID_REQUEST_PARAMETERS: Mime = mime!(Application / Json); + pub static ref EDITGROUP_POST_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { - pub static ref EDITGROUP_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_FIND_CHANGES_: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_USERNAME_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_FETCH_GENERIC_INFORMATION_ABOUT_AN_EDITOR: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_FOUND_EDITOR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_USERNAME_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileIdGet lazy_static! { - pub static ref FILE_ID_GET_FETCH_A_SINGLE_FILE_BY_ID: Mime = mime!(Application / Json); + pub static ref FILE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileIdGet lazy_static! { @@ -158,11 +174,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FileIdGet lazy_static! { - pub static ref FILE_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for FileIdGet + lazy_static! { + pub static ref FILE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_FIND_A_SINGLE_FILE_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { @@ -170,15 +190,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_NO_SUCH_FILE: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FilePost lazy_static! { - pub static ref FILE_POST_CREATED: Mime = mime!(Application / Json); + pub static ref FILE_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FilePost lazy_static! { @@ -186,11 +206,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FilePost lazy_static! { - pub static ref FILE_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for FilePost + lazy_static! { + pub static ref FILE_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { - pub static ref RELEASE_ID_GET_FETCH_A_SINGLE_RELEASE_BY_ID: Mime = mime!(Application / Json); + pub static ref RELEASE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { @@ -198,11 +222,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { - pub static ref RELEASE_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ReleaseIdGet + lazy_static! { + pub static ref RELEASE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_FIND_A_SINGLE_RELEASE_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { @@ -210,15 +238,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_NO_SUCH_RELEASE: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleasePost lazy_static! { - pub static ref RELEASE_POST_CREATED: Mime = mime!(Application / Json); + pub static ref RELEASE_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleasePost lazy_static! { @@ -226,11 +254,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleasePost lazy_static! { - pub static ref RELEASE_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ReleasePost + lazy_static! { + pub static ref RELEASE_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { - pub static ref WORK_ID_GET_FETCH_A_SINGLE_WORK_BY_ID: Mime = mime!(Application / Json); + pub static ref WORK_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { @@ -238,11 +270,15 @@ pub mod responses { } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { - pub static ref WORK_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref WORK_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for WorkIdGet + lazy_static! { + pub static ref WORK_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkPost lazy_static! { - pub static ref WORK_POST_CREATED: Mime = mime!(Application / Json); + pub static ref WORK_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkPost lazy_static! { @@ -250,7 +286,11 @@ pub mod responses { } /// Create Mime objects for the response content types for WorkPost lazy_static! { - pub static ref WORK_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref WORK_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for WorkPost + lazy_static! { + pub static ref WORK_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } } diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs index 94668aa9..090c45e3 100644 --- a/rust/fatcat-api/src/server.rs +++ b/rust/fatcat-api/src/server.rs @@ -116,11 +116,11 @@ where match api.container_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - ContainerIdGetResponse::FetchASingleContainerById(body) => { + ContainerIdGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_FETCH_A_SINGLE_CONTAINER_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -136,11 +136,21 @@ where Ok(response) } - ContainerIdGetResponse::GenericErrorResponse(body) => { + ContainerIdGetResponse::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::CONTAINER_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + ContainerIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -190,13 +200,11 @@ where match api.container_lookup_get(param_issn, context).wait() { Ok(rsp) => match rsp { - ContainerLookupGetResponse::FindASingleContainerByExternalIdentifer(body) => { + ContainerLookupGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response - .headers - .set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_FIND_A_SINGLE_CONTAINER_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -212,21 +220,21 @@ where Ok(response) } - ContainerLookupGetResponse::NoSuchContainer(body) => { + ContainerLookupGetResponse::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::CONTAINER_LOOKUP_GET_NO_SUCH_CONTAINER.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - ContainerLookupGetResponse::GenericErrorResponse(body) => { + ContainerLookupGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -290,11 +298,11 @@ where match api.container_post(param_body, context).wait() { Ok(rsp) => match rsp { - ContainerPostResponse::Created(body) => { + ContainerPostResponse::CreatedEntity(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::CONTAINER_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -314,11 +322,23 @@ where } Ok(response) } - ContainerPostResponse::GenericErrorResponse(body) => { + ContainerPostResponse::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::CONTAINER_POST_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + ContainerPostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -374,11 +394,11 @@ where match api.creator_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - CreatorIdGetResponse::FetchASingleCreatorById(body) => { + CreatorIdGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_FETCH_A_SINGLE_CREATOR_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -394,11 +414,21 @@ where Ok(response) } - CreatorIdGetResponse::GenericErrorResponse(body) => { + CreatorIdGetResponse::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::CREATOR_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + CreatorIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -448,13 +478,11 @@ where match api.creator_lookup_get(param_orcid, context).wait() { Ok(rsp) => match rsp { - CreatorLookupGetResponse::FindASingleCreatorByExternalIdentifer(body) => { + CreatorLookupGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response - .headers - .set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_FIND_A_SINGLE_CREATOR_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -470,21 +498,21 @@ where Ok(response) } - CreatorLookupGetResponse::NoSuchCreator(body) => { + CreatorLookupGetResponse::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::CREATOR_LOOKUP_GET_NO_SUCH_CREATOR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - CreatorLookupGetResponse::GenericErrorResponse(body) => { + CreatorLookupGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -547,11 +575,11 @@ where match api.creator_post(param_body, context).wait() { Ok(rsp) => match rsp { - CreatorPostResponse::Created(body) => { + CreatorPostResponse::CreatedEntity(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::CREATOR_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -571,11 +599,23 @@ where } Ok(response) } - CreatorPostResponse::GenericErrorResponse(body) => { + CreatorPostResponse::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::CREATOR_POST_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreatorPostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -631,43 +671,41 @@ where match api.editgroup_id_accept_post(param_id, context).wait() { Ok(rsp) => match rsp { - EditgroupIdAcceptPostResponse::MergedEditgroupSuccessfully_(body) => { + EditgroupIdAcceptPostResponse::MergedSuccessfully(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_MERGED_EDITGROUP_SUCCESSFULLY_.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::EditgroupIsInAnUnmergableState(body) => { + EditgroupIdAcceptPostResponse::Unmergable(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::EDITGROUP_ID_ACCEPT_POST_EDITGROUP_IS_IN_AN_UNMERGABLE_STATE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_UNMERGABLE.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::NoSuchEditgroup(body) => { + EditgroupIdAcceptPostResponse::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::EDITGROUP_ID_ACCEPT_POST_NO_SUCH_EDITGROUP.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::GenericErrorResponse(body) => { + EditgroupIdAcceptPostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -721,31 +759,31 @@ where match api.editgroup_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - EditgroupIdGetResponse::FetchEditgroupByIdentifier(body) => { + EditgroupIdGetResponse::FoundEditgroup(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FETCH_EDITGROUP_BY_IDENTIFIER.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FOUND_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdGetResponse::NoSuchEditgroup(body) => { + EditgroupIdGetResponse::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::EDITGROUP_ID_GET_NO_SUCH_EDITGROUP.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdGetResponse::GenericErrorResponse(body) => { + EditgroupIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -795,21 +833,21 @@ where Ok(response) } - EditgroupPostResponse::InvalidRequestParameters(body) => { + EditgroupPostResponse::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::EDITGROUP_POST_INVALID_REQUEST_PARAMETERS.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupPostResponse::GenericErrorResponse(body) => { + EditgroupPostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -863,31 +901,31 @@ where match api.editor_username_changelog_get(param_username, context).wait() { Ok(rsp) => match rsp { - EditorUsernameChangelogGetResponse::FindChanges_(body) => { + EditorUsernameChangelogGetResponse::FoundMergedChanges(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_FIND_CHANGES_.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameChangelogGetResponse::UsernameNotFound(body) => { + EditorUsernameChangelogGetResponse::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::EDITOR_USERNAME_CHANGELOG_GET_USERNAME_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameChangelogGetResponse::GenericErrorResponse(body) => { + EditorUsernameChangelogGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -941,33 +979,31 @@ where match api.editor_username_get(param_username, context).wait() { Ok(rsp) => match rsp { - EditorUsernameGetResponse::FetchGenericInformationAboutAnEditor(body) => { + EditorUsernameGetResponse::FoundEditor(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response - .headers - .set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_FETCH_GENERIC_INFORMATION_ABOUT_AN_EDITOR.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_FOUND_EDITOR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameGetResponse::UsernameNotFound(body) => { + EditorUsernameGetResponse::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::EDITOR_USERNAME_GET_USERNAME_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameGetResponse::GenericErrorResponse(body) => { + EditorUsernameGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1021,11 +1057,11 @@ where match api.file_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - FileIdGetResponse::FetchASingleFileById(body) => { + FileIdGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_FETCH_A_SINGLE_FILE_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1041,11 +1077,21 @@ where Ok(response) } - FileIdGetResponse::GenericErrorResponse(body) => { + FileIdGetResponse::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::FILE_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + FileIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1095,13 +1141,11 @@ where match api.file_lookup_get(param_sha1, context).wait() { Ok(rsp) => match rsp { - FileLookupGetResponse::FindASingleFileByExternalIdentifer(body) => { + FileLookupGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response - .headers - .set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_FIND_A_SINGLE_FILE_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1117,21 +1161,21 @@ where Ok(response) } - FileLookupGetResponse::NoSuchFile(body) => { + FileLookupGetResponse::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::FILE_LOOKUP_GET_NO_SUCH_FILE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - FileLookupGetResponse::GenericErrorResponse(body) => { + FileLookupGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1194,11 +1238,11 @@ where match api.file_post(param_body, context).wait() { Ok(rsp) => match rsp { - FilePostResponse::Created(body) => { + FilePostResponse::CreatedEntity(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::FILE_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1218,11 +1262,23 @@ where } Ok(response) } - FilePostResponse::GenericErrorResponse(body) => { + FilePostResponse::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::FILE_POST_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + FilePostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::FILE_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1278,11 +1334,11 @@ where match api.release_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - ReleaseIdGetResponse::FetchASingleReleaseById(body) => { + ReleaseIdGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_FETCH_A_SINGLE_RELEASE_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1298,11 +1354,21 @@ where Ok(response) } - ReleaseIdGetResponse::GenericErrorResponse(body) => { + ReleaseIdGetResponse::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::RELEASE_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + ReleaseIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1352,13 +1418,11 @@ where match api.release_lookup_get(param_doi, context).wait() { Ok(rsp) => match rsp { - ReleaseLookupGetResponse::FindASingleReleaseByExternalIdentifer(body) => { + ReleaseLookupGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response - .headers - .set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_FIND_A_SINGLE_RELEASE_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1374,21 +1438,21 @@ where Ok(response) } - ReleaseLookupGetResponse::NoSuchRelease(body) => { + ReleaseLookupGetResponse::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::RELEASE_LOOKUP_GET_NO_SUCH_RELEASE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - ReleaseLookupGetResponse::GenericErrorResponse(body) => { + ReleaseLookupGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1451,11 +1515,11 @@ where match api.release_post(param_body, context).wait() { Ok(rsp) => match rsp { - ReleasePostResponse::Created(body) => { + ReleasePostResponse::CreatedEntity(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::RELEASE_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1475,11 +1539,23 @@ where } Ok(response) } - ReleasePostResponse::GenericErrorResponse(body) => { + ReleasePostResponse::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::RELEASE_POST_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + ReleasePostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1535,11 +1611,11 @@ where match api.work_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - WorkIdGetResponse::FetchASingleWorkById(body) => { + WorkIdGetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_FETCH_A_SINGLE_WORK_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1555,11 +1631,21 @@ where Ok(response) } - WorkIdGetResponse::GenericErrorResponse(body) => { + WorkIdGetResponse::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::WORK_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + WorkIdGetResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1622,11 +1708,11 @@ where match api.work_post(param_body, context).wait() { Ok(rsp) => match rsp { - WorkPostResponse::Created(body) => { + WorkPostResponse::CreatedEntity(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::WORK_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1646,11 +1732,23 @@ where } Ok(response) } - WorkPostResponse::GenericErrorResponse(body) => { + WorkPostResponse::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::WORK_POST_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + WorkPostResponse::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(0), body_string)); - response.headers.set(ContentType(mimetypes::responses::WORK_POST_GENERIC_ERROR_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { |