egg_server/test/archive/copyFile.ts
2024-11-25 11:08:54 +00:00

31 lines
739 B
TypeScript

import { LarkService } from "@egg/net-tool"
const service = new LarkService({
appId: "cli_9f4b3b1b1b",
appSecret: "bask4IvKT61xCvTUxIkcMaWoiYf",
requestId: "123",
})
const {
data: {
file: { token: fileToken },
},
} = await service.drive.copyFile(
"D6ETfzaU9lN08adVDz3kjLey4Bx",
"bask4drDOy7zc3nDVyZb5RYDzOe",
"xxx 项目 KV管理器",
"bitable"
)
const { data: tableList } = await service.sheet.getTables(fileToken)
const tableId = tableList[0].table_id
const { data: viewList } = await service.sheet.getViews(fileToken, tableId)
const viewId = viewList[0].view_id
console.log(fileToken, tableId, viewId)
// https://xiaomi.f.mioffice.cn/base/bask4IvKT61xCvTUxIkcMaWoiYf?table=tblghpLxu1pAdVOD&view=vewEpqn4oM