feat(feishu): add delete_record tool for bitable
This commit is contained in:
parent
e2a1a4a3db
commit
9ebd5fefd6
@ -438,6 +438,18 @@ 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 ============
|
// ============ Schemas ============
|
||||||
|
|
||||||
const GetMetaSchema = Type.Object({
|
const GetMetaSchema = Type.Object({
|
||||||
@ -530,6 +542,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 ============
|
// ============ Tool Registration ============
|
||||||
|
|
||||||
export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
export function registerFeishuBitableTools(api: OpenClawPluginApi) {
|
||||||
@ -684,6 +704,26 @@ 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: "Delete a record (row) from a Bitable table",
|
||||||
|
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 }>({
|
registerBitableTool<{ name: string; folder_token?: string; accountId?: string }>({
|
||||||
name: "feishu_bitable_create_app",
|
name: "feishu_bitable_create_app",
|
||||||
label: "Feishu Bitable Create App",
|
label: "Feishu Bitable Create App",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user