aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/api_client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-client/src/api_client.rs')
-rw-r--r--atuin-client/src/api_client.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs
index a19e5305..f31a796e 100644
--- a/atuin-client/src/api_client.rs
+++ b/atuin-client/src/api_client.rs
@@ -11,7 +11,7 @@ use reqwest::{
use atuin_common::{
api::{
AddHistoryRequest, ChangePasswordRequest, CountResponse, DeleteHistoryRequest,
- ErrorResponse, LoginRequest, LoginResponse, RegisterResponse, StatusResponse,
+ ErrorResponse, LoginRequest, LoginResponse, MeResponse, RegisterResponse, StatusResponse,
SyncHistoryResponse,
},
record::RecordStatus,
@@ -234,6 +234,18 @@ impl<'a> Client<'a> {
Ok(status)
}
+ pub async fn me(&self) -> Result<MeResponse> {
+ let url = format!("{}/api/v0/me", self.sync_addr);
+ let url = Url::parse(url.as_str())?;
+
+ let resp = self.client.get(url).send().await?;
+ let resp = handle_resp_error(resp).await?;
+
+ let status = resp.json::<MeResponse>().await?;
+
+ Ok(status)
+ }
+
pub async fn get_history(
&self,
sync_ts: OffsetDateTime,