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 | |
parent | 30618aaaf858b671544be984f5aa47681777e23e (diff) | |
download | fatcat-e3a9b020283c62c8335f2f1124eab304074e3415.tar.gz fatcat-e3a9b020283c62c8335f2f1124eab304074e3415.zip |
rust impl response types
Diffstat (limited to 'rust/fatcat-api-spec')
-rw-r--r-- | rust/fatcat-api-spec/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api.yaml | 11 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 10 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 21 |
4 files changed, 38 insertions, 6 deletions
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 3dcee270..95a39ba3 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/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: 2019-01-09T21:14:27.679Z +- Build date: 2019-01-09T23:33:10.040Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 38f06948..da582ade 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -101,16 +101,25 @@ definitions: error_response: type: object required: + - success + - error - message properties: + success: + type: boolean + error: + type: string message: type: string example: "A really confusing, totally unexpected thing happened" success: type: object required: + - success - message properties: + success: + type: boolean message: type: string example: "The computers did the thing successfully!" @@ -721,7 +730,7 @@ paths: parameters: - name: editgroup_id in: query - required: true + required: true type: string security: - Bearer: [] diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 7ee33725..293186c6 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -6734,8 +6734,14 @@ definitions: error_response: type: "object" required: + - "error" - "message" + - "success" properties: + success: + type: "boolean" + error: + type: "string" message: type: "string" example: "A really confusing, totally unexpected thing happened" @@ -6744,11 +6750,15 @@ definitions: type: "object" required: - "message" + - "success" properties: + success: + type: "boolean" message: type: "string" example: "The computers did the thing successfully!" example: + success: true message: "The computers did the thing successfully!" upperCaseName: "SUCCESS" container_entity: 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 } } } |