aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-10 19:29:47 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-10 19:29:47 -0700
commitbed2d170a205df1356826d3fead3efa9991137a9 (patch)
treeaf353f16637d2a5e0db9a9543a97bb1cb2461958 /rust/fatcat-api
parentc6b4ccfb8b5796a632b3d7a469b7658eeed070c0 (diff)
downloadfatcat-bed2d170a205df1356826d3fead3efa9991137a9.tar.gz
fatcat-bed2d170a205df1356826d3fead3efa9991137a9.zip
re-gen rust code
Diffstat (limited to 'rust/fatcat-api')
-rw-r--r--rust/fatcat-api/README.md2
-rw-r--r--rust/fatcat-api/api.yaml20
-rw-r--r--rust/fatcat-api/api/swagger.yaml54
-rw-r--r--rust/fatcat-api/src/client.rs26
-rw-r--r--rust/fatcat-api/src/lib.rs28
-rw-r--r--rust/fatcat-api/src/mimetypes.rs20
-rw-r--r--rust/fatcat-api/src/server.rs44
7 files changed, 133 insertions, 61 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md
index c971b88c..1b566766 100644
--- a/rust/fatcat-api/README.md
+++ b/rust/fatcat-api/README.md
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 0.1.0
-- Build date: 2018-09-08T04:52:59.479Z
+- Build date: 2018-09-11T02:27:08.863Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml
index a8919216..2b0615d2 100644
--- a/rust/fatcat-api/api.yaml
+++ b/rust/fatcat-api/api.yaml
@@ -671,7 +671,7 @@ paths:
operationId: "get_creator_releases"
responses:
200:
- description: Found Entity
+ description: Found
schema:
type: array
items:
@@ -939,7 +939,7 @@ paths:
operationId: "get_release_files"
responses:
200:
- description: Found Entity
+ description: Found
schema:
type: array
items:
@@ -1081,7 +1081,7 @@ paths:
operationId: "get_work_releases"
responses:
200:
- description: Found Entity
+ description: Found
schema:
type: array
items:
@@ -1097,9 +1097,13 @@ paths:
operationId: "get_editor"
responses:
200:
- description: Found Editor
+ description: Found
schema:
$ref: "#/definitions/editor"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
404:
description: Not Found
schema:
@@ -1118,11 +1122,15 @@ paths:
operationId: "get_editor_changelog"
responses:
200:
- description: Found Merged Changes
+ description: Found
schema:
type: array
items:
$ref: "#/definitions/changelog_entry"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
404:
description: Not Found
schema:
@@ -1163,7 +1171,7 @@ paths:
operationId: "get_editgroup"
responses:
200:
- description: Found Entity
+ description: Found
schema:
$ref: "#/definitions/editgroup"
400:
diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml
index 0b1ca88a..9bc84351 100644
--- a/rust/fatcat-api/api/swagger.yaml
+++ b/rust/fatcat-api/api/swagger.yaml
@@ -834,13 +834,13 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Entity"
+ description: "Found"
schema:
type: "array"
items:
$ref: "#/definitions/release_entity"
- x-responseId: "FoundEntity"
- x-uppercaseResponseId: "FOUND_ENTITY"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_CREATOR_RELEASES"
uppercase_data_type: "VEC<RELEASEENTITY>"
producesJson: true
@@ -1749,13 +1749,13 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Entity"
+ description: "Found"
schema:
type: "array"
items:
$ref: "#/definitions/file_entity"
- x-responseId: "FoundEntity"
- x-uppercaseResponseId: "FOUND_ENTITY"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_RELEASE_FILES"
uppercase_data_type: "VEC<FILEENTITY>"
producesJson: true
@@ -2232,13 +2232,13 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Entity"
+ description: "Found"
schema:
type: "array"
items:
$ref: "#/definitions/release_entity"
- x-responseId: "FoundEntity"
- x-uppercaseResponseId: "FOUND_ENTITY"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_WORK_RELEASES"
uppercase_data_type: "VEC<RELEASEENTITY>"
producesJson: true
@@ -2286,14 +2286,23 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Editor"
+ description: "Found"
schema:
$ref: "#/definitions/editor"
- x-responseId: "FoundEditor"
- x-uppercaseResponseId: "FOUND_EDITOR"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_EDITOR"
uppercase_data_type: "EDITOR"
producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_EDITOR"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
404:
description: "Not Found"
schema:
@@ -2329,16 +2338,25 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Merged Changes"
+ description: "Found"
schema:
type: "array"
items:
$ref: "#/definitions/changelog_entry"
- x-responseId: "FoundMergedChanges"
- x-uppercaseResponseId: "FOUND_MERGED_CHANGES"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_EDITOR_CHANGELOG"
uppercase_data_type: "VEC<CHANGELOGENTRY>"
producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_EDITOR_CHANGELOG"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
404:
description: "Not Found"
schema:
@@ -2428,11 +2446,11 @@ paths:
example: "\"id_example\".to_string()"
responses:
200:
- description: "Found Entity"
+ description: "Found"
schema:
$ref: "#/definitions/editgroup"
- x-responseId: "FoundEntity"
- x-uppercaseResponseId: "FOUND_ENTITY"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
uppercase_operation_id: "GET_EDITGROUP"
uppercase_data_type: "EDITGROUP"
producesJson: true
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index 6f61f773..a08e3cfe 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -1749,7 +1749,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::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(GetCreatorReleasesResponse::FoundEntity(body))
+ Ok(GetCreatorReleasesResponse::Found(body))
}
400 => {
let mut buf = String::new();
@@ -1809,7 +1809,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::Editgroup>(&buf)?;
- Ok(GetEditgroupResponse::FoundEntity(body))
+ Ok(GetEditgroupResponse::Found(body))
}
400 => {
let mut buf = String::new();
@@ -1869,7 +1869,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::Editor>(&buf)?;
- Ok(GetEditorResponse::FoundEditor(body))
+ Ok(GetEditorResponse::Found(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(GetEditorResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
@@ -1922,7 +1929,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::<Vec<models::ChangelogEntry>>(&buf)?;
- Ok(GetEditorChangelogResponse::FoundMergedChanges(body))
+ Ok(GetEditorChangelogResponse::Found(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(GetEditorChangelogResponse::BadRequest(body))
}
404 => {
let mut buf = String::new();
@@ -2179,7 +2193,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::<Vec<models::FileEntity>>(&buf)?;
- Ok(GetReleaseFilesResponse::FoundEntity(body))
+ Ok(GetReleaseFilesResponse::Found(body))
}
400 => {
let mut buf = String::new();
@@ -2492,7 +2506,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::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(GetWorkReleasesResponse::FoundEntity(body))
+ Ok(GetWorkReleasesResponse::Found(body))
}
400 => {
let mut buf = String::new();
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index fc1ae2a1..a08c6e04 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -304,8 +304,8 @@ pub enum GetCreatorHistoryResponse {
#[derive(Debug, PartialEq)]
pub enum GetCreatorReleasesResponse {
- /// Found Entity
- FoundEntity(Vec<models::ReleaseEntity>),
+ /// Found
+ Found(Vec<models::ReleaseEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -316,8 +316,8 @@ pub enum GetCreatorReleasesResponse {
#[derive(Debug, PartialEq)]
pub enum GetEditgroupResponse {
- /// Found Entity
- FoundEntity(models::Editgroup),
+ /// Found
+ Found(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -328,8 +328,10 @@ pub enum GetEditgroupResponse {
#[derive(Debug, PartialEq)]
pub enum GetEditorResponse {
- /// Found Editor
- FoundEditor(models::Editor),
+ /// Found
+ Found(models::Editor),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -338,8 +340,10 @@ pub enum GetEditorResponse {
#[derive(Debug, PartialEq)]
pub enum GetEditorChangelogResponse {
- /// Found Merged Changes
- FoundMergedChanges(Vec<models::ChangelogEntry>),
+ /// Found
+ Found(Vec<models::ChangelogEntry>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -384,8 +388,8 @@ pub enum GetReleaseResponse {
#[derive(Debug, PartialEq)]
pub enum GetReleaseFilesResponse {
- /// Found Entity
- FoundEntity(Vec<models::FileEntity>),
+ /// Found
+ Found(Vec<models::FileEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -440,8 +444,8 @@ pub enum GetWorkHistoryResponse {
#[derive(Debug, PartialEq)]
pub enum GetWorkReleasesResponse {
- /// Found Entity
- FoundEntity(Vec<models::ReleaseEntity>),
+ /// Found
+ Found(Vec<models::ReleaseEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs
index 2c54a313..ff2c12ce 100644
--- a/rust/fatcat-api/src/mimetypes.rs
+++ b/rust/fatcat-api/src/mimetypes.rs
@@ -362,7 +362,7 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
- pub static ref GET_CREATOR_RELEASES_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_RELEASES_FOUND: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
@@ -378,7 +378,7 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref GET_EDITGROUP_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_FOUND: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
@@ -394,7 +394,11 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref GET_EDITOR_FOUND_EDITOR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditor
+ lazy_static! {
+ pub static ref GET_EDITOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetEditor
lazy_static! {
@@ -406,7 +410,11 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorChangelog
+ lazy_static! {
+ pub static ref GET_EDITOR_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
@@ -466,7 +474,7 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
- pub static ref GET_RELEASE_FILES_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FILES_FOUND: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
@@ -538,7 +546,7 @@ pub mod responses {
}
/// Create Mime objects for the response content types for GetWorkReleases
lazy_static! {
- pub static ref GET_WORK_RELEASES_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_RELEASES_FOUND: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetWorkReleases
lazy_static! {
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index 04d10e14..dfc94a81 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -2361,11 +2361,11 @@ where
match api.get_creator_releases(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetCreatorReleasesResponse::FoundEntity(body) => {
+ GetCreatorReleasesResponse::Found(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::GET_CREATOR_RELEASES_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2449,11 +2449,11 @@ where
match api.get_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetEditgroupResponse::FoundEntity(body) => {
+ GetEditgroupResponse::Found(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::GET_EDITGROUP_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2537,11 +2537,21 @@ where
match api.get_editor(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetEditorResponse::FoundEditor(body) => {
+ GetEditorResponse::Found(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::GET_EDITOR_FOUND_EDITOR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorResponse::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_EDITOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2615,11 +2625,21 @@ where
match api.get_editor_changelog(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetEditorChangelogResponse::FoundMergedChanges(body) => {
+ GetEditorChangelogResponse::Found(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::GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorChangelogResponse::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_EDITOR_CHANGELOG_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2969,11 +2989,11 @@ where
match api.get_release_files(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetReleaseFilesResponse::FoundEntity(body) => {
+ GetReleaseFilesResponse::Found(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::GET_RELEASE_FILES_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3391,11 +3411,11 @@ where
match api.get_work_releases(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetWorkReleasesResponse::FoundEntity(body) => {
+ GetWorkReleasesResponse::Found(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::GET_WORK_RELEASES_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));