diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-04-17 14:06:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-17 14:06:05 +0100 |
| commit | cb19925011d889c513e1bbedc446e399597e38a0 (patch) | |
| tree | 7ad9e42013e15957805f2cdf563ce8b3e0c770f5 /atuin-client/src/api_client.rs | |
| parent | chore(deps): bump debian (#1947) (diff) | |
| download | atuin-cb19925011d889c513e1bbedc446e399597e38a0.zip | |
feat(gui): work on home page, sort state (#1956)
1. Start on a home page, can sort onboarding/etc from there
2. Introduce zustand for state management. It's nice!
Did a production build and clicked around for a while. Memory usage
seems nice and chill.
Diffstat (limited to 'atuin-client/src/api_client.rs')
| -rw-r--r-- | atuin-client/src/api_client.rs | 14 |
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, |
