aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-18 01:30:32 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-18 01:58:08 -0400
commit840f53b84206f9efe0a5cdea3414c472908a22e4 (patch)
treee8d95614a3f0c1ae1bfd4c9616ce6143cc3e6e0b /src/actions.rs
parentdd7ef574e84ca6c1a548422904c6865048ae8e30 (diff)
downloadrbw-840f53b84206f9efe0a5cdea3414c472908a22e4.tar.gz
rbw-840f53b84206f9efe0a5cdea3414c472908a22e4.zip
implement add command
Diffstat (limited to 'src/actions.rs')
-rw-r--r--src/actions.rs21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/actions.rs b/src/actions.rs
index c942f32..07cf6ba 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -52,9 +52,26 @@ pub async fn sync(
client.sync(access_token).await
}
-pub async fn exchange_refresh_token(refresh_token: &str) -> Result<String> {
+pub fn add(access_token: &str, cipher: &crate::api::Cipher) -> Result<()> {
+ let config = crate::config::Config::load()?;
+ let client =
+ crate::api::Client::new(&config.base_url(), &config.identity_url());
+ client.add(access_token, cipher)?;
+ Ok(())
+}
+
+pub fn exchange_refresh_token(refresh_token: &str) -> Result<String> {
+ let config = crate::config::Config::load()?;
+ let client =
+ crate::api::Client::new(&config.base_url(), &config.identity_url());
+ client.exchange_refresh_token(refresh_token)
+}
+
+pub async fn exchange_refresh_token_async(
+ refresh_token: &str,
+) -> Result<String> {
let config = crate::config::Config::load_async().await?;
let client =
crate::api::Client::new(&config.base_url(), &config.identity_url());
- client.exchange_refresh_token(refresh_token).await
+ client.exchange_refresh_token_async(refresh_token).await
}