bigbuffet-rw/packages/pl-api/lib/entities/chat.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

24 lines
629 B
TypeScript

import * as v from 'valibot';
import { accountSchema } from './account';
import { chatMessageSchema } from './chat-message';
import { datetimeSchema } from './utils';
/**
* @category Schemas
* @see {@link https://docs.pleroma.social/backend/development/API/chats/#getting-a-list-of-chats}
*/
const chatSchema = v.object({
id: v.string(),
account: accountSchema,
unread: v.pipe(v.number(), v.integer()),
last_message: v.fallback(v.nullable(chatMessageSchema), null),
updated_at: datetimeSchema,
});
/**
* @category Entity types
*/
type Chat = v.InferOutput<typeof chatSchema>;
export { chatSchema, type Chat };