2024-08-28 04:43:23 -07:00
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
import { mediaAttachmentSchema } from './media-attachment';
|
|
|
|
import { filteredArray } from './utils';
|
|
|
|
|
|
|
|
/** @see {@link https://docs.joinmastodon.org/entities/ScheduledStatus/} */
|
|
|
|
const scheduledStatusSchema = z.object({
|
|
|
|
id: z.string(),
|
|
|
|
scheduled_at: z.string().datetime({ offset: true }),
|
|
|
|
params: z.object({
|
|
|
|
text: z.string().nullable().catch(null),
|
|
|
|
poll: z.object({
|
|
|
|
options: z.array(z.string()),
|
|
|
|
expires_in: z.coerce.string(),
|
|
|
|
multiple: z.boolean().optional().catch(undefined),
|
|
|
|
hide_totals: z.boolean().optional().catch(undefined),
|
|
|
|
}).nullable().catch(null),
|
|
|
|
media_ids: z.array(z.string()).nullable().catch(null),
|
|
|
|
sensitive: z.coerce.boolean().nullable().catch(null),
|
|
|
|
spoiler_text: z.string().nullable().catch(null),
|
|
|
|
visibility: z.string().catch('public'),
|
|
|
|
in_reply_to_id: z.string().nullable().catch(null),
|
|
|
|
language: z.string().nullable().catch(null),
|
|
|
|
application_id: z.number().int().nullable().catch(null),
|
|
|
|
scheduled_at: z.string().datetime({ offset: true }).nullable().catch(null),
|
|
|
|
idempotency: z.string().nullable().catch(null),
|
|
|
|
with_rate_limit: z.boolean().catch(false),
|
|
|
|
|
|
|
|
expires_in: z.number().nullable().catch(null),
|
|
|
|
}),
|
|
|
|
media_attachments: filteredArray(mediaAttachmentSchema),
|
|
|
|
});
|
|
|
|
|
2024-08-29 13:48:58 -07:00
|
|
|
type ScheduledStatus = z.infer<typeof scheduledStatusSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { scheduledStatusSchema, type ScheduledStatus };
|