Files
zesdex/crates/zesdex-iam/src/infrastructure/http/dto.rs
T

62 lines
1.8 KiB
Rust
Raw Normal View History

//! IAM-specific HTTP / IPC DTOs (Data Transfer Objects).
use serde::{Deserialize, Serialize};
use crate::domain::oauth::{OAuthConfig, OAuthToken};
use crate::domain::session::Session;
// ---------------------------------------------------------------------------
// Session DTOs
// ---------------------------------------------------------------------------
/// Request body for creating a new session.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateSessionRequest {
pub title: String,
}
/// Response containing one session.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SessionResponse {
pub session: Session,
}
/// Response containing a list of sessions.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SessionListResponse {
pub sessions: Vec<Session>,
pub total: usize,
}
// ---------------------------------------------------------------------------
// OAuth DTOs
// ---------------------------------------------------------------------------
/// Request body for starting an OAuth flow.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthStartRequest {
pub config: OAuthConfig,
pub redirect_uri: String,
}
/// Response containing the authorization URL and CSRF state for an OAuth flow.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthStartResponse {
pub auth_url: String,
pub state: String,
}
/// Request body for completing an OAuth flow with an authorization code.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthCompleteRequest {
pub config: OAuthConfig,
pub redirect_uri: String,
pub code: String,
pub state: String,
}
/// Response containing the acquired OAuth token.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthTokenResponse {
pub token: OAuthToken,
}