47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { Type, type Static } from "@sinclair/typebox";
|
|
|
|
const FileType = Type.Union([
|
|
Type.Literal("doc"),
|
|
Type.Literal("docx"),
|
|
Type.Literal("sheet"),
|
|
Type.Literal("bitable"),
|
|
Type.Literal("folder"),
|
|
Type.Literal("file"),
|
|
Type.Literal("mindnote"),
|
|
Type.Literal("shortcut"),
|
|
]);
|
|
|
|
export const FeishuDriveSchema = Type.Union([
|
|
Type.Object({
|
|
action: Type.Literal("list"),
|
|
folder_token: Type.Optional(
|
|
Type.String({ description: "Folder token (optional, omit for root directory)" }),
|
|
),
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("info"),
|
|
file_token: Type.String({ description: "File or folder token" }),
|
|
type: FileType,
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("create_folder"),
|
|
name: Type.String({ description: "Folder name" }),
|
|
folder_token: Type.Optional(
|
|
Type.String({ description: "Parent folder token (optional, omit for root)" }),
|
|
),
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("move"),
|
|
file_token: Type.String({ description: "File token to move" }),
|
|
type: FileType,
|
|
folder_token: Type.String({ description: "Target folder token" }),
|
|
}),
|
|
Type.Object({
|
|
action: Type.Literal("delete"),
|
|
file_token: Type.String({ description: "File token to delete" }),
|
|
type: FileType,
|
|
}),
|
|
]);
|
|
|
|
export type FeishuDriveParams = Static<typeof FeishuDriveSchema>;
|