From 248340a3a999366e7f603a1eeb7b314e601af407 Mon Sep 17 00:00:00 2001 From: Ferris Tseng Date: Tue, 23 Jan 2018 18:30:31 -0500 Subject: add /key/rename and /key/rm --- ipfs-api/src/response/key.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'ipfs-api/src/response/key.rs') diff --git a/ipfs-api/src/response/key.rs b/ipfs-api/src/response/key.rs index 2eb7de7..2e3cf67 100644 --- a/ipfs-api/src/response/key.rs +++ b/ipfs-api/src/response/key.rs @@ -8,25 +8,37 @@ use response::serde; - #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct KeyGenResponse { +pub struct KeyPair { pub name: String, pub id: String, } +#[derive(Debug, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct KeyPairList { + #[serde(deserialize_with = "serde::deserialize_vec")] pub keys: Vec, +} + +pub type KeyGenResponse = KeyPair; + +pub type KeyListResponse = KeyPairList; #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct KeyListResponse { - #[serde(deserialize_with = "serde::deserialize_vec")] - pub keys: Vec, +pub struct KeyRenameResponse { + pub was: String, + pub now: String, + pub id: String, + pub overwrite: bool, } +pub type KeyRmResponse = KeyPairList; #[cfg(test)] mod tests { deserialize_test!(v0_key_gen_0, KeyGenResponse); deserialize_test!(v0_key_list_0, KeyListResponse); + deserialize_test!(v0_key_rename_0, KeyRenameResponse); } -- cgit v1.2.3