feat(private-zone): add paid video moments
Docker Image / Build and Push Docker Image (push) Successful in 2m5s

This commit is contained in:
Codex
2026-07-24 20:17:28 +08:00
parent 30ab2c2c97
commit 0d5b5c17fa
25 changed files with 1578 additions and 43 deletions
@@ -0,0 +1,49 @@
import {
PrivateZonePostsResponseSchema,
PrivateZonePostUnlockResponseSchema,
type PrivateZonePostsResponse,
type PrivateZonePostUnlockResponse,
type UnlockPrivateZonePostRequest,
} from "@/data/schemas/private-zone";
import { ApiPath } from "./api_path";
import { httpClient } from "./http_client";
import { type ApiEnvelope, unwrap } from "./response_helper";
export interface GetPrivateZonePostsInput {
characterId: string;
limit?: number;
cursor?: string | null;
}
export class PrivateZonePostApi {
async getPosts(
input: GetPrivateZonePostsInput,
): Promise<PrivateZonePostsResponse> {
const env = await httpClient<ApiEnvelope<unknown>>(
ApiPath.privateZonePosts,
{
query: {
characterId: input.characterId,
limit: input.limit ?? 20,
cursor: input.cursor || undefined,
},
},
);
return PrivateZonePostsResponseSchema.parse(unwrap(env));
}
async unlockPost(
postId: string,
body: UnlockPrivateZonePostRequest,
): Promise<PrivateZonePostUnlockResponse> {
const env = await httpClient<ApiEnvelope<unknown>>(
ApiPath.privateZonePostUnlock(postId),
{ method: "POST", body },
);
const parsed = PrivateZonePostUnlockResponseSchema.parse(unwrap(env));
return parsed.postId ? parsed : { ...parsed, postId };
}
}
export const privateZonePostApi = new PrivateZonePostApi();