dingtalk-wiki 1.2.13 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -16
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1633,31 +1633,32 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
1635
|
|
|
1636
|
-
// Step 10: doc_2.0 API - DocContent
|
|
1637
|
-
for (
|
|
1636
|
+
// Step 10: doc_2.0 API - DocContent + QueryDocContent
|
|
1637
|
+
for (const cfg of [
|
|
1638
|
+
{ label: 'DocContent /v2.0/doc/dentries/{uuid}/contents', params: { operatorId: opId }, data: undefined },
|
|
1639
|
+
{ label: 'DocContent + targetFormat query', params: { operatorId: opId, targetFormat: 'markdown' }, data: undefined },
|
|
1640
|
+
{ label: 'QueryDocContent /v2.0/doc/query/{uuid}/contents', path: `/v2.0/doc/query/${input}/contents`, params: { operatorId: opId, targetFormat: 'markdown' }, data: undefined },
|
|
1641
|
+
]) {
|
|
1638
1642
|
try {
|
|
1643
|
+
const path = cfg.path || `/v2.0/doc/dentries/${input}/contents`;
|
|
1639
1644
|
const docContentRes = await axios({
|
|
1640
1645
|
method: 'GET',
|
|
1641
|
-
url: `${DINGTALK_API_V2}
|
|
1642
|
-
headers: { 'x-acs-dingtalk-access-token': token },
|
|
1643
|
-
params:
|
|
1646
|
+
url: `${DINGTALK_API_V2}${path}`,
|
|
1647
|
+
headers: { 'x-acs-dingtalk-access-token': token, 'Content-Type': 'application/json' },
|
|
1648
|
+
params: cfg.params,
|
|
1649
|
+
data: cfg.data
|
|
1644
1650
|
});
|
|
1645
1651
|
steps.push({
|
|
1646
|
-
step:
|
|
1652
|
+
step: cfg.label,
|
|
1647
1653
|
result: '成功',
|
|
1648
1654
|
raw: docContentRes.data
|
|
1649
1655
|
});
|
|
1650
|
-
break;
|
|
1651
1656
|
} catch (e) {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
});
|
|
1658
|
-
} else {
|
|
1659
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
1660
|
-
}
|
|
1657
|
+
steps.push({
|
|
1658
|
+
step: cfg.label,
|
|
1659
|
+
result: '失败',
|
|
1660
|
+
raw: { message: e.response?.data?.message || e.message, code: e.response?.data?.code || '(无)', status: e.response?.status || '(无)' }
|
|
1661
|
+
});
|
|
1661
1662
|
}
|
|
1662
1663
|
}
|
|
1663
1664
|
|