136 lines
4.3 KiB
TypeScript
136 lines
4.3 KiB
TypeScript
/**
|
|
* API 路径管理
|
|
* 统一管理所有接口路径
|
|
*
|
|
*/
|
|
import apiContract from "./api_contract.json";
|
|
|
|
export class ApiPath {
|
|
private constructor() {}
|
|
|
|
// ============ 认证相关 ============
|
|
/** 邮箱密码登录 */
|
|
static readonly emailLogin = apiContract.emailLogin.path;
|
|
|
|
/** 注册 */
|
|
static readonly register = apiContract.register.path;
|
|
|
|
/** 设备自动登录 */
|
|
static readonly guestLogin = apiContract.guestLogin.path;
|
|
|
|
/** Google 登录 */
|
|
static readonly googleLogin = apiContract.googleLogin.path;
|
|
|
|
/** Facebook 登录 */
|
|
static readonly facebookLogin = apiContract.facebookLogin.path;
|
|
|
|
/** Facebook ID 登录(v7.0 新增) */
|
|
static readonly facebookIdLogin = apiContract.facebookIdLogin.path;
|
|
|
|
/** 消费一次性充值登录凭证 */
|
|
static readonly topUpHandoffConsume = apiContract.topUpHandoffConsume.path;
|
|
|
|
/** 刷新 Token */
|
|
static readonly refresh = apiContract.refresh.path;
|
|
|
|
/** 退出登录 */
|
|
static readonly logout = apiContract.logout.path;
|
|
|
|
/** 获取当前用户信息 */
|
|
static readonly getCurrentUser = apiContract.getCurrentUser.path;
|
|
|
|
// ============ 用户相关 ============
|
|
/** 获取个人信息(与 /auth/me 等价) */
|
|
static readonly userProfile = apiContract.userProfile.path;
|
|
|
|
/** 获取当前用户权益快照 */
|
|
static readonly userEntitlements = apiContract.userEntitlements.path;
|
|
|
|
/** 绑定 Facebook ASID / PSID */
|
|
static readonly userFacebookIdentity =
|
|
apiContract.userFacebookIdentity.path;
|
|
|
|
// ============ 支付相关 ============
|
|
/** 创建充值订单 */
|
|
static readonly paymentCreateOrder = apiContract.paymentCreateOrder.path;
|
|
|
|
/** 查询订单状态 */
|
|
static readonly paymentOrderStatus = apiContract.paymentOrderStatus.path;
|
|
|
|
/** 获取商品套餐列表 */
|
|
static readonly paymentPlans = apiContract.paymentPlans.path;
|
|
|
|
/** 获取角色的完整礼物目录 */
|
|
static readonly paymentGiftProducts = apiContract.paymentGiftProducts.path;
|
|
|
|
/** 获取已支付礼物订单的角色感谢文案 */
|
|
static readonly paymentTipMessage = apiContract.paymentTipMessage.path;
|
|
|
|
/** 接受角色发放的用户专属优惠 */
|
|
static paymentCommercialOfferAccept(offerId: string): string {
|
|
return apiContract.paymentCommercialOfferAccept.path.replace(
|
|
"{offerId}",
|
|
encodeURIComponent(offerId),
|
|
);
|
|
}
|
|
|
|
// ============ 聊天相关 ============
|
|
/** 发送消息 */
|
|
static readonly chatSend = apiContract.chatSend.path;
|
|
|
|
/** 记录角色聊天操作卡漏斗事件 */
|
|
static readonly chatActionEvents = apiContract.chatActionEvents.path;
|
|
|
|
/** 幂等保存角色开场白 */
|
|
static readonly chatOpeningMessage = apiContract.chatOpeningMessage.path;
|
|
|
|
/** 获取聊天历史 */
|
|
static readonly chatHistory = apiContract.chatHistory.path;
|
|
|
|
/** 解锁私密消息 */
|
|
static readonly chatUnlockPrivate = apiContract.chatUnlockPrivate.path;
|
|
|
|
/** 一键解锁历史锁定消息 */
|
|
static readonly chatUnlockHistory = apiContract.chatUnlockHistory.path;
|
|
|
|
// ============ 私密空间相关 ============
|
|
/** 获取私密图片包列表 */
|
|
static readonly privateZoneAlbums = apiContract.privateZoneAlbums.path;
|
|
|
|
/** 解锁私密图片包 */
|
|
static privateZoneAlbumUnlock(albumId: string): string {
|
|
return apiContract.privateZoneAlbumUnlock.path.replace(
|
|
"{albumId}",
|
|
encodeURIComponent(albumId),
|
|
);
|
|
}
|
|
|
|
/** 获取 Private Zone 付费视频朋友圈 */
|
|
static readonly privateZonePosts = apiContract.privateZonePosts.path;
|
|
|
|
/** 解锁单条 Private Zone 付费视频朋友圈 */
|
|
static privateZonePostUnlock(postId: string): string {
|
|
return apiContract.privateZonePostUnlock.path.replace(
|
|
"{postId}",
|
|
encodeURIComponent(postId),
|
|
);
|
|
}
|
|
|
|
// ============ 数据看板相关 ============
|
|
/** 上报 PWA 事件 */
|
|
static readonly metricsPwaEvent = apiContract.metricsPwaEvent.path;
|
|
|
|
// ============ 数据上报相关(v7.0 新增) ============
|
|
/** 上报用户信息 */
|
|
static readonly reportUserInfo = apiContract.reportUserInfo.path;
|
|
|
|
// ============ 用户反馈相关 ============
|
|
static readonly feedback = apiContract.feedback.path;
|
|
|
|
// ============ 角色目录相关 ============
|
|
static readonly characters = apiContract.characters.path;
|
|
|
|
static readonly chatPreviews = apiContract.chatPreviews.path;
|
|
|
|
}
|