aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client
diff options
context:
space:
mode:
authorYannick Ulrich <yannick.ulrich@durham.ac.uk>2023-05-16 22:00:59 +0100
committerGitHub <noreply@github.com>2023-05-16 22:00:59 +0100
commit7b9dea72e3d2435f75825e8e66a04285332d5aa5 (patch)
treee2b9ae2f8df86105b09547a55dc7ac455a55c0c8 /atuin-client
parentInclude bash preexec warning (#983) (diff)
downloadatuin-7b9dea72e3d2435f75825e8e66a04285332d5aa5.zip
feat: add delete account option (attempt 2) (#980)
* Added DELETE register endpoint * Added remove function to database * Added unregister to client * Updated docs * Renamed functions * Reformatting * Used execute instead of fetch in delete_user
Diffstat (limited to 'atuin-client')
-rw-r--r--atuin-client/src/api_client.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs
index 80051ba6..2abb8159 100644
--- a/atuin-client/src/api_client.rs
+++ b/atuin-client/src/api_client.rs
@@ -217,4 +217,19 @@ impl<'a> Client<'a> {
Ok(())
}
+
+ pub async fn delete(&self) -> Result<()> {
+ let url = format!("{}/register", self.sync_addr);
+ let url = Url::parse(url.as_str())?;
+
+ let resp = self.client.delete(url).send().await?;
+
+ if resp.status() == 403 {
+ bail!("invalid login details");
+ } else if resp.status() == 200 {
+ Ok(())
+ } else {
+ bail!("Unknown error");
+ }
+ }
}