Files
ncd-fe/packages/pl-api/lib/entities/quote.ts
nicole mikołajczyk 31ae3d1866 pl-api: fix build
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2026-03-22 17:39:48 +01:00

49 lines
1.1 KiB
TypeScript

import * as v from 'valibot';
import { type Status, statusSchema } from './status';
const quoteStateSchema = v.picklist([
'pending',
'accepted',
'rejected',
'revoked',
'deleted',
'unauthorized',
'blocked_account',
'blocked_domain',
'muted_account',
]);
/**
* @category Schemas
* @see {@link https://docs.joinmastodon.org/entities/Quote/}
*/
const quoteSchema = v.object({
state: v.fallback(quoteStateSchema, 'accepted'),
quoted_status: v.fallback(v.nullable(v.lazy(() => statusSchema)), null),
});
/**
* @category Entity types
*/
interface Quote {
state: v.InferOutput<typeof quoteStateSchema>;
quoted_status: Status | null;
}
/**
* @category Schemas
* @see {@link https://docs.joinmastodon.org/entities/ShallowQuote/}
*/
const shallowQuoteSchema = v.object({
state: v.fallback(quoteStateSchema, 'accepted'),
quoted_status_id: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type ShallowQuote = v.InferOutput<typeof shallowQuoteSchema>;
export { quoteSchema, shallowQuoteSchema, type Quote, type ShallowQuote };