Files
ncd-fe/packages/pl-api/lib/entities/drive-file.ts
Nicole Mikołajczyk ab600db727 pl-api: Support Iceshrimp.NET drive
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
2025-05-27 13:03:09 +02:00

30 lines
671 B
TypeScript

import * as v from 'valibot';
/**
* @category Schemas
*/
const driveFileSchema = v.pipe(v.any(), v.transform((file) => ({
...file,
thumbnail_url: file.thumbnailUrl,
content_type: file.contentType,
is_avatar: file.isAvatar,
is_banner: file.isBanner,
})), v.object({
id: v.string(),
url: v.string(),
thumbnail_url: v.string(),
filename: v.string(),
content_type: v.string(),
sensitive: v.boolean(),
description: v.fallback(v.nullable(v.string()), null),
is_avatar: v.boolean(),
is_banner: v.boolean(),
}));
/**
* @category Entity types
*/
type DriveFile = v.InferOutput<typeof driveFileSchema>;
export { driveFileSchema, type DriveFile };