Merge 20a9757da514bb3a3845c8c6f476fceb90ee68b6 into 5e417b44e1540f528d2ae63e3e20229a902d1db2
This commit is contained in:
commit
a4d28e0428
@ -438,6 +438,23 @@ async function updateRecord(
|
||||
};
|
||||
}
|
||||
|
||||
async function deleteRecord(
|
||||
client: Lark.Client,
|
||||
appToken: string,
|
||||
tableId: string,
|
||||
recordId: string,
|
||||
) {
|
||||
const res = await client.bitable.appTableRecord.delete({
|
||||
path: { app_token: appToken, table_id: tableId, record_id: recordId },
|
||||
});
|
||||
ensureLarkSuccess(res, "bitable.appTableRecord.delete", { appToken, tableId, recordId });
|
||||
|
||||
return {
|
||||
deleted: true,
|
||||
record_id: recordId,
|
||||
};
|
||||
}
|
||||
|
||||
// ============ Schemas ============
|
||||
|
||||
const GetMetaSchema = Type.Object({
|
||||
@ -530,6 +547,14 @@ const UpdateRecordSchema = Type.Object({
|
||||
}),
|
||||
});
|
||||
|
||||
const DeleteRecordSchema = Type.Object({
|
||||
app_token: Type.String({
|
||||
description: "Bitable app token (use feishu_bitable_get_meta to get from URL)",
|
||||
}),
|
||||
table_id: Type.String({ description: "Table ID (from URL: ?table=YYY)" }),
|
||||
record_id: Type.String({ description: "Record ID to delete" }),
|
||||
});
|
||||
|
||||
// ============ Tool Registration ============
|
||||
|
||||
export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
||||
@ -684,6 +709,27 @@ export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
||||
},
|
||||
});
|
||||
|
||||
registerBitableTool<{
|
||||
app_token: string;
|
||||
table_id: string;
|
||||
record_id: string;
|
||||
accountId?: string;
|
||||
}>({
|
||||
name: "feishu_bitable_delete_record",
|
||||
label: "Feishu Bitable Delete Record",
|
||||
description:
|
||||
"Permanently delete a record (row) from a Bitable table. This action is irreversible.",
|
||||
parameters: DeleteRecordSchema,
|
||||
async execute({ params, defaultAccountId }) {
|
||||
return deleteRecord(
|
||||
getClient(params, defaultAccountId),
|
||||
params.app_token,
|
||||
params.table_id,
|
||||
params.record_id,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
registerBitableTool<{ name: string; folder_token?: string; accountId?: string }>({
|
||||
name: "feishu_bitable_create_app",
|
||||
label: "Feishu Bitable Create App",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user