- chore: ran cargo fix on the codebase

This commit is contained in:
2025-03-07 21:03:15 -05:00
parent 3b789d0fd4
commit b6f2d3f456
59 changed files with 1324 additions and 523 deletions

View File

@@ -1,6 +1,9 @@
use crate::auth::auth_service_client::AuthServiceClient;
use crate::auth::{LoginRequest, LoginResponse, LogoutRequest, ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse};
use crate::common::{Empty};
use crate::auth::{
LoginRequest, LoginResponse, LogoutRequest, ValidateSessionRequest, ValidateSessionResponse,
ValidateTokenRequest, ValidateTokenResponse,
};
use crate::common::Empty;
use tonic::transport::Channel;
#[derive(Clone, Debug)]
@@ -14,7 +17,12 @@ impl AuthClient {
Ok(AuthClient { client })
}
pub async fn login(&mut self, username: &str, password: &str, ip_address: &str) -> Result<LoginResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn login(
&mut self,
username: &str,
password: &str,
ip_address: &str,
) -> Result<LoginResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = LoginRequest {
username: username.to_string(),
password: password.to_string(),
@@ -25,34 +33,46 @@ impl AuthClient {
Ok(response.into_inner())
}
pub async fn login_token(&mut self, token: &str) -> Result<ValidateTokenResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn login_token(
&mut self,
token: &str,
) -> Result<ValidateTokenResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = ValidateTokenRequest {
token: token.to_string()
token: token.to_string(),
};
let response = self.client.validate_token(request).await?;
Ok(response.into_inner())
}
pub async fn validate_session(&mut self, session_id: &str) -> Result<ValidateSessionResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn validate_session(
&mut self,
session_id: &str,
) -> Result<ValidateSessionResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = ValidateSessionRequest {
session_id: session_id.to_string()
session_id: session_id.to_string(),
};
let response = self.client.validate_session(request).await?;
Ok(response.into_inner())
}
pub async fn refresh_session(&mut self, session_id: &str) -> Result<ValidateSessionResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn refresh_session(
&mut self,
session_id: &str,
) -> Result<ValidateSessionResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = ValidateSessionRequest {
session_id: session_id.to_string()
session_id: session_id.to_string(),
};
let response = self.client.refresh_session(request).await?;
Ok(response.into_inner())
}
pub async fn logout(&mut self, session_id: &str) -> Result<Empty, Box<dyn std::error::Error + Send + Sync>> {
pub async fn logout(
&mut self,
session_id: &str,
) -> Result<Empty, Box<dyn std::error::Error + Send + Sync>> {
let request = LogoutRequest {
session_id: session_id.to_string(),
};