Documentation
¶
Overview ¶
Package oa registers declarative shortcuts for the DingTalk OA approval service, wrapping the raw MCP tools exposed by the dws oa helper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ListCc = shortcut.Shortcut{ Service: "oa", Command: "+list-cc", Product: "oa", Description: "获取抄送当前用户的审批单列表", Intent: "当你想查看抄送给自己、需要知悉但无需审批的单子时使用;按页码/关键字分页返回抄送我的审批单列表,适合了解与自己相关但不用自己动手处理的审批动态。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "page", Type: shortcut.FlagString, Default: "1", Desc: "分页页码"}, {Name: "limit", Type: shortcut.FlagString, Default: "20", Desc: "每页大小"}, {Name: "query", Type: shortcut.FlagString, Desc: "关键字搜索"}, }, Tips: []string{`dws oa +list-cc --limit 20 --page 1 --query 报销`}, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "pageNumber": rt.Str("page"), "pageSize": rt.Str("limit"), } if rt.Changed("query") { params["query"] = rt.Str("query") } data, err := rt.CallMCPData("oa", "get_noticed_instances", params) if err != nil { return err } instances := listCcProject(data) return rt.Output(map[string]any{"count": len(instances), "instances": instances}) }, }
ListCc — 获取抄送当前用户的审批单列表 (get_noticed_instances)
var ListExecuted = shortcut.Shortcut{ Service: "oa", Command: "+list-executed", Product: "oa", Description: "获取当前用户已经处理过的审批单列表", Intent: "当你想回顾自己历史上审批过(已同意/拒绝等)的单子、做复盘或查找某条已办审批时使用,区别于 +list-pending 的待办;按页码/关键字分页返回我已处理的审批单。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "page", Type: shortcut.FlagString, Default: "1", Desc: "分页页码"}, {Name: "limit", Type: shortcut.FlagString, Default: "20", Desc: "每页大小"}, {Name: "query", Type: shortcut.FlagString, Desc: "关键字搜索"}, }, Tips: []string{`dws oa +list-executed --limit 20 --page 1 --query 报销`}, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "pageNumber": rt.Str("page"), "pageSize": rt.Str("limit"), } if rt.Changed("query") { params["query"] = rt.Str("query") } data, err := rt.CallMCPData("oa", "get_done_tasks", params) if err != nil { return err } instances := listExecutedProject(data) return rt.Output(map[string]any{"count": len(instances), "instances": instances}) }, }
DingInfo — 获取审批任务的被催办人 userId (oa_ding_user) ListExecuted — 获取当前用户已处理过的审批单列表 (get_done_tasks)
var ListForms = shortcut.Shortcut{ Service: "oa", Command: "+list-forms", Product: "oa", Description: "获取当前用户可见的审批表单列表", Intent: "当你想浏览自己有权限发起哪些审批模板、或需要为 +list-initiated 等操作枚举 processCode 时使用;无需关键字,按游标分页返回当前用户可见的全部审批表单,适合不确定表单名称时先整体看一遍。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "cursor", Type: shortcut.FlagInt, Default: "0", Desc: "分页游标,首次传 0"}, {Name: "limit", Type: shortcut.FlagInt, Default: "100", Desc: "每页大小,最大 100"}, }, Tips: []string{`dws oa +list-forms --cursor 0 --limit 100`}, Execute: func(rt *shortcut.RuntimeContext) error { data, err := rt.CallMCPData("oa", "list_user_visible_process", map[string]any{ "cursor": rt.Int("cursor"), "pageSize": rt.Int("limit"), }) if err != nil { return err } forms := listFormsProject(data) return rt.Output(map[string]any{"count": len(forms), "forms": forms}) }, }
Detail — 获取审批实例详情 (get_processInstance_detail) Approve — 同意审批 (approve_processInstance) Reject — 拒绝审批 (reject_processInstance) Revoke — 撤销已发起的审批 (revoke_processInstance) Records — 获取审批操作记录 (get_processInstance_records) ListInitiated — 查询审批模板下已发起的审批记录 (list_initiated_instances) ListTasks — 查询待我审批的任务 ID (list_pending_tasks) ListForms — 获取当前用户可见的审批表单列表 (list_user_visible_process)
var ListPending = shortcut.Shortcut{ Service: "oa", Command: "+list-pending", Product: "oa", Description: "查询待我处理的审批(时间范围为 epoch 毫秒)", Intent: "当你想知道自己当前有哪些审批还没处理、需要清理审批待办或按时间段/关键字盘点待审批单时使用;传入起止时间(epoch 毫秒,可选关键字与分页),返回待我审批的实例列表,是后续 +get 查详情、+approve/+reject 处理的入口。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "start", Type: shortcut.FlagInt, Desc: "开始时间(epoch 毫秒)", Required: true}, {Name: "end", Type: shortcut.FlagInt, Desc: "结束时间(epoch 毫秒)", Required: true}, {Name: "page", Type: shortcut.FlagString, Desc: "分页页码"}, {Name: "limit", Type: shortcut.FlagString, Desc: "每页大小"}, {Name: "query", Type: shortcut.FlagString, Desc: "关键字搜索"}, }, Tips: []string{`dws oa +list-pending --start 1741536000000 --end 1741622399000 --query 报销`}, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "starTime": rt.Int("start"), "endTime": rt.Int("end"), } if rt.Changed("page") { params["pageNum"] = rt.Str("page") } if rt.Changed("limit") { params["pageSize"] = rt.Str("limit") } if rt.Changed("query") { params["query"] = rt.Str("query") } data, err := rt.CallMCPData("oa", "list_pending_approvals", params) if err != nil { return err } instances := listPendingProject(data) return rt.Output(map[string]any{"count": len(instances), "instances": instances}) }, }
ListPending — 查询待我处理的审批 (list_pending_approvals)
var ListSubmitted = shortcut.Shortcut{ Service: "oa", Command: "+list-submitted", Product: "oa", Description: "获取当前用户已发起的审批单列表", Intent: "当你想查看自己提交发起的审批单及其审批进度(如某笔报销/请假审到哪一步)时使用;按页码/关键字分页返回我发起的审批单,可据此决定是否 +revoke 撤销或催办。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "page", Type: shortcut.FlagString, Default: "1", Desc: "分页页码"}, {Name: "limit", Type: shortcut.FlagString, Default: "20", Desc: "每页大小"}, {Name: "query", Type: shortcut.FlagString, Desc: "关键字搜索"}, }, Tips: []string{`dws oa +list-submitted --limit 20 --page 1 --query 报销`}, Execute: func(rt *shortcut.RuntimeContext) error { params := map[string]any{ "pageNumber": rt.Str("page"), "pageSize": rt.Str("limit"), } if rt.Changed("query") { params["query"] = rt.Str("query") } data, err := rt.CallMCPData("oa", "get_submitted_instances", params) if err != nil { return err } instances := listSubmittedProject(data) return rt.Output(map[string]any{"count": len(instances), "instances": instances}) }, }
ListSubmitted — 获取当前用户已发起的审批单列表 (get_submitted_instances)
var SearchForms = shortcut.Shortcut{ Service: "oa", Command: "+search-forms", Product: "oa", Description: "按关键字模糊搜索当前用户可见的审批表单", Intent: "当你已知想找的审批大致名称(如「报销」「请假」)、想快速定位对应表单及其 processCode 时使用,比 +list-forms 全量列举更高效;传入关键字,返回名称或 processCode 匹配的表单,供后续 +list-initiated 按模板查询。", Risk: shortcut.RiskRead, Flags: []shortcut.Flag{ {Name: "query", Type: shortcut.FlagString, Desc: "关键字(匹配 processCode 或表单名称)", Required: true}, }, Tips: []string{`dws oa +search-forms --query 报销`}, Execute: func(rt *shortcut.RuntimeContext) error { data, err := rt.CallMCPData("oa", "search_form", map[string]any{ "query": rt.Str("query"), }) if err != nil { return err } forms := searchFormsProject(data) return rt.Output(map[string]any{"count": len(forms), "forms": forms}) }, }
SearchForms — 按关键字模糊搜索可见审批表单 (search_form)
Functions ¶
This section is empty.
Types ¶
This section is empty.