Merge branch 'feat/dws-devapp' of https://github.com/wxianfeng/dingtalk-workspace-cli into feat/dws-devapp
# Conflicts: # skills/multi/dingtalk-dev/references/event.md
This commit is contained in:
@@ -953,7 +953,7 @@ real model is "list subscribable events + subscribe/unsubscribe events by
|
||||
|
||||
| CLI | MCP tool | Notes |
|
||||
| --- | --- | --- |
|
||||
| `dev app event list` | `list_dev_app_events` | Args `unifiedAppId/cursor/pageSize`; returns `pushType=STREAM` + `events[]` (`eventCode`/`eventName`/`subscribed`) + `hasMore/nextCursor/pageSize`. Read. |
|
||||
| `dev app event list` | `list_dev_app_events` | Args `unifiedAppId/keyword/cursor/pageSize`; `keyword` searches `eventCode` or `eventName`; returns `pushType=STREAM` + `events[]` (`eventCode`/`eventName`/`subscribed`) + `hasMore/nextCursor/pageSize`. Read. |
|
||||
| `dev app event subscribe` | `subscribe_dev_app_events` | Args `unifiedAppId` + required array `eventCodes`. Returns `success/operation/eventCodes/needsPublish/versionRequiredAction`; failures include `errorCode/errorMsg/reason/retryable/action` such as `STREAM_NOT_CONNECTED`. Write (`--dry-run`/`--yes`). |
|
||||
| `dev app event unsubscribe` | `unsubscribe_dev_app_events` | Args `unifiedAppId` + required array `eventCodes`. Returns `success/operation/eventCodes/needsPublish/versionRequiredAction`; failures include `errorCode/errorMsg/reason/retryable/action`. Write. |
|
||||
|
||||
|
||||
@@ -257,11 +257,13 @@ func newDevAppEventListCommand(runner executor.Runner) *cobra.Command {
|
||||
return err
|
||||
}
|
||||
params := map[string]any{"unifiedAppId": appID}
|
||||
devAppPutString(params, "keyword", devAppStringFlag(cmd, "keyword"))
|
||||
devAppApplyCursorParams(cmd, params)
|
||||
return runDevAppTool(runner, cmd, devAppEventListTool, params)
|
||||
},
|
||||
}
|
||||
addDevAppUnifiedIDFlag(cmd)
|
||||
cmd.Flags().String("keyword", "", "事件搜索关键词,支持按事件码或事件名称模糊匹配")
|
||||
registerDevAppCursorFlags(cmd)
|
||||
preferLegacyLeaf(cmd)
|
||||
annotateDevAppTool(cmd, devAppEventListTool)
|
||||
|
||||
@@ -546,6 +546,24 @@ func TestDevAppDeleteConfirmName(t *testing.T) {
|
||||
// TestDevAppEventSubscribeUsesEventCodes locks the param contract: the server's
|
||||
// subscribe/unsubscribe tools (plural: subscribe_dev_app_events) read eventCodes
|
||||
// as an ARRAY — real-device confirmed against the updated MCP schema.
|
||||
func TestDevAppEventListForwardsKeyword(t *testing.T) {
|
||||
runner := &captureRunner{}
|
||||
root := newDevAppTestRoot(runner)
|
||||
var out bytes.Buffer
|
||||
root.SetOut(&out)
|
||||
root.SetErr(&out)
|
||||
root.SetArgs([]string{"dev", "app", "event", "list", "--unified-app-id", "u-1", "--keyword", "通讯录"})
|
||||
if err := root.Execute(); err != nil {
|
||||
t.Fatalf("Execute() error = %v\noutput:\n%s", err, out.String())
|
||||
}
|
||||
if runner.last.Tool != devAppEventListTool {
|
||||
t.Fatalf("Tool = %q, want %q", runner.last.Tool, devAppEventListTool)
|
||||
}
|
||||
if got := runner.last.Params["keyword"]; got != "通讯录" {
|
||||
t.Fatalf("keyword = %#v, want 通讯录", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDevAppEventSubscribeUsesEventCodes(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- 一次可订阅多个事件码,共用同一回调。
|
||||
- 事件码取值以开放平台文档为准;不确定走 `dws dev doc search`。
|
||||
- 退订前先 `event list` 确认当前订阅,避免退不存在的。
|
||||
- `event list` 支持 `--cursor/--page-size`,返回 `events/hasMore/nextCursor/pageSize`;翻页继续传 `nextCursor`。
|
||||
- `event list` 支持 `--keyword/--cursor/--page-size`;`--keyword` 按事件码或事件名称搜索;返回 `events/hasMore/nextCursor/pageSize`;翻页继续传 `nextCursor`。
|
||||
- 返回看 `events[].subscribed` 和 `pushType=STREAM`(事件走 Stream 长连推送;connect 与事件订阅的关系见下方「Stream 长连」)。
|
||||
- `subscribe/unsubscribe` 的 `--event-codes` 必填,返回 `success/operation/unifiedAppId/eventCodes/needsPublish/versionRequiredAction`;失败时补 `errorCode/errorMsg/reason/retryable/action`。
|
||||
- 如果服务端返回 `errorCode=STREAM_NOT_CONNECTED`、`reason=STREAM_NOT_CONNECTED`、`retryable=false`、`action=run connect`,先执行 `dev connect` 建联,再重试订阅。
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
```bash
|
||||
dws dev app event list --unified-app-id <unifiedAppId> --page-size 20 --format json
|
||||
dws dev app event list --unified-app-id <unifiedAppId> --keyword 通讯录 --page-size 20 --format json
|
||||
```
|
||||
|
||||
MCP tool: `list_dev_app_events`。返回 `pushType=STREAM`、`events[]`、`hasMore`、`nextCursor`、`pageSize`;`hasMore=true` 时下一页继续传 `--cursor <nextCursor>`。`events[]` 每项含:
|
||||
MCP tool: `list_dev_app_events`。可选 `--keyword` 按事件码或事件名称搜索。返回 `pushType=STREAM`、`events[]`、`hasMore`、`nextCursor`、`pageSize`;`hasMore=true` 时下一页继续传 `--cursor <nextCursor>`。`events[]` 每项含:
|
||||
|
||||
| 字段 | 含义 |
|
||||
|------|------|
|
||||
@@ -43,6 +44,7 @@ MCP tool: `unsubscribe_dev_app_events`(入参 `unifiedAppId` + 必填数组 `e
|
||||
| CLI | MCP | 必填 | 说明 |
|
||||
|-----|-----|------|------|
|
||||
| `--unified-app-id` | `unifiedAppId` | 是 | 统一应用 ID |
|
||||
| `--keyword` | `keyword` | list 可选 | 事件搜索关键词,匹配事件码或事件名称 |
|
||||
| `--cursor` | `cursor` | list 可选 | 服务端返回的下一页游标 |
|
||||
| `--page-size` | `pageSize` | list 可选 | 单页数量 |
|
||||
| `--event-codes` | `eventCodes` | subscribe/unsubscribe 必填 | 事件码列表,逗号分隔,取自 `event list` |
|
||||
|
||||
Reference in New Issue
Block a user