28 lines
895 B
TypeScript
28 lines
895 B
TypeScript
|
import { z } from 'zod';
|
||
|
|
||
|
import { Resolve } from '../utils/types';
|
||
|
|
||
|
import { accountSchema } from './account';
|
||
|
import { dateSchema } from './utils';
|
||
|
|
||
|
/** @see {@link https://docs.joinmastodon.org/entities/Appeal/} */
|
||
|
const appealSchema = z.object({
|
||
|
text: z.string(),
|
||
|
state: z.enum(['approved', 'rejected', 'pending']),
|
||
|
});
|
||
|
|
||
|
/** @see {@link https://docs.joinmastodon.org/entities/AccountWarning/} */
|
||
|
const accountWarningSchema = z.object({
|
||
|
id: z.string(),
|
||
|
action: z.enum(['none', 'disable', 'mark_statuses_as_sensitive', 'delete_statuses', 'sensitive', 'silence', 'suspend']),
|
||
|
text: z.string().catch(''),
|
||
|
status_ids: z.array(z.string()).catch([]),
|
||
|
target_account: accountSchema,
|
||
|
appeal: appealSchema.nullable().catch(null),
|
||
|
created_at: dateSchema,
|
||
|
});
|
||
|
|
||
|
type AccountWarning = Resolve<z.infer<typeof accountWarningSchema>>;
|
||
|
|
||
|
export { accountWarningSchema, type AccountWarning };
|