From 44f0f76c906d3fabe592958c208c0782a1d9305a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 19 Apr 2020 20:26:35 -0400 Subject: allow creating entries with associated uris --- src/api.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/api.rs') 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, password: Option, + uris: Vec, +} + +#[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(); -- cgit v1.2.3-54-g00ecf