diff options
Diffstat (limited to 'crates/turtle/src/atuin_client/api_client.rs')
| -rw-r--r-- | crates/turtle/src/atuin_client/api_client.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/crates/turtle/src/atuin_client/api_client.rs b/crates/turtle/src/atuin_client/api_client.rs index 7955c2da..f3f2428a 100644 --- a/crates/turtle/src/atuin_client/api_client.rs +++ b/crates/turtle/src/atuin_client/api_client.rs @@ -40,7 +40,7 @@ static APP_USER_AGENT: &str = concat!("atuin/", env!("CARGO_PKG_VERSION"),); /// When both are available, Hub tokens are preferred as they provide unified /// authentication across CLI and Hub features. #[derive(Debug, Clone)] -pub enum AuthToken { +pub(crate) enum AuthToken { /// Legacy CLI session token, used with "Token {token}" header Token(String), } @@ -54,7 +54,7 @@ impl AuthToken { } } -pub struct Client<'a> { +pub(crate) struct Client<'a> { sync_addr: &'a str, client: reqwest::Client, } @@ -78,7 +78,7 @@ fn make_url(address: &str, path: &str) -> Result<String> { Ok(url.to_string()) } -pub async fn register( +pub(crate) async fn register( address: &str, username: &str, email: &str, @@ -116,7 +116,7 @@ pub async fn register( Ok(session) } -pub async fn login(address: &str, req: LoginRequest) -> Result<LoginResponse> { +pub(crate) async fn login(address: &str, req: LoginRequest) -> Result<LoginResponse> { ensure_crypto_provider(); let url = make_url(address, "/login")?; let client = reqwest::Client::new(); @@ -137,7 +137,7 @@ pub async fn login(address: &str, req: LoginRequest) -> Result<LoginResponse> { Ok(session) } -pub fn ensure_version(response: &Response) -> Result<bool> { +pub(crate) fn ensure_version(response: &Response) -> Result<bool> { let version = response.headers().get(ATUIN_HEADER_VERSION); let version = if let Some(version) = version { @@ -199,7 +199,7 @@ async fn handle_resp_error(resp: Response) -> Result<Response> { } impl<'a> Client<'a> { - pub fn new( + pub(crate) fn new( sync_addr: &'a str, auth: AuthToken, connect_timeout: u64, @@ -223,7 +223,7 @@ impl<'a> Client<'a> { }) } - pub async fn count(&self) -> Result<i64> { + pub(crate) async fn count(&self) -> Result<i64> { let url = make_url(self.sync_addr, "/sync/count")?; let url = Url::parse(url.as_str())?; @@ -243,7 +243,7 @@ impl<'a> Client<'a> { Ok(count.count) } - pub async fn status(&self) -> Result<StatusResponse> { + pub(crate) async fn status(&self) -> Result<StatusResponse> { let url = make_url(self.sync_addr, "/sync/status")?; let url = Url::parse(url.as_str())?; @@ -259,7 +259,7 @@ impl<'a> Client<'a> { Ok(status) } - pub async fn me(&self) -> Result<MeResponse> { + pub(crate) async fn me(&self) -> Result<MeResponse> { let url = make_url(self.sync_addr, "/api/v0/me")?; let url = Url::parse(url.as_str())?; @@ -271,7 +271,7 @@ impl<'a> Client<'a> { Ok(status) } - pub async fn get_history( + pub(crate) async fn get_history( &self, sync_ts: OffsetDateTime, history_ts: OffsetDateTime, @@ -296,7 +296,7 @@ impl<'a> Client<'a> { Ok(history) } - pub async fn post_history(&self, history: &[AddHistoryRequest]) -> Result<()> { + pub(crate) async fn post_history(&self, history: &[AddHistoryRequest]) -> Result<()> { let url = make_url(self.sync_addr, "/history")?; let url = Url::parse(url.as_str())?; @@ -306,7 +306,7 @@ impl<'a> Client<'a> { Ok(()) } - pub async fn delete_history(&self, h: History) -> Result<()> { + pub(crate) async fn delete_history(&self, h: History) -> Result<()> { let url = make_url(self.sync_addr, "/history")?; let url = Url::parse(url.as_str())?; @@ -324,7 +324,7 @@ impl<'a> Client<'a> { Ok(()) } - pub async fn delete_store(&self) -> Result<()> { + pub(crate) async fn delete_store(&self) -> Result<()> { let url = make_url(self.sync_addr, "/api/v0/store")?; let url = Url::parse(url.as_str())?; @@ -335,7 +335,7 @@ impl<'a> Client<'a> { Ok(()) } - pub async fn post_records(&self, records: &[Record<EncryptedData>]) -> Result<()> { + pub(crate) async fn post_records(&self, records: &[Record<EncryptedData>]) -> Result<()> { let url = make_url(self.sync_addr, "/api/v0/record")?; let url = Url::parse(url.as_str())?; @@ -347,7 +347,7 @@ impl<'a> Client<'a> { Ok(()) } - pub async fn next_records( + pub(crate) async fn next_records( &self, host: HostId, tag: String, @@ -374,7 +374,7 @@ impl<'a> Client<'a> { Ok(records) } - pub async fn record_status(&self) -> Result<RecordStatus> { + pub(crate) async fn record_status(&self) -> Result<RecordStatus> { let url = make_url(self.sync_addr, "/api/v0/record")?; let url = Url::parse(url.as_str())?; @@ -392,7 +392,7 @@ impl<'a> Client<'a> { Ok(index) } - pub async fn delete(&self) -> Result<()> { + pub(crate) async fn delete(&self) -> Result<()> { let url = make_url(self.sync_addr, "/account")?; let url = Url::parse(url.as_str())?; @@ -407,7 +407,7 @@ impl<'a> Client<'a> { } } - pub async fn change_password( + pub(crate) async fn change_password( &self, current_password: String, new_password: String, |
