feat(data): add paywall payment APIs

This commit is contained in:
2026-06-18 12:53:06 +08:00
parent 567d3f9184
commit 35c30ac31e
38 changed files with 840 additions and 10 deletions
@@ -13,6 +13,10 @@ export class ChatHistoryResponse {
declare readonly total: number;
declare readonly limit: number;
declare readonly offset: number;
declare readonly isVip: boolean;
declare readonly privateFreeLimit: number;
declare readonly privateUsedToday: number;
declare readonly privateCanViewFree: boolean;
private constructor(input: ChatHistoryResponseInput) {
const data = ChatHistoryResponseSchema.parse(input);
+3
View File
@@ -12,6 +12,9 @@ export class ChatMessage {
declare readonly content: string;
declare readonly id: string;
declare readonly createdAt: string;
declare readonly isPrivate: boolean | null;
declare readonly privateLocked: boolean | null;
declare readonly privateHint: string | null;
private constructor(input: ChatMessageInput) {
const data = ChatMessageSchema.parse(input);
+9 -1
View File
@@ -5,6 +5,7 @@ import {
ChatSendResponseSchema,
type ChatSendResponseInput,
type ChatSendResponseData,
type ChatBlockDetailData,
} from "@/data/schemas/chat/chat_send_response";
export class ChatSendResponse {
@@ -12,13 +13,20 @@ export class ChatSendResponse {
declare readonly reply: string;
declare readonly voiceUrl: string;
declare readonly audioUrl: string;
declare readonly intimidadChange: number;
declare readonly intimacyChange: number;
declare readonly newIntimacy: number;
declare readonly relationshipStage: string;
declare readonly currentMood: string;
declare readonly messageId: string;
declare readonly isGuest: boolean;
declare readonly timestamp: number;
declare readonly blocked: boolean | null;
declare readonly blockReason: string | null;
declare readonly blockDetail: ChatBlockDetailData | null;
declare readonly paywallTriggered: boolean;
declare readonly showUpgrade: boolean;
declare readonly imageType: string | null;
declare readonly imageUrl: string | null;
private constructor(input: ChatSendResponseInput) {
const data = ChatSendResponseSchema.parse(input);
+2
View File
@@ -14,3 +14,5 @@ export * from "./send_message_request";
export * from "./stt_data";
export * from "./sync_message";
export * from "./ui_message";
export * from "./unlock_private_request";
export * from "./unlock_private_response";
@@ -0,0 +1,30 @@
/**
* 私密消息解锁请求 DTO
*/
import {
UnlockPrivateRequestSchema,
type UnlockPrivateRequestData,
type UnlockPrivateRequestInput,
} from "@/data/schemas/chat/unlock_private_request";
export class UnlockPrivateRequest {
declare readonly messageId: string;
private constructor(input: UnlockPrivateRequestInput) {
const data = UnlockPrivateRequestSchema.parse(input);
Object.assign(this, data);
Object.freeze(this);
}
static from(input: UnlockPrivateRequestInput): UnlockPrivateRequest {
return new UnlockPrivateRequest(input);
}
static fromJson(json: unknown): UnlockPrivateRequest {
return UnlockPrivateRequest.from(json as UnlockPrivateRequestInput);
}
toJson(): UnlockPrivateRequestData {
return UnlockPrivateRequestSchema.parse(this);
}
}
@@ -0,0 +1,37 @@
/**
* 私密消息解锁响应 DTO
*/
import {
UnlockPrivateResponseSchema,
type UnlockPrivateReason,
type UnlockPrivateResponseData,
type UnlockPrivateResponseInput,
} from "@/data/schemas/chat/unlock_private_response";
export class UnlockPrivateResponse {
declare readonly unlocked: boolean;
declare readonly content: string | null;
declare readonly showUpgrade: boolean;
declare readonly paywallTriggered: boolean;
declare readonly privateFreeLimit: number;
declare readonly privateUsedToday: number;
declare readonly reason: UnlockPrivateReason;
private constructor(input: UnlockPrivateResponseInput) {
const data = UnlockPrivateResponseSchema.parse(input);
Object.assign(this, data);
Object.freeze(this);
}
static from(input: UnlockPrivateResponseInput): UnlockPrivateResponse {
return new UnlockPrivateResponse(input);
}
static fromJson(json: unknown): UnlockPrivateResponse {
return UnlockPrivateResponse.from(json as UnlockPrivateResponseInput);
}
toJson(): UnlockPrivateResponseData {
return UnlockPrivateResponseSchema.parse(this);
}
}