From dcca2c702999997ebdc2ae7acd1228edf7333014 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 3 May 2020 18:07:40 -0400 Subject: start adding support for different entry types --- src/actions.rs | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'src/actions.rs') diff --git a/src/actions.rs b/src/actions.rs index a4b8021..736f43e 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -113,30 +113,20 @@ pub fn add( access_token: &str, refresh_token: &str, name: &str, - username: Option<&str>, - password: Option<&str>, + data: &crate::db::EntryData, notes: Option<&str>, uris: &[String], folder_id: Option<&str>, ) -> Result<(Option, ())> { with_exchange_refresh_token(access_token, refresh_token, |access_token| { - add_once( - access_token, - name, - username, - password, - notes, - uris, - folder_id, - ) + add_once(access_token, name, data, notes, uris, folder_id) }) } fn add_once( access_token: &str, name: &str, - username: Option<&str>, - password: Option<&str>, + data: &crate::db::EntryData, notes: Option<&str>, uris: &[String], folder_id: Option<&str>, @@ -147,8 +137,7 @@ fn add_once( client.add( access_token, name, - username, - password, + data, notes, uris, folder_id.as_deref(), @@ -161,13 +150,12 @@ pub fn edit( refresh_token: &str, id: &str, name: &str, - username: Option<&str>, - password: Option<&str>, + data: &crate::db::EntryData, notes: Option<&str>, history: &[crate::db::HistoryEntry], ) -> Result<(Option, ())> { with_exchange_refresh_token(access_token, refresh_token, |access_token| { - edit_once(access_token, id, name, username, password, notes, history) + edit_once(access_token, id, name, data, notes, history) }) } @@ -175,23 +163,14 @@ fn edit_once( access_token: &str, id: &str, name: &str, - username: Option<&str>, - password: Option<&str>, + data: &crate::db::EntryData, notes: Option<&str>, history: &[crate::db::HistoryEntry], ) -> Result<()> { let config = crate::config::Config::load()?; let client = crate::api::Client::new(&config.base_url(), &config.identity_url()); - client.edit( - access_token, - id, - name, - username, - password, - notes, - history, - )?; + client.edit(access_token, id, name, data, notes, history)?; Ok(()) } -- cgit v1.2.3-54-g00ecf