Add pl-api to workspace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
22
packages/pl-api/lib/entities/status-source.ts
Normal file
22
packages/pl-api/lib/entities/status-source.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Resolve } from '../utils/types';
|
||||
|
||||
import { locationSchema } from './location';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/StatusSource/} */
|
||||
const statusSourceSchema = z.object({
|
||||
id: z.string(),
|
||||
text: z.string().catch(''),
|
||||
spoiler_text: z.string().catch(''),
|
||||
|
||||
content_type: z.string().catch('text/plain'),
|
||||
location: locationSchema.nullable().catch(null),
|
||||
|
||||
text_map: z.record(z.string()).nullable().catch(null),
|
||||
spoiler_text_map: z.record(z.string()).nullable().catch(null),
|
||||
});
|
||||
|
||||
type StatusSource = Resolve<z.infer<typeof statusSourceSchema>>;
|
||||
|
||||
export { statusSourceSchema, type StatusSource };
|
||||
Reference in New Issue
Block a user