summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r--rust/fatcat-api-spec/src/client.rs21
-rw-r--r--rust/fatcat-api-spec/src/lib.rs6
-rw-r--r--rust/fatcat-api-spec/src/mimetypes.rs12
-rw-r--r--rust/fatcat-api-spec/src/server.rs32
4 files changed, 71 insertions, 0 deletions
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index 5937b7f2..c5cf4297 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -2570,6 +2570,13 @@ impl Api for Client {
Ok(CreateEditgroupResponse::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::<models::ErrorResponse>(&buf)?;
+
+ Ok(CreateEditgroupResponse::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)))?;
@@ -2619,6 +2626,13 @@ impl Api for Client {
Ok(GetChangelogResponse::Success(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::ErrorResponse>(&buf)?;
+
+ Ok(GetChangelogResponse::BadRequest(body))
+ }
500 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
@@ -2669,6 +2683,13 @@ impl Api for Client {
Ok(GetChangelogEntryResponse::FoundChangelogEntry(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::ErrorResponse>(&buf)?;
+
+ Ok(GetChangelogEntryResponse::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)))?;
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs
index cd281a3d..3f1afa67 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -448,6 +448,8 @@ pub enum CreateEditgroupResponse {
NotAuthorized { body: models::ErrorResponse, www_authenticate: String },
/// Forbidden
Forbidden(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
@@ -456,6 +458,8 @@ pub enum CreateEditgroupResponse {
pub enum GetChangelogResponse {
/// Success
Success(Vec<models::ChangelogEntry>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
@@ -464,6 +468,8 @@ pub enum GetChangelogResponse {
pub enum GetChangelogEntryResponse {
/// Found Changelog Entry
FoundChangelogEntry(models::ChangelogEntry),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs
index 83add9e3..11159610 100644
--- a/rust/fatcat-api-spec/src/mimetypes.rs
+++ b/rust/fatcat-api-spec/src/mimetypes.rs
@@ -602,6 +602,10 @@ pub mod responses {
}
/// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
+ pub static ref CREATE_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroup
+ lazy_static! {
pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetChangelog
@@ -610,6 +614,10 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetChangelog
lazy_static! {
+ pub static ref GET_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetChangelog
+ lazy_static! {
pub static ref GET_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetChangelogEntry
@@ -618,6 +626,10 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetChangelogEntry
lazy_static! {
+ pub static ref GET_CHANGELOG_ENTRY_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetChangelogEntry
+ lazy_static! {
pub static ref GET_CHANGELOG_ENTRY_NOT_FOUND: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetChangelogEntry
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs
index 2f1c5d27..03875a38 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -3431,6 +3431,18 @@ where
}
Ok(response)
}
+ CreateEditgroupResponse::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_EDITGROUP_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)
+ }
CreateEditgroupResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -3491,6 +3503,16 @@ where
Ok(response)
}
+ GetChangelogResponse::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::GET_CHANGELOG_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
GetChangelogResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -3560,6 +3582,16 @@ where
Ok(response)
}
+ GetChangelogEntryResponse::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::GET_CHANGELOG_ENTRY_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
GetChangelogEntryResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");