diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-09 16:19:20 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-09 16:19:20 -0800 |
commit | e3a9b020283c62c8335f2f1124eab304074e3415 (patch) | |
tree | f8944f13c447a7ed9d3d2f8f4da5de0bd12d4f47 /rust/fatcat-api-spec/src | |
parent | 30618aaaf858b671544be984f5aa47681777e23e (diff) | |
download | fatcat-e3a9b020283c62c8335f2f1124eab304074e3415.tar.gz fatcat-e3a9b020283c62c8335f2f1124eab304074e3415.zip |
rust impl response types
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 536bdd24..a5c588a0 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -411,13 +411,23 @@ impl EntityHistoryEntry { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ErrorResponse { + #[serde(rename = "success")] + pub success: bool, + + #[serde(rename = "error")] + pub error: String, + #[serde(rename = "message")] pub message: String, } impl ErrorResponse { - pub fn new(message: String) -> ErrorResponse { - ErrorResponse { message: message } + pub fn new(success: bool, error: String, message: String) -> ErrorResponse { + ErrorResponse { + success: success, + error: error, + message: message, + } } } @@ -911,13 +921,16 @@ impl ReleaseRef { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Success { + #[serde(rename = "success")] + pub success: bool, + #[serde(rename = "message")] pub message: String, } impl Success { - pub fn new(message: String) -> Success { - Success { message: message } + pub fn new(success: bool, message: String) -> Success { + Success { success: success, message: message } } } |