aboutsummaryrefslogtreecommitdiffstats
path: root/src/api.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-19 20:26:35 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-19 20:26:35 -0400
commit44f0f76c906d3fabe592958c208c0782a1d9305a (patch)
tree55079205aafcfcc3fdcaae7eb1323bc042b93a2f /src/api.rs
parentca2f934b014a733121d57475e793e0dad53f7aa9 (diff)
downloadrbw-44f0f76c906d3fabe592958c208c0782a1d9305a.tar.gz
rbw-44f0f76c906d3fabe592958c208c0782a1d9305a.zip
allow creating entries with associated uris
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/api.rs b/src/api.rs
index 44e53a4..aa36f47 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -150,6 +150,12 @@ struct CiphersPostReq {
struct CiphersPostReqLogin {
username: Option<String>,
password: Option<String>,
+ uris: Vec<CiphersPostReqLoginUri>,
+}
+
+#[derive(serde::Serialize, Debug)]
+struct CiphersPostReqLoginUri {
+ uri: String,
}
#[derive(serde::Serialize, Debug)]
@@ -292,6 +298,7 @@ impl Client {
username: Option<&str>,
password: Option<&str>,
notes: Option<&str>,
+ uris: &[String],
) -> Result<()> {
let req = CiphersPostReq {
ty: 1,
@@ -300,6 +307,10 @@ impl Client {
login: CiphersPostReqLogin {
username: username.map(std::string::ToString::to_string),
password: password.map(std::string::ToString::to_string),
+ uris: uris
+ .iter()
+ .map(|s| CiphersPostReqLoginUri { uri: s.to_string() })
+ .collect(),
},
};
let client = reqwest::blocking::Client::new();