2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
import { dateSchema } from '../utils';
|
|
|
|
|
|
|
|
/** @see {@link https://docs.joinmastodon.org/entities/Admin_IpBlock/} */
|
2024-10-13 15:25:30 -07:00
|
|
|
const adminIpBlockSchema = v.object({
|
|
|
|
id: v.string(),
|
2024-08-28 04:43:23 -07:00
|
|
|
ip: z.string().ip(),
|
|
|
|
severity: z.enum(['sign_up_requires_approval', 'sign_up_block', 'no_access']),
|
2024-10-13 15:25:30 -07:00
|
|
|
comment: v.fallback(v.string(), ''),
|
2024-08-28 04:43:23 -07:00
|
|
|
created_at: dateSchema,
|
|
|
|
expires_at: z.string().datetime({ offset: true }),
|
|
|
|
});
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type AdminIpBlock = v.InferOutput<typeof adminIpBlockSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export {
|
|
|
|
adminIpBlockSchema,
|
|
|
|
type AdminIpBlock,
|
|
|
|
};
|