bigbuffet-rw/packages/pl-api/lib/entities/conversation.ts
marcin mikołajczak 036fa32cd3 Add pl-api to workspace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:43:23 +02:00

17 lines
488 B
TypeScript

import { z } from 'zod';
import { filteredArray } from './utils';
import { accountSchema, statusSchema } from '.';
/** @see {@link https://docs.joinmastodon.org/entities/Conversation} */
const conversationSchema = z.object({
id: z.string(),
unread: z.boolean().catch(false),
accounts: filteredArray(accountSchema),
last_status: statusSchema.nullable().catch(null),
});
type Conversation = z.infer<typeof conversationSchema>;
export { conversationSchema, type Conversation };