♻️ 请求重构

This commit is contained in:
目棃
2025-03-07 17:53:35 +08:00
parent fee1872b46
commit ce5a88954a
22 changed files with 582 additions and 876 deletions

151
src/types/BBS/CaptchaLogin.d.ts vendored Normal file
View File

@@ -0,0 +1,151 @@
/**
* @file types/BBS/CaptchaLogin.d.ts
* @description 验证码登录类型声明
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.CaptchaLogin {
/**
* @description 获取短信验证码返回数据
* @since Beta v0.7.2
* @interface CaptchaResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {CaptchaRes} data 数据
* @return GetCaptchaResponse
*/
type CaptchaResp = TGApp.BBS.Response.BaseWithData<CaptchaRes>;
/**
* @description 获取短信验证码返回数据
* @since Beta v0.7.2
* @interface CaptchaRes
* @property {string} sent_new 是否发送新验证码
* @property {string} countdown 倒计时
* @property {string} action_type 操作类型
* @return CaptchaRes
*/
type CaptchaRes = { sent_new: string; countdown: string; action_type: string };
/**
* @description 触发验证的序列化数据
* @since Beta v0.7.2
* @interface CaptchaAigis
* @property {string} session_id 会话 id
* @property {number} mmt_type mmt 类型
* @see TGApp.BBS.Geetest.GeetestVerifyRes
* @property {string} data 数据,为上面的序列化数据
* @return CaptchaBody
*/
type CaptchaAigis = { session_id: string; mmt_type: number; data: string };
/**
* @description 短信验证码登录返回数据
* @since Beta v0.7.2
* @interface LoginResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {LoginRes} data 数据
* @return LoginResp
*/
type LoginResp = TGApp.BBS.Response.BaseWithData<LoginRes>;
/**
* @description 短信验证码登录返回数据
* @since Beta v0.7.2
* @interface LoginRes
* @property {Token} token token数据
* @property {UserInfo} user_info 用户信息
* @property {ReactivateInfo} reactivate_info 重新激活信息
* @property {string} login_ticket 登录 ticket
* @property {boolean} new_user 是否新用户
* @property {RealnameInfo} realname_info 实名信息
* @property {boolean} need_realperson 是否需要实名认证
* @property {string} oauth_hw_open_id 华为 open id
* @return LoginRes
*/
type LoginRes = {
token: Token;
user_info: UserInfo;
reactivate_info: ReactivateInfo;
login_ticket: string;
new_user: boolean;
realname_info: RealnameInfo;
need_realperson: boolean;
oauth_hw_open_id: string;
};
/**
* @description token 数据
* @since Beta v0.7.2
* @interface Token
* @property {number} token_type token 类型
* @property {string} token token
* @return Token
*/
type Token = { token_type: number; token: string };
/**
* @description 用户信息
* @since Beta v0.7.2
* @interface UserInfo
* @property {string} aid 账号 id
* @property {string} mid mid
* @property {string} account_name 账号名称
* @property {string} email 邮箱
* @property {number} is_email_verify 是否验证邮箱
* @property {string} area_code 手机区号
* @property {string} mobile 手机号
* @property {string} safe_area_code 安全手机区号
* @property {string} safe_mobile 安全手机号
* @property {string} realname 真实姓名
* @property {string} identity_code 身份证号
* @property {string} rebind_area_code 重新绑定手机区号
* @property {string} rebind_mobile 重新绑定手机号
* @property {string} rebind_mobile_time 重新绑定手机时间
* @property {string[]} links 账号绑定信息
* @property {string} country 国家
* @property {string} unmasked_email 邮箱
* @property {number} unmasked_email_type 邮箱类型
* @return UserInfo
*/
type UserInfo = {
aid: string;
mid: string;
account_name: string;
email: string;
is_email_verify: number;
area_code: string;
mobile: string;
safe_area_code: string;
safe_mobile: string;
realname: string;
identity_code: string;
rebind_area_code: string;
rebind_mobile: string;
rebind_mobile_time: string;
links: string[];
country: string;
unmasked_email: string;
unmasked_email_type: number;
};
/**
* @description 重新激活信息
* @since Beta v0.7.2
* @interface ReactivateInfo
* @property {boolean} required 是否需要重新激活
* @property {string} ticket 重新激活 ticket
* @return ReactivateInfo
*/
type ReactivateInfo = { required: boolean; ticket: string };
/**
* @description 实名信息
* @since Beta v0.7.2
* @interface RealnameInfo
* @property {boolean} required 是否需要实名认证
* @property {string} action_type 操作类型
* @property {string} action_ticket 操作 ticket
* @return RealnameInfo
*/
type RealnameInfo = { required: boolean; action_type: string; action_ticket: string };
}

82
src/types/BBS/Emoji.d.ts vendored Normal file
View File

@@ -0,0 +1,82 @@
/**
* @file types/BBS/Emoji.d.ts
* @description 表情包类型声明文件
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Emoji {
/**
* @description 获取表情包列表返回
* @since Beta v0.7.2
* @interface Resp
* @extends TGApp.BBS.Response.BaseWithData
* @property {Series[]} data.list 表情包列表
* @property {unknown} data.recently_emoticon 最近使用的表情包
* @return Resp
*/
type Resp = TGApp.BBS.Response.BaseWithData<Res>;
/**
* @description 获取表情包列表返回
* @since Beta v0.7.2
* @interface Res
* @property {Array<Series>} list 表情包列表
* @property {unknown} recently_emoticon 最近使用的表情包
* @return Res;
*/
type Res = { list: Array<Series>; recently_emoticon: unknown };
/**
* @description 表情包系列
* @since Beta v0.7.2
* @interface Series
* @property {number} id 表情包系列 ID
* @property {string} name 表情包系列名称
* @property {string} icon 表情包系列图标
* @property {number} sort_order 表情包系列排序
* @property {number} num 表情包系列数量
* @property {string} status 表情包系列状态
* @property {Item[]} list 表情包系列列表
* @property {number} updated_at 表情包系列更新时间
* @property {boolean} is_available 表情包系列是否可用
* @return Series
*/
type Series = {
id: number;
name: string;
icon: string;
sort_order: number;
num: number;
status: string;
list: Array<Item>;
updated_at: number;
is_available: boolean;
};
/**
* @description 表情包
* @since Beta v0.7.2
* @interface Item
* @property {number} id 表情包 ID
* @property {string} name 表情包名称
* @property {string} icon 表情包图标
* @property {number} sort_order 表情包排序
* @property {string} static_icon 表情包静态图标
* @property {number} updated_at 表情包更新时间
* @property {boolean} is_available 表情包是否可用
* @property {string} status 表情包状态
* @property {unknown[]} keywords 表情包关键词
* @return Item
*/
type Item = {
id: number;
name: string;
icon: string;
sort_order: number;
static_icon: string;
updated_at: number;
is_available: boolean;
status: string;
keywords: Array<unknown>;
};
}

143
src/types/BBS/Obc.d.ts vendored Normal file
View File

@@ -0,0 +1,143 @@
/**
* @file types/BBS/Obc.d.ts
* @description 观测枢相关请求类型
* @since Beta v0.7.2
*/
declare namespace TGApp.BBS.Obc {
/**
* @description 卡池返回响应
* @since Beta v0.7.2
* @interface GachaResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {GachaRes} data
* @return GachaResp
*/
type GachaResp = TGApp.BBS.Response.BaseWithData<GachaRes>;
/**
* @description 卡池返回数据
* @since Beta v0.7.2
* @interface GachaRes
* @property {Array<GachaItem>} list 卡池列表
* @return GachaRes
*/
type GachaRes = { list: Array<GachaItem> };
/**
* @description 卡池信息
* @since Beta v0.7.2
* @interface GachaItem
* @property {string} id 卡池ID
* @property {string} title 卡池标题
* @property {string} activity_url 卡池对应帖子
* @property {string} content_before_act 卡池内容
* @property {Array<GachaPool>} pool 卡池角色头像
* @property {string} voice_icon 卡池角色语音头像
* @property {string} voice_url 卡池角色语音URL
* @property {string} voice_status 卡池角色语音状态
* @description 如下时间示例2023-03-21 17:59:59
* @property {string} start_time 卡池开始时间
* @property {string} end_time 卡池结束时间
* @return GachaItem
*/
type GachaItem = {
id: number;
title: string;
activity_url: string;
content_before_act: string;
pool: Array<GachaPool>;
voice_icon: string;
voice_url: string;
voice_status: string;
start_time: string;
end_time: string;
};
/**
* @description 卡池数据
* @since Beta v0.7.2
* @interface GachaPool
* @property {string} icon 头像
* @property {string} url 链接
* @return GachaPool
*/
type GachaPool = { icon: string; url: string };
/**
* @description 活动返回响应
* @since Beta v0.7.2
* @interface PositionResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {PositionRes} data
* @return PositionResp
*/
type PositionResp = TGApp.BBS.Response.BaseWithData<PositionRes>;
/**
* @description 活动返回数据
* @since Beta v0.7.2
* @interface PositionRes
* @property {Array<PositionItem>} list 活动列表
* @return PositionRes
*/
type PositionRes = { list: Array<ObcItem<PositionItem>> };
/**
* @description 观测枢通用接口
* @since Beta v0.7.2
* @interface ObcItem
* @template T
* @property {number} id ID
* @property {string} name 名称
* @property {number} parent_id 父ID
* @property {number} depth 深度
* @property {string} ch_ext 结构化扩展信息
* @property {Array<ObcItem>} children 子项递归
* @property {Array<T>} list 列表
*/
type ObcItem<T = unknown> = {
id: number;
name: string;
parent_id: number;
depth: number;
ch_ext: string;
children: Array<ObcItem<T>>;
list: Array<T>;
};
/**
* @description 热点追踪信息
* @since Beta v0.7.2
* @interface PositionItem
* @property {number} recommend_id 推荐ID
* @property {number} content_id 内容ID
* @property {string} title 标题
* @property {string} ext 扩展信息
* @property {number} type 类型
* @property {string} url 链接
* @property {string} icon 图标
* @property {string} abstract 摘要
* @property {string} article_user_name 作者
* @property {string} avatar_url 头像
* @property {string} article_time 时间
* @property {string} create_time 创建时间 // 2023-03-31 11:16:57
* @property {string} end_time 结束时间 // 1680465599000
* @return PositionItem
*/
type PositionItem = {
recommend_id: number;
content_id: number;
title: string;
ext: string;
type: number;
url: string;
icon: string;
abstract: string;
article_user_name: string;
avatar_url: string;
article_time: string;
create_time: string;
end_time: string;
};
}