aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-03 23:57:48 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-03 23:57:48 -0400
commit74870c135e43d5c9543033bd2c6fb484ff80e925 (patch)
tree8f9111ba70eeae82ffd22a4207e4f7ec5b4983f1 /src/actions.rs
parent96d69d5e791c352b63a8d469bf5ff3eff5c4e8f8 (diff)
downloadrbw-74870c135e43d5c9543033bd2c6fb484ff80e925.tar.gz
rbw-74870c135e43d5c9543033bd2c6fb484ff80e925.zip
maintain folder and uris when editing an entry
Diffstat (limited to 'src/actions.rs')
-rw-r--r--src/actions.rs37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/actions.rs b/src/actions.rs
index 4f37e5b..172dba6 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -115,11 +115,10 @@ pub fn add(
name: &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, data, notes, uris, folder_id)
+ add_once(access_token, name, data, notes, folder_id)
})
}
@@ -128,20 +127,12 @@ fn add_once(
name: &str,
data: &crate::db::EntryData,
notes: Option<&str>,
- uris: &[String],
folder_id: Option<&str>,
) -> Result<()> {
let config = crate::config::Config::load()?;
let client =
crate::api::Client::new(&config.base_url(), &config.identity_url());
- client.add(
- access_token,
- name,
- data,
- notes,
- uris,
- folder_id.as_deref(),
- )?;
+ client.add(access_token, name, data, notes, folder_id.as_deref())?;
Ok(())
}
@@ -153,10 +144,20 @@ pub fn edit(
name: &str,
data: &crate::db::EntryData,
notes: Option<&str>,
+ folder_uuid: Option<&str>,
history: &[crate::db::HistoryEntry],
) -> Result<(Option<String>, ())> {
with_exchange_refresh_token(access_token, refresh_token, |access_token| {
- edit_once(access_token, id, org_id, name, data, notes, history)
+ edit_once(
+ access_token,
+ id,
+ org_id,
+ name,
+ data,
+ notes,
+ folder_uuid,
+ history,
+ )
})
}
@@ -167,12 +168,22 @@ fn edit_once(
name: &str,
data: &crate::db::EntryData,
notes: Option<&str>,
+ folder_uuid: 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, org_id, name, data, notes, history)?;
+ client.edit(
+ access_token,
+ id,
+ org_id,
+ name,
+ data,
+ notes,
+ folder_uuid,
+ history,
+ )?;
Ok(())
}