use utoipa::OpenApi; use crate::config::AgreementDoc; use crate::features::TempKey; use export::auth::agreement::{AcceptAgreementCmd, AcceptAgreementResp}; use crate::features::email_code::types::{VerifyCodeCmd, VerifyCodeResult}; use crate::features::forgot_password::types::{ForgotPasswordCmd, ForgotPasswordResp}; use crate::features::login::types::{LoginCmd, LoginResp, UserMe, UserPublic}; use export::auth::logout::{LogoutCmd, LogoutResp}; use crate::features::oauth::types::{ AuthorizationUrlResp, AuthorizeCmd, CallbackCmd, OAuthLoginResp, OAuthProvider, OAuthProviderInfo, }; use export::auth::refresh::{RefreshCmd, RefreshResp}; use crate::features::register::types::{PowProof, RegisterCmd, RegisterResp}; use crate::features::reclaim::types::{ReclaimCmd, ReclaimResp}; use crate::features::resend_code::types::{ResendCodeCmd, ResendCodeResp}; use export::auth::reset_password::{ResetPasswordCmd, ResetPasswordResp}; use crate::handler::pow::PowChallengeResp; /// Error body returned by every handler on failure. #[derive(Debug, serde::Serialize, utoipa::ToSchema)] pub struct ErrorBody { pub error: String, } #[derive(OpenApi)] #[openapi( info( title = "Auth API", version = "1.0.0", description = "Authentication endpoints: registration, login, OAuth, password recovery, agreements, and account profile.", ), paths( crate::handler::register::handler, crate::handler::login::handler, crate::handler::pow::handler, crate::handler::logout::handler, crate::handler::refresh::handler, crate::handler::email::verify::handler, crate::handler::email::resend::handler, crate::handler::email::reclaim::handler, crate::handler::password::forgot::handler, crate::handler::password::reset::handler, crate::handler::agreement::list::handler, crate::handler::agreement::accept::handler, crate::handler::oauth::providers::handler, crate::handler::oauth::authorize::handler, crate::handler::oauth::callback::handler, crate::handler::me::handler, ), components( schemas( ErrorBody, PowProof, PowChallengeResp, RegisterCmd, RegisterResp, LoginCmd, LoginResp, LogoutCmd, LogoutResp, RefreshCmd, RefreshResp, VerifyCodeCmd, VerifyCodeResult, ResendCodeCmd, ResendCodeResp, ReclaimCmd, ReclaimResp, ForgotPasswordCmd, ForgotPasswordResp, ResetPasswordCmd, ResetPasswordResp, AcceptAgreementCmd, AcceptAgreementResp, AgreementDoc, TempKey, OAuthProvider, OAuthProviderInfo, AuthorizeCmd, AuthorizationUrlResp, CallbackCmd, OAuthLoginResp, UserPublic, UserMe, ) ), tags( (name = "auth", description = "Authentication endpoints"), ), )] pub struct AuthApiDoc;