fix(chat): update unlock response contract
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
/**
|
||||
* 私密消息解锁响应
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const UnlockPrivateReasonSchema = z.enum([
|
||||
"ok",
|
||||
"quota_exceeded",
|
||||
"not_private",
|
||||
"not_found",
|
||||
]);
|
||||
import { ChatLockDetailSchema } from "./chat_payloads";
|
||||
|
||||
/**
|
||||
* 单条历史付费 / 私密消息解锁响应。
|
||||
*/
|
||||
export const UnlockPrivateReasonSchema = z.string().default("");
|
||||
|
||||
export const UnlockPrivateResponseSchema = z.object({
|
||||
unlocked: z.boolean(),
|
||||
content: z.string().nullable(),
|
||||
showUpgrade: z.boolean().default(false),
|
||||
paywallTriggered: z.boolean().default(false),
|
||||
privateFreeLimit: z.number().default(0),
|
||||
privateUsedToday: z.number().default(0),
|
||||
content: z.string().default(""),
|
||||
reason: UnlockPrivateReasonSchema,
|
||||
creditBalance: z.number().default(0),
|
||||
creditsCharged: z.number().default(0),
|
||||
requiredCredits: z.number().default(0),
|
||||
shortfallCredits: z.number().default(0),
|
||||
lockDetail: ChatLockDetailSchema,
|
||||
});
|
||||
|
||||
export type UnlockPrivateReason = z.output<typeof UnlockPrivateReasonSchema>;
|
||||
|
||||
Reference in New Issue
Block a user