♻️ 重构部分请求

This commit is contained in:
目棃
2025-03-01 14:26:59 +08:00
parent 7d0e0f187c
commit d0936a0a60
35 changed files with 540 additions and 854 deletions

View File

@@ -1,40 +1,44 @@
/**
* @file types/BBS/Collection.d.ts
* @description BBS 收藏相关类型定义文件
* @since Beta v0.4.5
* @since Beta v0.7.1
*/
/**
* @description BBS 收藏命名空间
* @since Beta v0.4.5
* @namespace TGApp.BBS.Collection
* @memberof TGApp.BBS
*/
declare namespace TGApp.BBS.Collection {
/**
* @description 用户收藏帖子数据返回
* @since Beta v0.4.5
* @interface PostResponse
* @since Beta v0.7.1
* @interface UserPostResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PostRespData} data - 响应数据
* @return PostResponse
* @property {UserPostRes} data - 响应数据
* @return UserPostResp
*/
interface PostResponse extends TGApp.BBS.Response.BaseWithData {
data: PostRespData;
}
type UserPostResp = TGApp.BBS.Response.BaseWithData<UserPostRes>;
/**
* @description 合集帖子返回
* @since Beta v0.7.1
* @interface PostsResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PostsRes} data - 返回数据
* @return PostsResp
*/
type PostsResp = TGApp.BBS.Response.BaseWithData & {
data: { posts: Array<TGApp.Plugins.Mys.Post.FullData> };
};
/**
* @description 用户收藏帖子响应数据
* @since Beta v0.4.5
* @interface PostRespData
* @since Beta v0.7.1
* @interface UserPostRes
* @property {boolean} is_last - 是否最后一页
* @property {string} next_offset - 下一页偏移量
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list - 帖子列表
* @return PostRespData
* @return UserPostRes
*/
interface PostRespData {
type UserPostRes = {
is_last: boolean;
next_offset: string;
list: TGApp.Plugins.Mys.Post.FullData[];
}
list: Array<TGApp.Plugins.Mys.Post.FullData>;
};
}

View File

@@ -1,7 +1,7 @@
/**
* @file types/BBS/Forum.d.ts
* @description BBS 版块类型定义
* @since Beta v0.6.8
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.Forum {
@@ -15,12 +15,22 @@ declare namespace TGApp.BBS.Forum {
*/
type GameForumResp = TGApp.BBS.Response.BaseWithData & { data: { list: Array<GameForum> } };
/**
* @description 获取版块帖子列表返回
* @since Beta v0.7.1
* @interface PostForumResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PostForumRes} data 版块帖子列表
* @return PostForumResp
*/
type PostForumResp = TGApp.BBS.Response.BaseWithData<PostForumRes>;
/**
* @description 分区版块信息
* @since Beta v0.6.8
* @interface GameForum
* @property {number} game_id 游戏 ID
* @property {List<GameForumItem>} forums 版块信息
* @property {Array<GameForumItem>} forums 版块信息
* @return GameForum
*/
type GameForum = { game_id: number; forums: Array<GameForumItem> };
@@ -100,4 +110,25 @@ declare namespace TGApp.BBS.Forum {
* @return ForumCat
*/
type ForumCat = { id: number; name: string; forum_id: number; desc: string; remark: string };
/**
* @description 版块帖子列表
* @since Beta v0.7.1
* @interface PostForumRes
* @property {string} last_id 最后一条帖子 ID
* @property {boolean} is_last 是否最后一页
* @property {boolean} is_origin 是否原创
* @property {number} page 页码
* @property {unknown} databox 数据盒子
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list 帖子列表
* @return PostForumRes
*/
type PostForumRes = {
last_id: string;
is_last: boolean;
is_origin: boolean;
page: number;
databox: unknown;
list: TGApp.Plugins.Mys.Post.FullData[];
};
}

77
src/types/BBS/Lottery.d.ts vendored Normal file
View File

@@ -0,0 +1,77 @@
/**
* @file types/BBS/Lottery.d.ts
* @description 米游社抽奖类型
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.Lottery {
/**
* @description 抽奖返回响应
* @since Beta v0.7.1
* @interface Resp
* @extends TGApp.BBS.Response.BaseWithData
* @property {FullData} data.show_lottery 抽奖数据
* @return Resp
*/
type Resp = TGApp.BBS.Response.BaseWithData & { data: { show_lottery: FullData } };
/**
* @description 抽奖数据
* @since Beta v0.7.1
* @interface FullData
* @property {string} id 抽奖 ID
* @property {TGApp.Plugins.Mys.User.Post} creator 创建者
* @property {string} draw_time 抽奖时间
* @property {string} participant_way 参与方式 // Forward: 转发
* @property {boolean} is_expect_unfocus_user 是否限制未关注用户
* @property {boolean} is_expect_non_real_name_user 是否限制未实名用户
* @property {Array<Reward>} user_rewards 用户奖励
* @property {string} status 状态 // Settled: 已结算
* @property {boolean} is_blocked 是否被屏蔽
* @property {string} user_status 用户状态 // NotParticipant: 未参与
* @property {boolean} is_upload_address 是否上传地址
* @property {string} lottery_entity_summary 抽奖实体摘要
* @property {string} entity_id 实体 ID // 若为帖子,则为帖子 ID
* @property {string} entity_type 实体类型 // Post: 帖子
* @property {string} now_time 当前时间
* @return FullData
*/
type FullData = {
id: string;
creator: TGApp.Plugins.Mys.User.Post;
draw_time: string;
participant_way: string;
is_expect_unfocus_user: boolean;
is_expect_non_real_name_user: boolean;
user_rewards: Array<Reward>;
status: string;
is_blocked: boolean;
user_status: string;
is_upload_address: boolean;
lottery_entity_summary: string;
entity_id: string;
entity_type: string;
now_time: string;
};
/**
* @description 抽奖奖励
* @since Beta v0.7.1
* @interface Reward
* @property {string} reward_name 奖励名称
* @property {number} winner_number 获奖人数
* @property {number} scheduled_winner_number 预计获奖人数
* @property {boolean} is_send_by_post 是否通过帖子发放
* @property {Array<>TGApp.Plugins.Mys.User.Post>} users 用户列表
* @property {string} id 奖励 ID
* @return Reward
*/
type Reward = {
reward_name: string;
winner_number: number;
scheduled_winner_number: number;
is_send_by_post: boolean;
users: Array<TGApp.Plugins.Mys.User.Post>;
id: string;
};
}

32
src/types/BBS/News.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* @file types/BBS/News.d.ts
* @description BBS 咨讯类型定义
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.News {
/**
* @description 咨讯返回数据
* @since Beta v0.7.1
* @interface Resp
* @extends TGApp.BBS.Response.BaseWithData
* @property {Res} data 咨讯数据
* @return Resp
*/
type Resp = TGApp.BBS.Response.BaseWithData<Res>;
/**
* @description 咨讯数据
* @since Beta v0.7.1
* @interface Res
* @property {number} last_id 最后一条咨讯 ID
* @property {boolean} is_last 是否最后一页
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list 咨讯列表
* @return Res
*/
type Res = {
last_id: number;
is_last: boolean;
list: Array<TGApp.Plugins.Mys.Post.FullData>;
};
}

221
src/types/BBS/Reply.d.ts vendored Normal file
View File

@@ -0,0 +1,221 @@
/**
* @file types/BBS/Reply.d.ts
* @description 回复数据类型定义文件
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.Reply {
/**
* @description 帖子回复数据类型
* @since Beta v0.7.1
* @interface MainResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {MainRes} data - 回复数据
* @return MainResp
*/
type MainResp = TGApp.BBS.Response.BaseWithData<MainRes>;
/**
* @description 子回复数据类型
* @since Beta v0.7.1
* @interface SubResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {SubRes} data - 子回复数据
* @return SubResp
*/
type SubResp = TGApp.BBS.Response.BaseWithData<SubRes>;
/**
* @description 子回复数据的根数据类型
* @since Beta v0.7.1
* @interface SubRootResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {SubRootRes} data - 子回复数据
* @return SubRootResp
*/
type SubRootResp = TGApp.BBS.Response.BaseWithData<SubRootRes>;
/**
* @description 子回复数据类型
* @since Beta v0.7.1
* @interface SubRootRes
* @property {TGApp.Plugins.Mys.Post.FullData} post - 帖子数据
* @property {ReplyFull} reply - 回复数据
* @return SubRootRes
*/
type SubRootRes = { post: TGApp.Plugins.Mys.Post.FullData; reply: ReplyFull };
/**
* @description 回复数据类型
* @since Beta v0.7.1
* @interface MainRes
* @property {Array<ReplyFull>} list - 回复列表
* @property {string} last_id - 最后 ID
* @property {boolean} is_last - 是否最后
* @property {string} post_owner_id - 帖子拥有者 ID
* @property {string} pin_reply_id - 置顶回复 ID
* @property {number} fold_reply_num - 折叠回复数
* @return MainRes
*/
type MainRes = {
list: Array<ReplyFull>;
last_id: string;
is_last: boolean;
post_owner_id: string;
pin_reply_id: string;
fold_reply_num: number;
};
/**
* @description 子回复数据类型
* @since Beta v0.7.1
* @interface SubRes
* @property {Array<ReplyFull>} list - 回复列表
* @property {string} last_id - 最后 ID
* @property {boolean} is_last - 是否最后
* @property {boolean} has_previous - 是否有上一页
* @property {string} post_owner_id - 帖子拥有者 ID
* @return SubRes
*/
type SubRes = {
list: Array<ReplyFull>;
last_id: string;
is_last: boolean;
has_previous: boolean;
post_owner_id: string;
};
/**
* @description 回复数据类型
* @since Beta v0.7.1
* @interface ReplyFull
* @property {Reply} reply - 回复数据
* @property {User} user - 用户数据
* @property {Stat} stat - 点赞数据
* @property {SelfOperation} self_operation - 自身操作数据
* @property {MasterStatus} master_status - 主楼状态数据
* @property {Array<TGApp.Plugins.Mys.Post.Image>} images - 图片数据
* @property {Array<ReplyFull>} sub_replies - 子回复数据
* @property {boolean} is_lz - 是否楼主
* @property {number} sub_reply_count - 子回复数量
* @property {TGApp.Plugins.Mys.User.Reply} r_user - 回复用户数据
* @property {unknown} r_reply - 未知数据
* @property {unknown} r_post - 未知数据
* @property {unknown} user_game_info - 未知数据
* @return ReplyFull
*/
type ReplyFull = {
reply: Reply;
user: TGApp.Plugins.Mys.User.Reply;
stat: Stat;
self_operation: SelfOperation;
master_status: MasterStatus;
images: Array<TGApp.Plugins.Mys.Post.Image>;
sub_replies: Array<ReplyFull>;
is_lz: boolean;
sub_reply_count: number;
r_user: TGApp.Plugins.Mys.User.Reply | null;
r_reply: unknown;
r_post: unknown;
user_game_info: unknown;
};
/**
* @description 回复数据类型
* @since Beta v0.7.1
* @interface Reply
* @property {number} game_id - 游戏 ID
* @property {string} post_id - 帖子 ID
* @property {string} reply_id - 回复 ID
* @property {string} uid - 用户 ID
* @property {string} r_uid - 回复用户 ID
* @property {string} content - 回复内容
* @property {number} f_forum_id - 板块 ID
* @property {string} f_reply_id - 主楼 ID
* @property {number} floor_id - 楼层 ID
* @property {number} is_deleted - 是否删除 // 0 未删除 1 已删除
* @property {number} delete_src - 删除来源
* @property {number} created_at - 创建时间,秒级时间戳
* @property {number} updated_at - 更新时间,秒级时间戳
* @property {number} deleted_at - 删除时间,秒级时间戳
* @property {string} struct_content - 结构化内容
* @property {Array<unknown>} structured_content_rows - 结构化内容行
* @property {boolean} is_top - 是否置顶
* @property {boolean} has_block_word - 是否有屏蔽词
* @property {number} overt_status - 公开状态
* @property {boolean} is_showing_missing - 是否显示缺失
* @property {number} selected_comment_time - 选中评论时间
* @property {boolean} is_mentor - 是否导师
* @property {number} view_status - 查看状态
* @return Reply
*/
type Reply = {
game_id: number;
post_id: string;
reply_id: string;
uid: string;
r_uid: string;
content: string;
f_forum_id: number;
f_reply_id: string;
floor_id: number;
is_deleted: number;
delete_src: number;
created_at: number;
updated_at: number;
deleted_at: number;
struct_content: string;
structured_content_rows: Array<unknown>;
is_top: boolean;
has_block_word: boolean;
overt_status: number;
is_showing_missing: boolean;
selected_comment_time: number;
is_mentor: boolean;
view_status: number;
};
/**
* @description 回复气泡数据类型
* @since Beta v0.7.1
* @interface Bubble
* @property {string} assets_id - 资源 ID
* @property {string} bg_color - 背景颜色
* @property {string} url - 链接
* @property {string} name - 名称
* @return Bubble
*/
type Bubble = { assets_id: string; bg_color: string; url: string; name: string };
/**
* @description 点赞数据类型
* @since Beta v0.7.1
* @interface Stat
* @property {number} reply_num - 回复数
* @property {number} like_num - 点赞数
* @property {number} sub_num - 子回复数
* @property {number} dislike_num - 踩数
* @return Stat
*/
type Stat = { reply_num: number; like_num: number; sub_num: number; dislike_num: number };
/**
* @description 自身操作数据类型
* @since Beta v0.7.1
* @interface SelfOperation
* @property {number} attitude - 操作态度
* @property {number} reply_vote_attitude - 回复投票态度
* @return SelfOperation
*/
type SelfOperation = { attitude: number; reply_vote_attitude: number };
/**
* @description 主楼状态数据类型
* @since Beta v0.5.5
* @interface MasterStatus
* @property {boolean} is_official_master - 是否官方
* @property {boolean} is_user_master - 是否用户
* @return MasterStatus
*/
type MasterStatus = { is_official_master: boolean; is_user_master: boolean };
}

36
src/types/BBS/Search.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
/**
* @file types/BBS/Search.d.ts
* @description 米游社搜索类型声明
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.Search {
/**
* @description 搜索帖子返回
* @since Beta v0.7.1
* @interface PostsResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PostsRes} data 返回数据
* @return PostsResp
*/
type PostsResp = TGApp.BBS.Response.BaseWithData<PostsRes>;
/**
* @description 搜索帖子返回数据
* @since Beta v0.7.1
* @interface PostsRes
* @property {TGApp.Plugins.Mys.Post.FullData[]} posts 帖子列表
* @property {string} last_id 索引
* @property {boolean} is_last 是否最后一页
* @property {string[]} token_list token 列表
* @property {Record<string,string>} databox 数据盒
* @return PostsRes
*/
type PostsRes = {
posts: Array<TGApp.Plugins.Mys.Post.FullData>;
last_id: string;
is_last: boolean;
token_list: string[];
databox: Record<string, string>;
};
}

155
src/types/BBS/Topic.d.ts vendored Normal file
View File

@@ -0,0 +1,155 @@
/**
* @file types/BBS/Topic.d.ts
* @description 米游社话题类型声明
* @since Beta v0.7.1
*/
declare namespace TGApp.BBS.Topic {
/**
* @description 特定话题返回数据-话题信息
* @since Beta v0.7.1
* @interface InfoResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {InfoRes} data 特定话题数据
* @return InfoResp
*/
type InfoResp = TGApp.BBS.Response.BaseWithData<InfoRes>;
/**
* @description 特定话题返回数据-帖子列表
* @since Beta v0.7.1
* @interface PostResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PostRes} data 特定话题帖子列表数据
* @return PostResp
*/
type PostResp = TGApp.BBS.Response.BaseWithData<PostRes>;
/**
* @description 特定话题数据
* @since Beta v0.7.1
* @interface InfoRes
* @property {Array<GameInfo>} game_info_list 游戏信息列表
* @property {boolean} good_exist 是否有精华帖
* @property {number} good_post_cnt 精华帖数量
* @property {boolean} good_post_exist 是否有精华帖
* @property {number} hot_post_cnt 热帖数量
* @property {Array<unknown>} related_forums 相关版块
* @property {Array<unknown>} related_topics 相关话题
* @property {Array<unknown>} top_posts 置顶帖
* @property {Info} topic 话题信息
* @return InfoRes
*/
type InfoRes = {
game_info_list: Array<GameInfo>;
good_exist: boolean;
good_post_cnt: number;
good_post_exist: boolean;
hot_post_cnt: number;
related_forums: Array<unknown>;
related_topics: Array<unknown>;
top_posts: Array<unknown>;
topic: Info;
};
/**
* @description 特定话题帖子列表数据
* @since Beta v0.7.1
* @interface PostRes
* @property {boolean} is_last 是否最后一页
* @property {boolean} is_origin 是否原创
* @property {string} last_id 最后一条帖子 ID
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} posts 帖子列表
* @return PostRes
*/
type PostRes = {
is_last: boolean;
is_origin: boolean;
last_id: string;
posts: Array<TGApp.Plugins.Mys.Post.FullData>;
};
/**
* @description 游戏信息
* @since Beta v0.7.1
* @interface GameInfo
* @property {number} id 游戏 ID
* @property {string} name 游戏名称
* @property {boolean} has_good 是否有精华帖
* @property {boolean} has_hot 是否有热帖
* @return GameInfo
*/
type GameInfo = { id: number; name: string; has_good: boolean; has_hot: boolean };
/**
* @description 话题信息
* @since Beta v0.7.1
* @interface Info
* @property {Array<string>} alias 话题别名
* @property {number} content_type 内容类型
* @property {string} cover 封面图片 URL
* @property {number} created_at 创建时间(秒级时间戳)
* @property {string} creator 创建者
* @property {number} creator_type 创建者类型
* @property {number} default_game_id 默认游戏 ID
* @property {string} desc 话题描述
* @property {number} game_id 游戏 ID
* @property {number} good_cnt 精华帖数量
* @property {string} id 话题 ID
* @property {number} is_deleted 是否已删除0-未删除1-已删除
* @property {boolean} is_focus 是否关注
* @property {boolean} is_interactive 是否互动
* @property {string} name 话题名称
* @property {number} order 排序
* @property {unknown} related_forum_ids 相关版块 ID
* @property {unknown} stat 话题统计-可能为null
* @property {Array<SortConfig>} topic_sort_config 话题排序配置
* @property {number} topic_type 话题类型
* @property {string} updated_at 更新时间(秒级时间戳)
* @property {Array<number>} view_type 查看类型
* @return Info
*/
type Info = {
alias: Array<string>;
content_type: number;
cover: string;
created_at: number;
creator: string;
creator_type: number;
default_game_id: number;
desc: string;
game_id: number;
good_cnt: number;
id: string;
is_deleted: number;
is_focus: boolean;
is_interactive: boolean;
name: string;
order: number;
related_forum_ids: unknown;
stat: unknown;
topic_sort_config: Array<SortConfig>;
topic_type: number;
updated_at: string;
view_type: Array<number>;
};
/**
* @description 话题排序配置
* @since Beta v0.7.1
* @interface SortConfig
* @property {string} name 排序名称
* @property {number} type 排序类型
* @property {string} url 排序 URL
* @property {number} show_sort 展示顺序
* @property {string} data_report_name 数据报告名称
* @return SortConfig
*/
type SortConfig = {
name: string;
type: number;
url: string;
show_sort: number;
data_report_name: string;
};
}