1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! # Web路由模块
//!
//! 提供Axum Web框架的路由定义和处理功能,包含完整的API端点和Swagger UI文档界面。
//!
//! ## 路由端点
//!
//! ### 歌曲相关
//! - `GET /song/{cid}` - 获取歌曲详情
//! - `GET /songs` - 获取所有歌曲列表
//!
//! ### 专辑相关
//! - `GET /album/{cid}/data` - 获取专辑信息
//! - `GET /album/{cid}/detail` - 获取专辑详情(含歌曲列表)
//! - `GET /albums` - 获取所有专辑列表
//!
//! ### 新闻相关
//! - `GET /news` - 获取所有新闻列表
//! - `GET /news/{cid}` - 获取新闻详情
//!
//! ### 搜索功能
//! - `GET /search` - 综合搜索(专辑和新闻)
//! - `GET /search/album` - 搜索专辑
//! - `GET /search/news` - 搜索新闻
//!
//! ### 其他
//! - `GET /fontset` - 获取字体配置
//!
//! ### Swagger UI
//! - `GET /swagger-ui/` - Swagger UI文档界面
//! - `GET /api-docs/openapi.json` - OpenAPI规范文档
use crateRemoteApiClient;
use Router;
/// 创建包含Swagger UI的完整API路由
///
/// 创建包含所有API端点的Axum路由,并添加Swagger UI文档界面。
///
/// # 参数
///
/// * `client` - 远程API客户端实例
///
/// # 返回
///
/// 返回配置好的Axum Router实例,包含所有API端点和Swagger UI
///
/// # 示例
///
/// ```rust
/// use easy_msr_api::{client::remote::RemoteApiClient, web};
/// use std::net::Ipv4Addr;
///
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let client = RemoteApiClient::new("https://monster-siren.hypergryph.com/api".to_string());
/// let app = web::routes(client);
///
/// // 启动服务器
/// let listener = tokio::net::TcpListener::bind((Ipv4Addr::LOCALHOST, 8080)).await?;
/// println!("服务器运行在 http://localhost:8080");
/// println!("Swagger UI文档: http://localhost:8080/swagger-ui/");
/// axum::serve(listener, app).await?;
///
/// Ok(())
/// }
/// ```