bigbuffet-rw/packages/pl-api/lib/entities/conversation.ts
marcin mikołajczak bc65755862 pl-api: Update docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-11-29 16:01:54 +01:00

23 lines
605 B
TypeScript

import * as v from 'valibot';
import { accountSchema } from './account';
import { statusSchema } from './status';
import { filteredArray } from './utils';
/**
* @category Schemas
* @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),
});
/**
* @category Entity types
*/
type Conversation = v.InferOutput<typeof conversationSchema>;
export { conversationSchema, type Conversation };