diff options
Diffstat (limited to 'src/actions.rs')
-rw-r--r-- | src/actions.rs | 21 |
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 } |