bigbuffet-rw/packages/pl-api/lib/entities/conversation.ts
marcin mikołajczak 77c0689321 pl-api: Avoid barrel imports
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-20 12:53:12 +02:00

17 lines
546 B
TypeScript

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