Files
ncd-fe/packages/pl-api/lib/entities/account-warning.ts
nicole mikołajczyk ad00129411 pl-api: migrate to oxfmt+oxlint
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2026-02-15 03:00:05 +01:00

40 lines
1019 B
TypeScript

import * as v from 'valibot';
import { accountSchema } from './account';
import { datetimeSchema } from './utils';
/** @see {@link https://docs.joinmastodon.org/entities/Appeal/} */
const appealSchema = v.object({
text: v.string(),
state: v.picklist(['approved', 'rejected', 'pending']),
});
/**
* @category Schemas
* @see {@link https://docs.joinmastodon.org/entities/AccountWarning/}
*/
const accountWarningSchema = v.object({
id: v.string(),
action: v.picklist([
'none',
'disable',
'mark_statuses_as_sensitive',
'delete_statuses',
'sensitive',
'silence',
'suspend',
]),
text: v.fallback(v.string(), ''),
status_ids: v.fallback(v.array(v.string()), []),
target_account: accountSchema,
appeal: v.fallback(v.nullable(appealSchema), null),
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
});
/**
* @category Entity types
*/
type AccountWarning = v.InferOutput<typeof accountWarningSchema>;
export { accountWarningSchema, type AccountWarning };