返回 AiToEarn
threads.schema.ts
1 import { z } from 'zod'
2 import { ThreadsMediaType } from './threads.interface'
3
4 export enum ThreadsReplyControl {
5 Everyone = 'everyone',
6 AccountsYouFollow = 'accounts_you_follow',
7 MentionedOnly = 'mentioned_only',
8 ParentPostAuthorOnly = 'parent_post_author_only',
9 FollowersOnly = 'followers_only',
10 }
11
12 export const ThreadsOptionSchema = z.object({
13 reply_control: z.enum(ThreadsReplyControl).optional().describe('回复控制'),
14 location_id: z.string().min(1).optional().describe('位置 ID'),
15 allowlisted_country_codes: z.array(z.string()).optional().describe('允许的国家代码'),
16 alt_text: z.string().max(1000).optional().describe('替代文本'),
17 auto_publish_text: z.boolean().optional().describe('是否自动发布文本'),
18 link_attachment: z.httpUrl().optional().describe('链接附件 URL'),
19 reply_to_id: z.string().optional().describe('回复的 Threads 帖子 ID'),
20 quote_post_id: z.string().optional().describe('引用的 Threads 帖子 ID'),
21 })
22
23 export type ThreadsOption = z.infer<typeof ThreadsOptionSchema>
24
25 export const ThreadsPublishDataOptionSchema = z.object({
26 containerId: z.string().min(1).optional().describe('Threads 临时 creation/container ID'),
27 childContainerIds: z.array(z.string().min(1)).optional().describe('Threads carousel 子 container ID'),
28 mediaType: z.enum(ThreadsMediaType).optional().describe('Threads 发布媒体类型'),
29 text: z.string().optional().describe('Threads carousel 总 container 正文'),
30 topicTag: z.string().min(1).optional().describe('Threads topic_tag'),
31 locationId: z.string().min(1).optional().describe('Threads location_id'),
32 replyToId: z.string().min(1).optional().describe('Threads reply_to_id'),
33 replyControl: z.enum(ThreadsReplyControl).optional().describe('Threads reply_control'),
34 allowlistedCountryCodes: z.array(z.string().min(1)).optional().describe('Threads allowlisted_country_codes'),
35 altText: z.string().min(1).optional().describe('Threads alt_text'),
36 linkAttachmentUrl: z.httpUrl().optional().describe('Threads link_attachment'),
37 quotePostId: z.string().min(1).optional().describe('Threads quote_post_id'),
38 })
39
40 export type ThreadsPublishDataOption = z.infer<typeof ThreadsPublishDataOptionSchema>
41
41 lines TYPESCRIPT