♻️ 类型迁移&重构

This commit is contained in:
目棃
2025-03-07 17:59:35 +08:00
parent ce5a88954a
commit d5aaecbf72
39 changed files with 514 additions and 567 deletions

View File

@@ -1,32 +0,0 @@
/**
* @file types/BBS/Account.d.ts
* @description BBS 账户相关类型定义文件
* @since Beta v0.6.7
*/
declare namespace TGApp.BBS.Account {
/**
* @description 游戏账号类型
* @interface GameAccount
* @since Beta v0.6.0
* @property {string} game_biz 游戏 biz例如 hk4e_cn
* @property {string} game_uid 游戏 uid
* @property {boolean} is_chosen 是否为当前选中账号
* @property {boolean} is_official 是否为官服账号
* @property {string} level 游戏等级
* @property {string} nickname 游戏昵称
* @property {string} region 游戏区域
* @property {string} region_name 游戏区域名称
* @return Game
*/
interface GameAccount {
game_biz: string;
game_uid: string;
is_chosen: boolean;
is_official: boolean;
level: string;
nickname: string;
region: string;
region_name: string;
}
}

View File

@@ -23,9 +23,16 @@ declare namespace TGApp.BBS.Collection {
* @property {PostsRes} data - 返回数据
* @return PostsResp
*/
type PostsResp = TGApp.BBS.Response.BaseWithData & {
data: { posts: Array<TGApp.Plugins.Mys.Post.FullData> };
};
type PostsResp = TGApp.BBS.Response.BaseWithData<PostsRes>;
/**
* @description 帖子列表数据
* @since Beta v0.7.1
* @interface PostsRes
* @property {Array<TGApp.BBS.Post.FullData>} posts - 帖子列表
* @return PostsRes
*/
type PostsRes = { posts: Array<TGApp.BBS.Post.FullData> };
/**
* @description 用户收藏帖子响应数据
@@ -33,12 +40,12 @@ declare namespace TGApp.BBS.Collection {
* @interface UserPostRes
* @property {boolean} is_last - 是否最后一页
* @property {string} next_offset - 下一页偏移量
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list - 帖子列表
* @property {Array<TGApp.BBS.Post.FullData>} list - 帖子列表
* @return UserPostRes
*/
type UserPostRes = {
is_last: boolean;
next_offset: string;
list: Array<TGApp.Plugins.Mys.Post.FullData>;
list: Array<TGApp.BBS.Post.FullData>;
};
}

View File

@@ -64,8 +64,8 @@ declare namespace TGApp.BBS.Forum {
* @property {number} show_type 显示类型
* @property {number} default_tab 默认标签
* @property {string} read_me 说明
* @property {Array<ForumCat>} forum_cate_list 分类列表
* @property {Array<ForumCat>} video_cat_list 视频分类列表
* @property {Array<ForumCate>} forum_cate_list 分类列表
* @property {Array<ForumCate>} video_cat_list 视频分类列表
* @return GameForumItem
*/
type GameForumItem = {
@@ -94,33 +94,33 @@ declare namespace TGApp.BBS.Forum {
show_type: number;
default_tab: number;
read_me: string;
forum_cate_list: Array<ForumCat>;
video_cat_list: Array<ForumCat>;
forum_cate_list: Array<ForumCate>;
video_cat_list: Array<ForumCate>;
};
/**
* @description 视频分类
* @since Beta v0.6.8
* @interface ForumCat
* @interface ForumCate
* @property {number} id 分类 ID
* @property {string} name 分类名称
* @property {number} forum_id 版块 ID
* @property {string} desc 描述
* @property {string} remark 备注
* @return ForumCat
* @return ForumCate
*/
type ForumCat = { id: number; name: string; forum_id: number; desc: string; remark: string };
type ForumCate = { id: number; name: string; forum_id: number; desc: string; remark: string };
/**
* @description 版块帖子列表
* @since Beta v0.7.1
* @since Beta v0.7.2
* @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 帖子列表
* @property {Array<TGApp.BBS.Post.FullData>} list 帖子列表
* @return PostForumRes
*/
type PostForumRes = {
@@ -129,6 +129,6 @@ declare namespace TGApp.BBS.Forum {
is_origin: boolean;
page: number;
databox: unknown;
list: TGApp.Plugins.Mys.Post.FullData[];
list: Array<TGApp.BBS.Post.FullData>;
};
}

View File

@@ -1,7 +1,7 @@
/**
* @file types/BBS/Game.d.ts
* @description 游戏相关的类型定义
* @since Beta v0.6.8
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Game {
@@ -49,4 +49,48 @@ declare namespace TGApp.BBS.Game {
has_wiki: boolean;
game_sort_config: Array<unknown>;
};
/**
* @description 游戏账号返回
* @since Beta v0.7.2
* @interface AccountResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {AccountRes} data 游戏账号数据
* @return AccountResp
*/
type AccountResp = TGApp.BBS.Response.BaseWithData<AccountRes>;
/**
* @description 游戏账号数据
* @since Beta v0.7.2
* @interface AccountRes
* @property {Array<Account>} list 游戏账号列表
* @return AccountRes
*/
type AccountRes = { list: Array<Account> };
/**
* @description 游戏账号类型
* @since Beta v0.7.2
* @interface Account
* @property {string} game_biz 游戏 biz例如 hk4e_cn
* @property {string} game_uid 游戏 uid
* @property {boolean} is_chosen 是否为当前选中账号
* @property {boolean} is_official 是否为官服账号
* @property {string} level 游戏等级
* @property {string} nickname 游戏昵称
* @property {string} region 游戏区域
* @property {string} region_name 游戏区域名称
* @return Account
*/
type Account = {
game_biz: string;
game_uid: string;
is_chosen: boolean;
is_official: boolean;
level: string;
nickname: string;
region: string;
region_name: string;
};
}

View File

@@ -1,7 +1,7 @@
/**
* @file types/BBS/Lottery.d.ts
* @description 米游社抽奖类型
* @since Beta v0.7.1
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Lottery {
@@ -17,10 +17,10 @@ declare namespace TGApp.BBS.Lottery {
/**
* @description 抽奖数据
* @since Beta v0.7.1
* @since Beta v0.7.2
* @interface FullData
* @property {string} id 抽奖 ID
* @property {TGApp.Plugins.Mys.User.Post} creator 创建者
* @property {TGApp.BBS.Post.User} creator 创建者
* @property {string} draw_time 抽奖时间
* @property {string} participant_way 参与方式 // Forward: 转发
* @property {boolean} is_expect_unfocus_user 是否限制未关注用户
@@ -38,7 +38,7 @@ declare namespace TGApp.BBS.Lottery {
*/
type FullData = {
id: string;
creator: TGApp.Plugins.Mys.User.Post;
creator: TGApp.BBS.Post.User;
draw_time: string;
participant_way: string;
is_expect_unfocus_user: boolean;
@@ -56,13 +56,13 @@ declare namespace TGApp.BBS.Lottery {
/**
* @description 抽奖奖励
* @since Beta v0.7.1
* @since Beta v0.7.2
* @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 {Array<TGApp.BBS.Post.User>} users 用户列表
* @property {string} id 奖励 ID
* @return Reward
*/
@@ -71,7 +71,7 @@ declare namespace TGApp.BBS.Lottery {
winner_number: number;
scheduled_winner_number: number;
is_send_by_post: boolean;
users: Array<TGApp.Plugins.Mys.User.Post>;
users: Array<TGApp.BBS.Post.User>;
id: string;
};
}

View File

@@ -1,32 +0,0 @@
/**
* @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>;
};
}

521
src/types/BBS/Post.d.ts vendored Normal file
View File

@@ -0,0 +1,521 @@
/**
* @file types/BBS/Post.d.ts
* @description 帖子类型定义文件
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Post {
/**
* @description 获取帖子详情返回数据
* @since Beta v0.7.2
* @interface FullResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {FullRes} data 帖子数据
* @return FullResp
*/
type FullResp = TGApp.BBS.Response.BaseWithData<FullRes>;
/**
* @description 帖子数据
* @since Beta v0.7.2
* @interface FullRes
* @property {FullData} post 帖子数据
* @return FullRes
*/
type FullRes = { post: FullData };
/**
* @description 搜索结果返回
* @since Beta v0.7.2
* @interface SearchResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {SearchRes} data 返回数据
* @return SearchResp
*/
type SearchResp = TGApp.BBS.Response.BaseWithData<SearchRes>;
/**
* @description 搜索结果数据
* @since Beta v0.7.2
* @interface SearchRes
* @property {Array<FullData>} posts 帖子列表
* @property {string} last_id 索引
* @property {boolean} is_last 是否最后一页
* @property {Array<string>} token_list token 列表
* @property {Record<string,string>} databox 数据盒
* @return SearchRes
*/
type SearchRes = {
posts: Array<FullData>;
last_id: string;
is_last: boolean;
token_list: Array<string>;
databox: Record<string, string>;
};
/**
* @description 咨讯返回
* @since Beta v0.7.2
* @interface NewsResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {NewsRes} data 返回数据
* @return NewsResp
*/
type NewsResp = TGApp.BBS.Response.BaseWithData<NewsRes>;
/**
* @description 咨讯数据
* @since Beta v0.7.2
* @interface NewsRes
* @property {Array<FullData>} list 咨讯列表
* @property {string} last_id 最后 ID
* @property {boolean} is_last 是否最后一页
* @return NewsRes
*/
type NewsRes = { list: Array<FullData>; last_id: string; is_last: boolean };
/**
* @description 帖子数据
* @since Beta v0.7.2
* @interface FullData
* @property {Post} post 帖子信息
* @property {Forum|null} forum 所属版块,可能为 null
* @property {Array<TGApp.BBS.Topic.Info>} topics 所属话题
* @property {User|null} user 发帖人,可能为 null
* @property {TGApp.BBS.User.SelfOperation} self_operation 当前用户操作
* @property {Stat|null} stat 帖子统计,可能为 null
* @property {HelpSys} help_sys 帮助系统,可能为 null
* @property {Image} cover 封面图,可能为 null
* @property {Array<Image>} image_list 图片列表
* @property {boolean} is_official_master 是否为官方帖
* @property {boolean} is_user_master 是否为用户帖
* @property {boolean} hot_reply_exist 是否存在热门回复
* @property {number} vote_count 投票数
* @property {number} last_modify_time 最后修改时间
* @property {string} recommend_type 推荐类型
* @property {Collection} collection 合集,可能为 null
* @property {Array<Vod>} vod_list 视频列表,可能为空
* @property {boolean} is_block_on 是否被屏蔽
* @property {unknown} forum_rank_info 版块排行信息,可能为 null
* @property {LinkCard[]} link_card_list 链接卡片列表,可能为空
* @property {NewsMeta} news_meta 咨讯元数据,可能为 null'
* @property {RecommendReason|null} recommend_reason 推荐理由,可能为 null
* @property {unknown} villa_card 未知数据,可能为 null
* @property {boolean} is_mentor 是否为导师
* @property {unknown} villa_room_card 未知数据,可能为 null
* @property {unknown} reply_avatar_action_info 未知数据,可能为 null
* @property {unknown} challenge 挑战,可能为 null
* @property {Array<unknown>} hot_reply_list 热门回复列表
* @property {Array<unknown>} villa_msg_image_list 未知数据列表
* @return FullData
*/
type FullData = {
post: Post;
forum: Forum | null;
topics: Array<TGApp.BBS.Topic.Info>;
user: User | null;
self_operation: TGApp.BBS.User.SelfOperation;
stat: Stat | null;
help_sys: HelpSys | null;
cover: Image | null;
image_list: Array<Image>;
is_official_master: boolean;
is_user_master: boolean;
hot_reply_exist: boolean;
vote_count: number;
last_modify_time: number;
recommend_type: string;
collection: Collection | null;
vod_list: Array<Vod>;
is_block_on: boolean;
forum_rank_info: unknown | null;
link_card_list: Array<LinkCard>;
news_meta?: NewsMeta | null;
recommend_reason: RecommendReason | null;
villa_card: unknown | null;
is_mentor: boolean;
villa_room_card: unknown | null;
reply_avatar_action_info: unknown | null;
challenge: unknown | null;
hot_reply_list: Array<unknown>;
villa_msg_image_list: Array<unknown>;
};
/**
* @description 用户信息
* @since Beta v0.7.2
* @interface User
* @property {string} uid 用户 ID
* @property {string} nickname 用户昵称
* @property {string} introduce 用户简介
* @property {string} avatar 用户头像
* @property {number} gender 用户性别
* @property {TGApp.BBS.User.Certification} certification 用户认证信息
* @property level_exp 用户等级经验
* @property {number} level_exp.level 用户等级
* @property {number} level_exp.exp 用户经验
* @property {boolean} is_following 是否关注
* @property {boolean} is_followed 是否被关注
* @property {string} avatar_url 用户头像链接
* @property {string} pendant 用户挂件 URL可能为 ""
* @property {boolean} is_creator 是否是创作者
* @property {TGApp.BBS.User.AvatarExt} avatar_ext 用户头像扩展信息
* @return User
*/
type User = {
uid: string;
nickname: string;
introduce: string;
avatar: string;
gender: number;
certification: TGApp.BBS.User.Certification;
level_exp: TGApp.BBS.User.LevelExp;
is_following: boolean;
is_followed: boolean;
avatar_url: string;
pendant: string;
is_creator: boolean;
avatar_ext: TGApp.BBS.User.AvatarExt;
};
/**
* @description 帖子信息
* @since Beta v0.7.2
* @interface Post
* @property {number} game_id 游戏 ID // 2 为原神
* @property {string} post_id 帖子 ID
* @property {number} f_forum_id 所属版块 ID
* @property {string} uid 发帖人 UID
* @property {string} subject 帖子标题
* @property {string} content 帖子内容,为 html 格式
* @property {string} cover 封面图 URL可能为 ""
* @property {number} view_type 浏览类型
* @property {number} created_at 发帖时间
* @property {Array<string>} images 图片列表,可能为空
* @property {PostStat} post_status 帖子状态
* @property {Array<number>} topic_ids 所属话题 ID 列表
* @property {number} view_status 浏览状态
* @property {number} max_floor 最大楼层
* @property {number} is_original 是否原创
* @property {number} republish_authorization 是否授权转载
* @property {string} reply_time 最后回复时间 // "2023-03-05 20:26:54"
* @property {number} is_deleted 是否删除
* @property {boolean} is_interactive 是否互动
* @property {string} structured_content 结构化内容 // 反序列化后为 TGApp.BBS.SctPost.Common[]
* @property {Array<string>} structured_content_rows 结构化内容原始数据
* @property {number} review_id 审核ID
* @property {boolean} is_profit 是否盈利
* @property {boolean} is_in_profit 是否在盈利
* @property {number} updated_at 更新时间
* @property {number} deleted_at 删除时间
* @property {number} pre_pub_status 预发布状态
* @property {number} cate_id 分类ID
* @property {number} profit_post_status 盈利帖子状态
* @property {number} audit_status 审核状态
* @property {string} meta_content 元内容,可能为 ""
* @property {boolean} is_missing 是否缺失
* @property {number} block_reply_img 是否屏蔽回复图片
* @property {boolean} is_showing_missing 是否显示缺失
* @property {number} block_latest_reply_time 是否屏蔽最新回复时间
* @property {number} selected_comment 是否选择评论
* @property {boolean} is_mentor 是否为导师
* @return Post
*/
type Post = {
game_id: number;
post_id: string;
f_forum_id: number;
uid: string;
subject: string;
content: string;
cover: string;
view_type: number;
created_at: number;
images: Array<string>;
post_status: PostStat;
topic_ids: Array<number>;
view_status: number;
max_floor: number;
is_original: number;
republish_authorization: number;
reply_time: string;
is_deleted: number;
is_interactive: boolean;
structured_content: string;
structured_content_rows: Array<string>;
review_id: number;
is_profit: boolean;
is_in_profit: boolean;
updated_at: number;
deleted_at: number;
pre_pub_status: number;
cate_id: number;
profit_post_status: number;
audit_status: number;
meta_content: string;
is_missing: boolean;
block_reply_img: number;
is_showing_missing: boolean;
block_latest_reply_time: number;
selected_comment: number;
is_mentor: boolean;
};
/**
* @description 帖子状态
* @since Beta v0.7.2
* @interface PostStat
* @property {boolean} is_top 是否置顶
* @property {boolean} is_good 是否加精
* @property {boolean} is_official 是否官方
* @property {number} post_status 帖子状态
* @return PostStat
*/
type PostStat = { is_top: boolean; is_good: boolean; is_official: boolean; post_status: number };
/**
* @description 版块信息
* @since Beta v0.7.2
* @interface Forum
* @property {number} id 版块 ID
* @property {string} name 版块名称
* @property {string} icon 版块图标 URL
* @property {number} game_id 游戏 ID // 2 为原神
* @property {TGApp.BBS.Forum.ForumCate|null} forum_cate 版块分类,可能为 null
* @return Forum
*/
type Forum = {
id: number;
name: string;
icon: string;
game_id: number;
forum_cate: TGApp.BBS.Forum.ForumCate | null;
};
/**
* @description 帖子状态
* @since Beta v0.3.7
* @interface Stat
* @property {number} view_num 浏览数
* @property {number} reply_num 回复数
* @property {number} like_num 点赞数
* @property {number} bookmark_num 收藏数
* @property {number} forward_num 转发数
* @property {number} original_like_num 原创点赞数
* @property {Array<StatUpvote>} post_upvote_stat 互动信息
* @return Stat
*/
type Stat = {
view_num: number;
reply_num: number;
like_num: number;
bookmark_num: number;
forward_num: number;
original_like_num: number;
post_upvote_stat: Array<StatUpvote>;
};
/**
* @description 互动信息
* @since Beta v0.7.2
* @interface StatUpvote
* @property {number} upvote_type 互动类型
* @property {number} upvote_cnt 互动数量
* @return StatUpvote
*/
type StatUpvote = { upvote_type: number; upvote_cnt: number };
/**
* @description 图片数据
* @since Beta v0.7.2
* @interface Image
* @property {string} url 图片 URL
* @property {number} height 图片高度
* @property {string} width 图片宽度
* @property {string} format 图片格式 // jpg
* @property {string} size 图片大小 // 281428
* @property {ImageCrop|null} crop 图片裁剪信息,可能为 null
* @property {boolean} is_user_set_cover 是否为封面
* @property {string} image_id 图片 ID
* @property {string} entity_type 图片类型 // IMG_ENTITY_POST, IMG_ENTITY_UNKOWN
* @property {string} entity_id 图片 ID
* @property {boolean} is_deleted 是否已删除
* @return Image
*/
type Image = {
url: string;
height: number;
width: number;
format: string;
size: string;
crop: ImageCrop | null;
is_user_set_cover?: boolean;
image_id: string;
entity_type: string;
entity_id: string;
is_deleted: boolean;
};
/**
* @description 图片裁剪信息
* @since Beta v0.7.2
* @interface ImageCrop
* @property {number} x 裁剪 X 轴
* @property {number} y 裁剪 Y 轴
* @property {number} w 裁剪宽度
* @property {number} h 裁剪高度
* @property {string} url 裁剪图片 URL
* @return ImageCrop
*/
type ImageCrop = { x: number; y: number; w: number; h: number; url: string };
/**
* @description help_sys 信息
* @since Beta v0.7.2
* @interface HelpSys
* @property {unknown} top_up 置顶, 可能为 null
* @property {Array<unknown>} top_n 置顶, 可能为空
* @property {number} answer_num 回答数
* @return HelpSys
*/
type HelpSys = { top_up: unknown | null; top_n: Array<unknown>; answer_num: number };
/**
* @description 合集信息
* @since Beta v0.7.2
* @interface Collection
* @property {string} prev_post_id 上一篇帖子 ID为 0 说明没有上一篇
* @property {string} next_post_id 下一篇帖子 ID为 0 说明没有下一篇
* @property {string} collection_id 合集 ID
* @property {number} cur 第几篇
* @property {number} total 总篇数
* @property {string} collection_title 合集标题
* @property {number} prev_post_game_id 上一篇帖子游戏 ID
* @property {number} next_post_game_id 下一篇帖子游戏 ID
* @property {number} prev_post_view_type 上一篇帖子浏览类型
* @property {number} next_post_view_type 下一篇帖子浏览类型
* @return Collection
*/
type Collection = {
prev_post_id: string;
next_post_id: string;
collection_id: string;
cur: number;
total: number;
collection_title: string;
prev_post_game_id: number;
next_post_game_id: number;
prev_post_view_type: number;
next_post_view_type: number;
};
/**
* @description 链接卡片信息
* @since Beta v0.7.2
* @interface LinkCard
* @property {string} button_text 按钮文本
* @property {string} card_id 卡片 ID
* @property {unknown} card_meta 卡片元数据
* @property {number} card_status 卡片状态
* @property {string} cover 封面图 URL
* @property {string} landing_url 落地页 URL
* @property {number} landing_url_type 落地页类型
* @property {number} link_type 链接类型
* @property {string} market_price 市场价
* @property {string} origin_url 原始 URL
* @property {string} origin_user_avatar 原始用户头像 URL
* @property {string} origin_user_avatar_url 原始用户头像 URL
* @property {string} origin_user_nickname 原始用户名
* @property {string} price 价格
* @property {string} title 标题
* @returns LinkCard
*/
type LinkCard = {
button_text: string;
card_id: string;
card_meta: unknown;
card_status: number;
cover: string;
landing_url: string;
landing_url_type: number;
link_type: number;
market_price: string;
origin_url: string;
origin_user_avatar: string;
origin_user_avatar_url: string;
origin_user_nickname: string;
price: string;
title: string;
};
/**
* @description 视频信息
* @since Beta v0.7.2
* @interface Vod
* @property {string} id 视频 ID
* @property {number} duration 视频时长
* @property {string} cover 视频封面图 URL
* @property {Array<VodResolution>} resolutions 视频分辨率信息
* @property {number} view_num 观看数
* @property {number} transcoding_status 转码状态
* @property {number} review_status 审核状态
* @property {string} brief_info 视频简介
* @return Vod
*/
type Vod = {
id: string;
duration: number;
cover: string;
resolutions: Array<VodResolution>;
view_num: number;
transcoding_status: number;
review_status: number;
brief_info: string;
};
/**
* @description 视频分辨率信息
* @since Beta v0.7.2
* @interface VodResolution
* @property {string} url 视频 URL
* @property {string} definition 视频清晰度
* @property {number} width 视频宽度
* @property {number} height 视频高度
* @property {number} bitrate 视频码率
* @property {string} size 视频大小
* @property {string} format 视频格式
* @property {string} label 视频标签
* @return VodResolution
*/
type VodResolution = {
url: string;
definition: string;
width: number;
height: number;
bitrate: number;
size: string;
format: string;
label: string;
};
/**
* @description 咨讯元数据,只有活动咨讯才有
* @since Beta v0.7.1
* @interface NewsMeta
* @property {number} activity_status 活动状态 // ActivityStatus
* @property {string} start_at_sec 活动开始时间戳,单位秒
* @property {string} end_at_sec 活动结束时间戳,单位秒
* @return NewsMeta
*/
type NewsMeta = { activity_status: number; start_at_sec: string; end_at_sec: string };
/**
* @description 推荐理由
* @since Beta v0.7.2
* @interface RecommendReason
* @property {Array<string>} tags 标签
* @property {boolean} is_mentor_rec_block 是否为导师推荐
* @return RecommendReason
*/
type RecommendReason = { tags: Array<string>; is_mentor_rec_block: boolean };
}

View File

@@ -1,7 +1,7 @@
/**
* @file types/BBS/Reply.d.ts
* @description 回复数据类型定义文件
* @since Beta v0.7.1
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Reply {
@@ -39,11 +39,11 @@ declare namespace TGApp.BBS.Reply {
* @description 子回复数据类型
* @since Beta v0.7.1
* @interface SubRootRes
* @property {TGApp.Plugins.Mys.Post.FullData} post - 帖子数据
* @property {TGApp.BBS.Post.FullData} post - 帖子数据
* @property {ReplyFull} reply - 回复数据
* @return SubRootRes
*/
type SubRootRes = { post: TGApp.Plugins.Mys.Post.FullData; reply: ReplyFull };
type SubRootRes = { post: TGApp.BBS.Post.FullData; reply: ReplyFull };
/**
* @description 回复数据类型
@@ -87,18 +87,18 @@ declare namespace TGApp.BBS.Reply {
/**
* @description 回复数据类型
* @since Beta v0.7.1
* @since Beta v0.7.2
* @interface ReplyFull
* @property {Reply} reply - 回复数据
* @property {User} user - 用户数据
* @property {Stat} stat - 点赞数据
* @property {SelfOperation} self_operation - 自身操作数据
* @property {TGApp.BBS.User.SelfOperation} self_operation - 自身操作数据
* @property {MasterStatus} master_status - 主楼状态数据
* @property {Array<TGApp.Plugins.Mys.Post.Image>} images - 图片数据
* @property {Array<TGApp.BBS.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 {User} r_user - 回复用户数据
* @property {unknown} r_reply - 未知数据
* @property {unknown} r_post - 未知数据
* @property {unknown} user_game_info - 未知数据
@@ -106,15 +106,15 @@ declare namespace TGApp.BBS.Reply {
*/
type ReplyFull = {
reply: Reply;
user: TGApp.Plugins.Mys.User.Reply;
user: User;
stat: Stat;
self_operation: SelfOperation;
self_operation: TGApp.BBS.User.SelfOperation;
master_status: MasterStatus;
images: Array<TGApp.Plugins.Mys.Post.Image>;
images: Array<TGApp.BBS.Post.Image>;
sub_replies: Array<ReplyFull>;
is_lz: boolean;
sub_reply_count: number;
r_user: TGApp.Plugins.Mys.User.Reply | null;
r_user: User | null;
r_reply: unknown;
r_post: unknown;
user_game_info: unknown;
@@ -175,6 +175,45 @@ declare namespace TGApp.BBS.Reply {
view_status: number;
};
/**
* @description 帖子回复中的用户信息
* @since Beta v0.7.2
* @interface User
* @property {string} uid 用户 ID
* @property {string} nickname 用户昵称
* @property {string} introduce 用户简介
* @property {string} avatar 用户头像
* @property {number} gender 用户性别
* @property {TGApp.BBS.User.Certification} certification 用户认证信息
* @property {TGApp.BBS.User.LevelExp} level_exp 用户等级经验
* @property {string} avatar_url 用户头像链接
* @property {string} pendant 用户挂件 URL可能为 ""
* @property {string} ip_region 用户 IP 地区
* @property {boolean} is_following 是否关注
* @property {boolean} is_followed 是否被关注
* @property {TGApp.BBS.User.AvatarExt} avatar_ext 用户头像扩展信息
* @property {boolean} is_super_fan 是否是铁粉
* @property {Bubble} reply_bubble 回复气泡,可能为 null
* @return User
*/
type User = {
uid: string;
nickname: string;
introduce: string;
avatar: string;
gender: number;
certification: TGApp.BBS.User.Certification;
level_exp: TGApp.BBS.User.LevelExp;
avatar_url: string;
pendant: string;
ip_region: string;
is_following: boolean;
is_followed: boolean;
avatar_ext: TGApp.BBS.User.AvatarExt;
is_super_fan: boolean;
reply_bubble: Bubble | null;
};
/**
* @description 回复气泡数据类型
* @since Beta v0.7.1
@@ -199,16 +238,6 @@ declare namespace TGApp.BBS.Reply {
*/
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

44
src/types/BBS/SctPost.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
* @file types/BBS/SctPost.d.ts
* @description 结构化帖子类型声明文件
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.SctPost {
/**
* @description 帖子结构化数据-基础类型
* @since Beta v0.6.7
* @interface Base
* @property {string | Record<string, unknown>} insert - 帖子内容
* @property {Record<string, unknown>} attributes - 帖子属性
* @property {Array<Base>} children - 子帖子
* @return Base
*/
type Base = {
insert: string | Record<string, unknown>;
attributes?: Record<string, unknown>;
children?: Array<Base>;
};
/**
* @description 帖子结构化数据-空类型
* @since Beta v0.3.4
* @interface Empty
* @property {never} insert - 帖子内容
* @property {never} attributes - 帖子属性
* @return Empty
*/
type Empty = { insert: never; attributes?: never };
/**
* @description 帖子结构化数据-其他类型
* @since Beta v0.6.7
* @property {string} describe - 描述
* @property {Array<string>} imgs - 图片链接
* @property {Array<string>} link_card_ids - 关联卡片ID
* @return Other
*/
type Other = { describe: string; imgs: Array<string>; link_card_ids?: Array<string> } & {
[key: string]: unknown;
};
}

View File

@@ -1,36 +0,0 @@
/**
* @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>;
};
}

View File

@@ -59,14 +59,14 @@ declare namespace TGApp.BBS.Topic {
* @property {boolean} is_last 是否最后一页
* @property {boolean} is_origin 是否原创
* @property {string} last_id 最后一条帖子 ID
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} posts 帖子列表
* @property {Array<TGApp.BBS.Post.FullData>} posts 帖子列表
* @return PostRes
*/
type PostRes = {
is_last: boolean;
is_origin: boolean;
last_id: string;
posts: Array<TGApp.Plugins.Mys.Post.FullData>;
posts: Array<TGApp.BBS.Post.FullData>;
};
/**

239
src/types/BBS/User.d.ts vendored Normal file
View File

@@ -0,0 +1,239 @@
/**
* @file types/BBS/User.d.ts
* @description 用户类型定义文件
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.User {
/**
* @description 用户信息返回
* @since Beta v0.7.2
* @interface InfoResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {InfoRes} data 用户信息
* @return InfoResp
*/
type InfoResp = TGApp.BBS.Response.BaseWithData<InfoRes>;
/**
* @description 主页用户信息
* @since Beta v0.7.2
* @interface InfoRes 用户信息
* @property {Info} user_info 用户信息
* @property {unknown} follow_relation 关注关系
* @property {unknown[]} auth_relations 认证关系
* @property {boolean} is_in_blacklist 是否在黑名单中
* @property {boolean} is_has_collection 是否有收藏
* @property {boolean} is_creator 是否是创作者
* @property custom_service 客服信息
* @property {boolean} custom_service.is_customer_service_staff 是否是客服
* @property {number} custom_service.game_id 游戏 ID
* @property audit_info 审核信息
* @property {boolean} audit_info.is_nickname_in_audit 是否在昵称审核中
* @property {string} audit_info.nickname 审核中的昵称
* @property {boolean} audit_info.is_introduce_in_audit 是否在简介审核中
* @property {string} audit_info.introduce 审核中的简介
* @property {number} audit_info.nickname_status 昵称审核状态
* @return InfoRes
*/
type InfoRes = {
user_info: Info;
follow_relation: unknown;
auth_relations: Array<unknown>;
is_in_blacklist: boolean;
is_has_collection: boolean;
is_creator: boolean;
custom_service: {
is_customer_service_staff: boolean;
game_id: number;
};
audit_info: {
is_nickname_in_audit: boolean;
nickname: string;
is_introduce_in_audit: boolean;
introduce: string;
nickname_status: number;
};
};
/**
* @description 主页用户信息-二级
* @since Beta v0.7.2
* @interface Info
* @property {string} uid 用户 ID
* @property {string} nickname 用户昵称
* @property {string} introduce 用户简介
* @property {string} avatar 用户头像编号
* @property {number} gender 用户性别
* @property {Certification} certification 用户认证信息
* @property {LevelExp[]} level_exps 用户等级经验
* @property {Archive} archive 用户档案
* @property {Community} community_info 用户社区信息
* @property {string} avatar_url 用户头像链接
* @property {Certification[]} certifications 用户认证信息
* @property {LevelExp} level_exp 用户等级经验
* @property {string} pendant 用户挂件 URL可能为 ""
* @property {boolean} is_logoff 是否注销
* @property {string} ip_region 用户 IP 地区
* @return Info
*/
type Info = {
uid: string;
nickname: string;
introduce: string;
avatar: string;
gender: number;
certification: Certification;
level_exps: Array<LevelExp>;
archive: Archive;
community_info: Community;
avatar_url: string;
certifications: Array<Certification>;
level_exp: LevelExp;
pendant: string;
is_logoff: boolean;
ip_region: string;
};
/**
* @description 用户认证信息
* @since Alpha v0.2.1
* @interface Certification
* @property {number} type 认证类型
* @property {string} label 认证标签
* @return Certification
*/
type Certification = { type: number; label: string };
/**
* @description 用户等级经验
* @since Beta v0.7.2
* @interface LevelExp
* @property {number} level 用户等级
* @property {number} exp 用户经验
* @property {number} game_id 游戏 ID
* @return LevelExp
*/
type LevelExp = { level: number; exp: number; game_id?: number };
/**
* @description 用户操作
* @since Beta v0.7.2
* @interface SelfOperation
* @property {number} attitude 操作类型
* @property {boolean} is_collected 是否收藏
* @property {number} upvote_type 互动类型
* @returns {SelfOperation}
*/
type SelfOperation = { attitude: number; is_collected: boolean; upvote_type: number };
/**
* @description 用户头像扩展信息
* @since Beta v0.7.2
* @interface AvatarExt
* @property {number} avatar_type 头像类型
* @property {string} avatar_assets_id 头像资源 ID
* @property {Array<unknown>} resources 资源
* @property {Array<unknown>} hd_resources 高清资源
* @return AvatarExt
*/
type AvatarExt = {
avatar_type: number;
avatar_assets_id: string;
resources: Array<unknown>;
hd_resources: Array<unknown>;
};
/**
* @description 用户档案
* @since Alpha v0.2.1
* @interface Archive
* @property {string} like_num 获赞数
* @property {string} post_num 发帖数
* @property {string} replypost_num 回帖数
* @property {string} follow_cnt 关注数
* @property {string} followed_cnt 被关注数
* @property {string} topic_cnt 话题数
* @property {string} new_follower_num 新粉丝数
* @property {string} good_post_num 精华帖数
* @property {string} follow_collection_cnt 收藏数
* @return Archive
*/
type Archive = {
like_num: string;
post_num: string;
replypost_num: string;
follow_cnt: string;
followed_cnt: string;
topic_cnt: string;
new_follower_num: string;
good_post_num: string;
follow_collection_cnt: string;
};
/**
* @description 用户社区信息
* @since Beta v0.7.2
* @interface Community
* @property {boolean} is_realname 是否实名
* @property {boolean} agree_status 是否同意协议
* @property {number} silent_end_time 禁言结束时间
* @property {number} forbid_end_time 封禁结束时间
* @property {number} info_upd_time 信息更新时间
* @property privacy_invisible 用户隐私设置
* @property {boolean} privacy_invisible.post 是否隐藏发帖
* @property {boolean} privacy_invisible.collect 是否隐藏收藏
* @property {boolean} privacy_invisible.watermark 是否隐藏水印
* @property {boolean} privacy_invisible.reply 是否隐藏回复
* @property {boolean} privacy_invisible.post_and_instant 是否隐藏发帖和即时
* @property notify_disable 用户通知设置
* @property {boolean} notify_disable.reply 是否禁用回复通知
* @property {boolean} notify_disable.upvote 是否禁用点赞通知
* @property {boolean} notify_disable.follow 是否禁用关注通知
* @property {boolean} notify_disable.system 是否禁用系统通知
* @property {boolean} notify_disable.chat 是否禁用聊天通知
* @property {boolean} has_initialized 是否初始化
* @property user_func_status 用户功能状态
* @property {boolean} user_func_status.enable_history_view 是否启用历史记录
* @property {boolean} user_func_status.enable_recommend 是否启用推荐
* @property {boolean} user_func_status.enable_mention 是否启用提及
* @property {number} user_func_status.user_center_view 是否启用用户中心\
* @property {unknown[]} forum_silent_info 论坛禁言信息
* @property {string} last_login_ip 上次登录 IP
* @property {number} last_login_time 上次登录时间
* @property {number} created_at 创建时间
* @return Community
*/
type Community = {
is_realname: boolean;
agree_status: boolean;
silent_end_time: number;
forbid_end_time: number;
info_upd_time: number;
privacy_invisible: {
post: boolean;
collect: boolean;
watermark: boolean;
reply: boolean;
post_and_instant: boolean;
};
notify_disable: {
reply: boolean;
upvote: boolean;
follow: boolean;
system: boolean;
chat: boolean;
};
has_initialized: boolean;
user_func_status: {
enable_history_view: boolean;
enable_recommend: boolean;
enable_mention: boolean;
user_center_view: number;
};
forum_silent_info: unknown[];
last_login_ip: string;
last_login_time: number;
created_at: number;
};
}

View File

@@ -17,7 +17,7 @@ declare namespace TGApp.Sqlite.UserCollection {
* @interface UFPost
* @property {string} id - 帖子 ID
* @property {string} title - 标题
* @description 反序列化后是 TGApp.Plugins.Mys.Post.FullData
* @description 反序列化后是 TGApp.BBS.Post.FullData
* @property {string} content - 内容
* @property {string} updated - 更新时间
* @return UFPost