aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-03 18:07:40 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-03 20:46:45 -0400
commitdcca2c702999997ebdc2ae7acd1228edf7333014 (patch)
tree08c54f5ec850739665d19a5deb7f3ad9a6231cf7 /src/actions.rs
parent2feed7e2e9367c935aeb669daab66a63cff2f6c0 (diff)
downloadrbw-dcca2c702999997ebdc2ae7acd1228edf7333014.tar.gz
rbw-dcca2c702999997ebdc2ae7acd1228edf7333014.zip
start adding support for different entry types
Diffstat (limited to 'src/actions.rs')
-rw-r--r--src/actions.rs37
1 files changed, 8 insertions, 29 deletions
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<String>, ())> {
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<String>, ())> {
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(())
}