diff --git a/.agents/skills/dds-to-skill/SKILL.md b/.agents/skills/dds-to-skill/SKILL.md index 00f3b64..13ee3fe 100644 --- a/.agents/skills/dds-to-skill/SKILL.md +++ b/.agents/skills/dds-to-skill/SKILL.md @@ -1,11 +1,11 @@ --- name: dds-to-skill description: > - 将 DDS(详细设计说明书)/ PRD / 架构文档转换为一套可落地的 Claude Code Agent Skills(Converts DDS/PRD/Architecture docs into production-ready Agent Skills)。 - 包含系统级 Skill、模块级 Skills、横切 Skills 的完整生成流程,涵盖设计细节抽取、reference 分层、frontmatter 规范、质量自检。 - 触发场景 Trigger: 当用户需要将 DDS 文档转为 Skills / 需要从架构设计文档生成开发指导 Skill / 需要批量创建模块级 Skill 套件。 - 关键词 Keywords: DDS, PRD, 架构说明, 设计文档, skill 生成, skill 套件, agent skill, 模块拆分, reference 抽取, 契约, API, 状态机, 事件, Schema。 -argument-hint: " [--output-dir ] [--project-name ]" + 将单模块 DDS(详细设计说明书)/ PRD / 架构文档转换为一个 All-in-One 全栈开发指导 Skill(Converts a single-module DDS/PRD/Architecture doc into one All-in-One development guidebook Skill)。 + 输出唯一的 developing- Skill,涵盖 API、数据库、状态机、事件、安全等全栈设计细节抽取与 reference 分层索引。 + 触发场景 Trigger: 当用户需要将单模块 DDS 文档转为可落地的开发指导 Skill / 需要从架构设计文档生成 All-in-One 开发向导。 + 关键词 Keywords: DDS, PRD, 架构说明, 设计文档, skill 生成, all-in-one, agent skill, reference 抽取, API, 状态机, 事件, Schema。 +argument-hint: " [--output-dir ] [--module-name ]" allowed-tools: - Read - Write @@ -15,11 +15,16 @@ allowed-tools: - Bash --- -# DDS-to-Skill:从设计文档生成 Agent Skills +# DDS-to-Skill:从设计文档生成 All-in-One 开发指导 Skill -本 Skill 指导你将一份 DDS(Detailed Design Specification)或 PRD / 架构说明文档,转换为一套**可落地、含设计细节**的 Claude Code Agent Skills 套件。 +本 Skill 指导你将一份单模块 DDS(Detailed Design Specification)或 PRD / 架构说明文档,转换为**唯一一个**包含全栈开发细节的 `developing-` Skill。 -> **核心理念**:生成的不是"空洞的工作流提示词",而是**绑定了 DDS 设计细节**、能指导真实开发/审查的 Skill 套件。 +> **核心理念**:一个 DDS 输入 → 一个 Skill 输出。生成的不是"空洞的工作流提示词",而是**绑定了 DDS 设计细节**、能指导真实全栈开发的 All-in-One 指导书。 + +> **⚠️ 强制约束**: +> - **禁止**生成系统级 Skill(`*-system`) +> - **禁止**生成横切/全局 Skill(`managing-*`、`designing-*`、`implementing-auth` 等) +> - 唯一合法输出为 **1 个** `developing-` 目录 --- @@ -66,62 +71,73 @@ allowed-tools: 若无法读取文件,**必须停止**,输出"继续所需的最小信息清单": -1. 系统模块列表(名称 + 职责 + 关键技术) -2. 每个模块的接口/API 列表 +1. 模块名称、职责与关键技术栈 +2. 接口/API 列表 3. 事件/Topic 定义 4. 数据库表结构 5. 状态机/流程定义 6. 授权模型 -7. 模块间依赖关系 +7. 外部依赖关系 **禁止在缺少源文档的情况下臆造设计细节。** --- -## Phase 1:分析与规划 +## Phase 1:分析与规划(单模块全包容) -### 1.1 模块识别 +### 1.1 模块识别与命名 -从 DDS 中识别所有业务模块,生成模块清单表: +从 DDS 中识别目标模块,确定唯一 Skill 名称: -| 模块名 | 职责概述 | 关键技术 | Skill 类型 | -|--------|---------|---------|-----------| -| *从 DDS 抽取* | *从 DDS 抽取* | *从 DDS 抽取* | 系统级/模块级/横切 | +| 项目 | 内容 | +|------|------| +| 模块名 | *从 DDS 抽取* | +| 职责概述 | *从 DDS 抽取* | +| 关键技术栈 | *从 DDS 抽取* | +| **Skill 名称** | `developing-` | -### 1.2 Skill 三层架构规划 +> **命名规则**: +> - 动名词 `developing-` 前缀 + 模块名 +> - 小写字母 + 数字 + 连字符 +> - ≤ 64 字符 -必须生成 3 类 Skills: +### 1.2 单模块 All-in-One 规划 -**A) 系统级 Skill(1 个)** -- 跨模块一致性、依赖规则、全局变更流程 -- 命名:`developing--system` +**唯一输出**为 `developing-`,该 Skill 必须涵盖以下所有职责: -**B) 模块级 Skills(N 个,每模块 1 个)** -- 高频开发指导:实现步骤 + 依赖影响检查 -- 命名:`developing-` +- ✅ 模块架构总览与技术栈说明 +- ✅ 数据库 Schema 与迁移指导 +- ✅ API/接口实现指导 +- ✅ 状态机/业务流程实现指导 +- ✅ 事件/消息处理指导 +- ✅ 安全/授权实现指导(如适用) +- ✅ 外部依赖与集成点说明 +- ✅ 可观测性/监控/日志规范(如适用) -**C) 横切 Skills(≥ 3 个)** -- 基于 DDS 内容选择,常见横切关注点: +**⚠️ 以下生成物被严格禁止**: -| 横切主题 | 适用场景 | 参考命名 | +| 禁止类型 | 匹配模式 | 禁止原因 | |---------|---------|---------| -| API/事件/Schema 契约 | 有跨模块接口定义 | `designing-contracts` | -| 数据库迁移 | 有 DB Schema 定义 | `managing-db-migrations` | -| 可观测性/审计 | 有日志/监控/审计需求 | `managing-observability` | -| 安全/认证 | 有 RBAC/JWT/授权体系 | `implementing-auth` | -| 前端开发规范 | 有前端架构设计 | `frontend-` | -| 后端编码规范 | 有后端技术栈规范 | `backend-` | -| 部署/运维 | 有 K8S/Docker/CI 设计 | `deploying-` | +| 系统级 Skill | `*-system` | 单模块场景无需跨系统协调 | +| 横切/契约 Skill | `designing-*` | 所有契约信息收入唯一 Skill 的 reference/ | +| 横切/管理 Skill | `managing-*` | 所有运维/迁移/监控信息收入唯一 Skill | +| 横切/实现 Skill | `implementing-*` | 所有实现指导收入唯一 Skill 的 Execute 章节 | -> 实际横切 Skills 必须根据 DDS 内容动态决定,不可少于 3 个。 +### 1.3 Reference 目录规划 -### 1.3 Name 候选与确认 +规划 `reference/` 的分层目录结构,将所有设计细节(API、DB、状态机、事件等)集中在唯一 Skill 下: -为每个 Skill 提供 2~3 个命名候选,从中选择 1 个并说明理由。命名规则: -- 动名词形式(如 `developing-*`、`managing-*`、`implementing-*`) -- 小写字母 + 数字 + 连字符 -- ≤ 64 字符 -- 包含模块名或领域名 +``` +developing-/reference/ +├── 01-/ +│ ├── apis.md +│ ├── db-schema.md +│ └── events-topics.md +├── 02-/ +│ └── state-machine.md +└── 03-/ + └── security-model.md +``` --- @@ -133,34 +149,22 @@ allowed-tools: 从 DDS 章节标题构建 `reference/` 分层目录: -``` -/reference/ -├── 01-/ -│ ├── apis.md -│ ├── db-schema.md -│ └── events-topics.md -├── 02-/ -│ └── state-machine.md -└── 03-/ - └── security-model.md -``` - **目录命名规范**: - 有序前缀 `01-`、`02-`... + slug - slug:全小写,非字母数字字符替换为 `-`,连续 `-` 合并,≤ 48 字符 ### 2.2 六类设计要素抽取(必须覆盖) -每个模块级 Skill 的 reference/ 必须覆盖**至少 3 类**: +唯一 Skill 的 reference/ 必须覆盖**至少 3 类**: | 要素类型 | 抽取内容 | reference 文件名 | -|---------|---------|-----------------| +|---------|---------|-----------------| | **API/接口** | 路径、方法、请求/响应字段、错误码 | `apis.md` | | **事件/Topic** | 字段、版本、幂等键、重试语义 | `events-topics.md` | | **DB Schema** | 字段、索引、约束、迁移策略 | `db-schema.md` | | **状态机/流程** | 状态、转移、守卫条件、回调、补偿 | `state-machine.md` | | **授权模型** | JWT claims、RBAC/DAC、权限层级 | `security-model.md` | -| **依赖关系** | 跨模块调用链路、协议、集成点 | `dependencies.md` | +| **依赖关系** | 外部调用链路、协议、集成点 | `dependencies.md` | ### 2.3 reference 条目格式(强制) @@ -186,17 +190,17 @@ allowed-tools: --- -## Phase 3:逐个生成 SKILL.md +## Phase 3:生成 SKILL.md ### 3.1 SKILL.md 结构模板 > **详细模板见** `reference/skill-templates.md` -每个 SKILL.md 必须包含以下结构: +唯一的 SKILL.md 必须包含以下结构: ```markdown --- -name: +name: developing- description: <单行,< 1024 字符,中英文混合,第三人称,含功能+触发场景+关键词> argument-hint: "<参数格式说明>" allowed-tools: @@ -208,9 +212,9 @@ allowed-tools: - Bash # 按需 --- -# +# Developing -<一段话概述本 Skill 的用途和适用范围> +<一段话描述模块职责、技术栈、适用范围> ## Quick Context <动态注入命令,至少 2 处 !`command`> @@ -220,13 +224,13 @@ allowed-tools: ### 决策点 ## Verify -<按类别组织的 Checklist,可勾选> +<按类别组织的全栈 Checklist:数据库→API→状态机→事件→安全> ## Execute -<分步骤的可操作指令> +<分步骤的全栈开发指令:数据库→API→状态机→事件→安全> ## Pitfalls -<3~8 条与该模块/主题强相关的常见坑,至少 2 条引用 reference> +<3~8 条与该模块强相关的常见坑,至少 2 条引用 reference> ## Related References <指向 reference/ 的链接列表,说明何时查阅> @@ -249,6 +253,7 @@ allowed-tools: 3. **可执行动作**:禁止空话(如"检查 API 兼容"),必须写成具体审查动作 4. **设计细节绑定**:Pitfalls 和 Verify 中至少 2 处引用 `reference/` 的具体内容 5. **行数限制**:SKILL.md 主体 < 500 行 +6. **全栈覆盖**:Verify 和 Execute 必须覆盖数据库、API、状态机、事件等全栈层面 **示例 — 空话 vs 可执行动作**: @@ -269,10 +274,10 @@ allowed-tools: ### 4.1 目录结构 -每个 Skill 遵循标准目录模板: +唯一 Skill 遵循标准目录模板: ``` -/ +developing-/ ├── SKILL.md # 主文件(< 500 行) ├── reference/ # 设计细节(按章节分层) │ ├── 01-
/ @@ -289,7 +294,7 @@ allowed-tools: ### 4.2 verify.sh 编写要求 -每个 Skill 必须至少包含 1 个 `verify.sh`: +唯一 Skill 必须包含 1 个 `verify.sh`: ```bash #!/bin/bash @@ -341,9 +346,9 @@ echo "=== 结果: $PASS PASS / $FAIL FAIL ===" ### 5.1 输出顺序(必须遵守) -1. **Skills 清单表**:系统级 / 模块级 / 横切,含最终 name 与理由 +1. **Skill 信息表**:唯一 `developing-` 的 name、职责概述、覆盖的设计要素类型 2. **总目录树**:Unix 路径风格 -3. **每个 SKILL.md**:完整内容 +3. **SKILL.md**:完整内容 4. **Supporting files**:按 `文件路径 → 文件内容` 逐个输出 5. **全局自检结果**:逐条 PASS/FAIL + 修复建议 @@ -351,11 +356,11 @@ echo "=== 结果: $PASS PASS / $FAIL FAIL ===" 按以下维度逐条检查: -**结构完整性** -- [ ] 系统级 Skill 存在(1 个) -- [ ] 模块级 Skills 数量 = 模块数 -- [ ] 横切 Skills ≥ 3 个 -- [ ] 每个 Skill 都有 SKILL.md + reference/ + scripts/verify.sh +**唯一收敛性(最高优先级)** +- [ ] 仅存在 1 个 `developing-` 目录 +- [ ] 不存在任何 `*-system` 系统级 Skill +- [ ] 不存在任何 `managing-*` / `designing-*` / `implementing-*` 横切 Skill +- [ ] 唯一 Skill 有 SKILL.md + reference/ + scripts/verify.sh **Frontmatter 规范** - [ ] description 为单行 @@ -370,9 +375,10 @@ echo "=== 结果: $PASS PASS / $FAIL FAIL ===" - [ ] ≥ 2 处 `!command` 动态注入 - [ ] Pitfalls ≥ 2 条引用 reference - [ ] 无空话("检查 XX 一致性"这类无具体动作的描述) +- [ ] Verify 和 Execute 覆盖全栈层面(数据库→API→状态机→事件) **Reference 质量** -- [ ] 每个模块 Skill 覆盖 ≥ 3 类设计要素 +- [ ] 覆盖 ≥ 3 类设计要素 - [ ] reference 有章节分层目录(非扁平) - [ ] 每条 reference 含 DDS-Section + DDS-Lines 溯源 - [ ] DDS 缺失内容标注 [TBD] @@ -385,7 +391,7 @@ echo "=== 结果: $PASS PASS / $FAIL FAIL ===" | 需要了解... | 查阅... | |------------|--------| | DDS 抽取的详细方法 | `reference/dds-extraction-guide.md` | -| SKILL.md 模板(系统/模块/横切) | `reference/skill-templates.md` | +| SKILL.md 模板(模块全栈开发指导书) | `reference/skill-templates.md` | | Frontmatter 详细规范 | `reference/frontmatter-spec.md` | | 质量自检的完整清单 | `reference/quality-checklist.md` | | 成功案例的目录结构 | `examples/` | diff --git a/.agents/skills/dds-to-skill/reference/quality-checklist.md b/.agents/skills/dds-to-skill/reference/quality-checklist.md index c86da72..ad71e2d 100644 --- a/.agents/skills/dds-to-skill/reference/quality-checklist.md +++ b/.agents/skills/dds-to-skill/reference/quality-checklist.md @@ -8,13 +8,13 @@ DDS-to-Skill 转换完成后,必须按以下清单逐条检查。每条标记 | # | 检查项 | PASS 条件 | |---|-------|----------| -| S1 | 系统级 Skill 存在 | 恰好 1 个 `developing-*-system` Skill | -| S2 | 模块级 Skills 数量 | = DDS 中识别的模块数 | -| S3 | 横切 Skills 数量 | ≥ 3 个 | -| S4 | 每个 Skill 有 SKILL.md | 所有 Skill 目录下存在 SKILL.md | -| S5 | 每个 Skill 有 reference/ | 所有 Skill 目录下存在 reference/ | -| S6 | 每个 Skill 有 verify.sh | 所有 Skill 的 scripts/ 下存在 verify.sh | -| S7 | 目录命名规范 | 全小写、连字符、动名词形式 | +| S1 | 唯一收敛 | 仅存在 1 个 `developing-` 目录 | +| S2 | 无越界系统级 Skill | 不存在任何 `*-system` 目录 | +| S3 | 无越界横切 Skill | 不存在 `managing-*` / `designing-*` / `implementing-*` 等横切目录 | +| S4 | Skill 有 SKILL.md | `developing-` 目录下存在 SKILL.md | +| S5 | Skill 有 reference/ | `developing-` 目录下存在 reference/ | +| S6 | Skill 有 verify.sh | `developing-` 的 scripts/ 下存在 verify.sh | +| S7 | 目录命名规范 | 全小写、连字符、`developing-` 前缀 | --- @@ -27,9 +27,9 @@ DDS-to-Skill 转换完成后,必须按以下清单逐条检查。每条标记 | F3 | description 中英文 | 同时包含中文和英文描述 | | F4 | description 含触发场景 | 包含 "触发场景" 或 "Trigger" 关键词 | | F5 | description 含关键词 | 包含 "关键词" 或 "Keywords" | -| F6 | name 格式 | 小写字母 + 数字 + 连字符,动名词开头 | +| F6 | name 格式 | 小写字母 + 数字 + 连字符,`developing-` 开头 | | F7 | argument-hint 存在 | frontmatter 中包含 argument-hint 字段 | -| F8 | allowed-tools 最小授权 | 只读 Skill 不包含 Write/Edit | +| F8 | allowed-tools 最小授权 | 工具列表按需最小化 | --- @@ -45,8 +45,8 @@ DDS-to-Skill 转换完成后,必须按以下清单逐条检查。每条标记 | C6 | 动态注入 | ≥ 2 处 `!` + 反引号命令 | | C7 | Pitfalls 引用 reference | ≥ 2 条 Pitfall 中出现 `reference/` 路径 | | C8 | 无空话 | 不含"检查 XX 一致性"这类无具体动作的描述 | -| C9 | 无常识内容 | 不含 Claude 已知的通用知识(如 HTTP 状态码定义) | -| C10 | 术语一致 | 同一概念在所有 Skill 中使用相同术语 | +| C9 | 无常识内容 | 不含 AI 已知的通用知识(如 HTTP 状态码定义) | +| C10 | 全栈覆盖 | Verify 和 Execute 至少覆盖数据库、API 两个层面 | --- @@ -54,7 +54,7 @@ DDS-to-Skill 转换完成后,必须按以下清单逐条检查。每条标记 | # | 检查项 | PASS 条件 | |---|-------|----------| -| R1 | 设计要素覆盖率 | 每个模块 Skill 覆盖 ≥ 3 类(API/事件/DB/状态机/权限/依赖) | +| R1 | 设计要素覆盖率 | 覆盖 ≥ 3 类(API/事件/DB/状态机/权限/依赖) | | R2 | 章节分层 | reference/ 下存在 `01-*` 等编号目录(或使用扁平+说明) | | R3 | DDS 溯源 | 每条 reference 含 `DDS-Section:` 字段 | | R4 | DDS 行号 | 每条 reference 含 `DDS-Lines:` 字段 | @@ -64,51 +64,50 @@ DDS-to-Skill 转换完成后,必须按以下清单逐条检查。每条标记 --- -## 5. 跨 Skill 一致性 - -| # | 检查项 | PASS 条件 | -|---|-------|----------| -| X1 | 模块名一致 | 所有 Skill 中模块名拼写相同 | -| X2 | 错误码不冲突 | 相同错误码在不同 Skill 中含义相同 | -| X3 | API 路径不冲突 | 不同模块的 API 路径无重叠 | -| X4 | 事件/Topic 定义一致 | 同一 Topic 在发布方和订阅方 Skill 中定义相同 | -| X5 | 授权模型一致 | JWT Claims、角色定义在所有 Skill 中一致 | - ---- - -## 6. 自检输出格式 +## 5. 自检输出格式 ```markdown # 全局自检结果 -## 结构完整性 -- ✅ S1 PASS: 系统级 Skill `developing-xxx-system` 存在 -- ✅ S2 PASS: 模块级 Skills 数量 = 5(匹配 DDS 中的 5 个模块) -- ❌ S3 FAIL: 横切 Skills 仅 2 个,少于要求的 3 个 - - **修复**: 从 DDS 中识别出缓存策略章节,建议增加 `managing-cache` Skill -- ✅ S4 PASS: 所有 Skill 目录下存在 SKILL.md +## 结构完整性(唯一收敛性) +- ✅ S1 PASS: 仅存在 1 个模块 Skill `developing-rmdc-feishu-operator` +- ✅ S2 PASS: 不存在任何 `*-system` 系统级 Skill +- ✅ S3 PASS: 不存在任何 `managing-*` / `designing-*` / `implementing-*` 横切 Skill +- ✅ S4 PASS: SKILL.md 存在 +- ✅ S5 PASS: reference/ 目录存在 +- ✅ S6 PASS: scripts/verify.sh 存在 +- ✅ S7 PASS: 目录命名 `developing-rmdc-feishu-operator` 符合规范 ## Frontmatter 规范 -- ✅ F1 PASS: 所有 description 为单行 -- ❌ F2 FAIL: `developing-core` 的 description 超过 1024 字符(1156 字符) - - **修复**: 精简触发场景描述,移除重复关键词 +- ✅ F1 PASS: description 为单行 +- ✅ F2 PASS: description 长度 = 856 字符 (< 1024) +- ✅ F3 PASS: description 同时包含中文和英文 +- ✅ F4 PASS: description 包含触发场景 +- ✅ F5 PASS: description 包含关键词 ## 内容质量 -- ✅ C1 PASS: 所有 SKILL.md < 500 行 -- ❌ C8 FAIL: `developing-gateway` 中 Verify 包含"检查 API 一致性" - - **修复**: 改为"对照 reference/02-api-design/apis.md 中的接口清单,grep 仓库中的 handler 注册点,确认路径和方法一致" +- ✅ C1 PASS: SKILL.md = 380 行 (< 500) +- ✅ C10 PASS: Verify 覆盖数据库、API、状态机、事件 4 个层面;Execute 覆盖 6 个步骤 +- ❌ C8 FAIL: Verify 中包含"检查通知一致性" + - **修复**: 改为"对照 reference/03-notification/card-templates.md 中的模板列表,grep 仓库中的 SendCard 调用点,确认 template_id 一致" -## 总计: XX PASS / YY FAIL +## Reference 质量 +- ✅ R1 PASS: 覆盖 5 类设计要素(API、事件、DB、状态机、依赖) +- ✅ R3 PASS: 所有 reference 条目含 DDS-Section 溯源 + +## 总计: 14 PASS / 1 FAIL ``` --- -## 7. 常见 FAIL 及修复方案 +## 6. 常见 FAIL 及修复方案 | FAIL 类型 | 常见原因 | 修复方案 | -|----------|---------|---------| +|----------|---------|---------| +| 越界生成多个 Skill | 习惯性拆分横切关注点 | 将横切内容收入唯一 Skill 的 reference/ 和 Execute 步骤 | +| 生成了 *-system Skill | 沿用旧的三层架构模式 | 删除系统级 Skill,将跨模块依赖收入 Plan 决策点或 Pitfalls | | description 多行 | 使用了 `\|` 语法 | 改用 `>` 或单行字符串 | | reference 不足 | DDS 内容被遗漏 | 重新扫描 DDS,补充缺失要素 | | 空话 | 直接复制 DDS 原文 | 转化为可执行的审查动作 | | 脑补 | DDS 未提及的细节 | 标注 [TBD] 并列出补充清单 | -| 横切不足 | 未充分分析 DDS | 从 DDS 中识别更多跨模块关注点 | +| 全栈覆盖不足 | Verify/Execute 仅覆盖部分层面 | 根据 DDS 内容补充数据库/API/状态机/事件等层面 | diff --git a/.agents/skills/dds-to-skill/reference/skill-templates.md b/.agents/skills/dds-to-skill/reference/skill-templates.md index 772fcd6..303e270 100644 --- a/.agents/skills/dds-to-skill/reference/skill-templates.md +++ b/.agents/skills/dds-to-skill/reference/skill-templates.md @@ -1,107 +1,18 @@ # SKILL.md 模板库 -本文档包含系统级 Skill、模块级 Skill、横切 Skill 的 SKILL.md 模板,供 DDS-to-Skill 转换时参照。 +本文档包含单模块全栈开发指导书的 SKILL.md 模板,供 DDS-to-Skill 转换时参照。 + +> **注意**:本框架仅生成唯一的 `developing-` Skill,不生成系统级或横切级 Skill。 --- -## 1. 系统级 Skill 模板 - -```markdown ---- -name: developing--system -description: > - 指导 <系统名> 系统级开发决策与跨模块一致性(Guides system-level development for )。 - 包含:架构总览、模块注册、依赖规则、全局变更流程、版本兼容策略、技术栈规范。 - 触发场景 Trigger: 新增模块 / 跨模块变更 / 全局架构决策 / 技术栈选型。 - 关键词 Keywords: , system, architecture, 架构, 模块, 依赖, 兼容, cross-module。 -argument-hint: " - 指定涉及的模块名或变更类型" -allowed-tools: - - Read - - Glob - - Grep - - Bash ---- - -# Developing System - -<一段话描述系统整体架构、技术栈、模块组成> - -## Quick Context - -```bash -# 动态注入:查看系统模块结构 -!`ls -la /` - -# 动态注入:搜索模块间依赖 -!`grep -rnE "import|module|service" / | head -30` -``` - -## Architecture Overview - - - -## Module Registry - -| 模块 | 职责 | 技术 | Skill | -|------|------|------|-------| -| ... | ... | ... | `developing-` | - -## Plan - -### 产物清单 -- [ ] 确定变更涉及的模块列表 -- [ ] 确认是否涉及跨模块通信 -- [ ] 确认是否涉及契约变更 -- [ ] 确认是否需要数据库迁移 - -### 决策点 -1. 变更是否影响多个模块? -2. 是否需要版本兼容处理? -3. 是否需要全局配置变更? - -## Verify - -- [ ] 模块间依赖无循环 -- [ ] 共享契约版本一致 -- [ ] 全局配置项完整 -- [ ] 技术栈版本对齐 - -## Execute - -### 添加新模块 -1. 在项目根目录创建模块目录... -2. 注册到路由/网关... -3. 更新模块依赖图... - -### 跨模块变更 -1. 列出所有受影响模块... -2. 按依赖顺序逐个修改... -3. 运行集成测试... - -## Pitfalls - -1. **循环依赖**: 模块间禁止直接 import,必须通过共享接口定义 -2. **版本不一致**: 修改共享结构需同步更新所有消费方 -3. ... - -## Related References - -- [模块依赖关系](reference/dependencies.md) -- [技术栈规范](reference/tech-stack.md) -``` - ---- - -## 2. 模块级 Skill 模板 +## 1. 模块全栈开发指导书模板 ```markdown --- name: developing- description: > - 指导 模块的开发(Guides development of module)。 - 包含:<模块职责概述>、API 实现、数据库操作、状态管理、安全校验。 - 触发场景 Trigger: 开发/修改 相关功能 / <模块特定场景>。 - 关键词 Keywords: , <技术关键词>, <业务关键词>。 + 系统全栈开发指导 Skill(Full-stack development guide for )。涵盖 <技术栈概述>、<核心数据模型概述>、<核心业务流程概述>、<关键集成点概述>。触发场景 Trigger: 开发/修改/调试 任意模块时、审查代码变更时、排查问题时。关键词 Keywords: <模块名>, <技术关键词>, <业务关键词>。 argument-hint: " - e.g., 'create handler', 'add api', 'update schema'" allowed-tools: - Read @@ -114,7 +25,7 @@ allowed-tools: # Developing -<一段话描述模块职责、技术栈、在系统中的位置> +<一段话描述模块的整体职责、核心技术栈、适用范围。强调这是该模块的唯一全栈开发向导,涵盖数据库、API、状态流转、事件处理等所有开发层面。> ## Quick Context @@ -124,132 +35,137 @@ allowed-tools: # 动态注入:查看现有接口 !`grep -rn "func.*Handler\|func.*Service" .// | head -20` + +# 动态注入:查看数据库相关文件 +!`find . -name "*.sql" -o -name "*migration*" -o -name "*model*" | head -20` ``` ## Plan ### 产物清单 -- [ ] <根据 DDS 列出具体产物> +- [ ] <根据 DDS 列出具体产物:数据库模型、API handler、状态机实现等> +- [ ] <每一项都应对应 reference/ 中的设计细节> ### 决策点 -1. <从 DDS 抽取的关键决策> +1. <从 DDS 抽取的关键决策,如技术选型、架构权衡> 2. ... ## Verify -### <验证类别 1> -- [ ] <具体检查项,引用 reference> +> 全栈验证按以下顺序依次进行,确保底层就绪后再构建上层。 -### <验证类别 2> -- [ ] <具体检查项> +### 数据层验证 +- [ ] 数据库表结构与 `reference/
/db-schema.md` 一致 +- [ ] 索引、约束、外键按设计实现 +- [ ] 迁移脚本可回滚(包含 down 语句或回滚段落) + +### API 层验证 +- [ ] API 路径、方法与 `reference/
/apis.md` 定义一致 +- [ ] 请求/响应字段与设计文档吻合 +- [ ] 错误码覆盖文档中定义的所有异常场景 + +### 状态机/业务流程验证 +- [ ] 状态枚举与 `reference/
/state-machine.md` 中的状态集一致 +- [ ] 状态转移条件(守卫)按设计实现,无非法跳转 +- [ ] 回调/补偿逻辑在异常路径上正确触发 + +### 事件/消息验证 +- [ ] Topic 命名与 `reference/
/events-topics.md` 一致 +- [ ] Payload 字段完整且版本正确 +- [ ] 幂等键生成逻辑正确,消费端实现去重 + +### 安全/授权验证(如适用) +- [ ] 授权模型与 `reference/
/security-model.md` 一致 +- [ ] 敏感操作有权限校验 ## Execute -### 1. <步骤标题> -```bash -# 具体操作命令 +> 全栈开发按以下顺序推进,先夯实基础再构建业务。 + +### Step 1:数据库 Schema 实现 +1. 根据 `reference/
/db-schema.md` 创建数据库模型/实体 +2. 编写迁移脚本(必须包含 up 和 down) +3. 创建索引和约束 +```go +// 关键模型骨架(从 reference 中抽取) ``` -### 2. <步骤标题> +### Step 2:核心 API / Handler 实现 +1. 根据 `reference/
/apis.md` 注册路由 +2. 实现请求校验与响应序列化 +3. 实现错误码映射 ```go -// 关键代码骨架 +// 关键 handler 骨架 ``` +### Step 3:状态机 / 业务流程实现 +1. 根据 `reference/
/state-machine.md` 定义状态枚举与转移表 +2. 实现守卫条件与副作用 +3. 实现异常路径的回调/补偿 +```go +// 关键状态转移骨架 +``` + +### Step 4:事件/消息处理实现 +1. 根据 `reference/
/events-topics.md` 注册事件处理器 +2. 实现发布端 payload 构建 +3. 实现消费端幂等处理 +```go +// 关键事件处理骨架 +``` + +### Step 5:安全/授权实现(如适用) +1. 根据 `reference/
/security-model.md` 实现授权中间件 +2. 配置权限检查 + +### Step 6:可观测性与监控(如适用) +1. 接入日志、指标、追踪 +2. 配置关键业务指标告警 + ## Pitfalls 1. **<坑名>**: <描述>(参考 `reference/.md`) -2. ...(至少 3 条,至少 2 条引用 reference) +2. **<坑名>**: <描述>(参考 `reference/.md`) +3. ...(至少 3 条,至少 2 条引用 reference) ## Related References -- [API 定义](reference/01-
/apis.md) -- [数据库 Schema](reference/02-
/db-schema.md) +- [数据模型定义](reference/01-
/db-schema.md) — 修改表结构时查阅 +- [API 接口定义](reference/01-
/apis.md) — 新增/修改接口时查阅 +- [状态机定义](reference/02-
/state-machine.md) — 修改业务流程时查阅 +- [事件/Topic 定义](reference/02-
/events-topics.md) — 修改事件处理时查阅 ``` --- -## 3. 横切 Skill 模板 +## 2. 模板使用注意事项 -```markdown ---- -name: -description: > - <横切关注点>的统一规范与实现指导(Guides across all modules)。 - 包含:<具体内容列表>。 - 触发场景 Trigger: <触发场景列表>。 - 关键词 Keywords: <关键词列表>。 -argument-hint: " - 指定要应用规范的模块或文件" -allowed-tools: - - Read - - Glob - - Grep - - Bash ---- - -# <横切 Skill 标题> - -<描述这个横切关注点在系统中的重要性和适用范围> - -## Quick Context - -```bash -# 动态注入 -!`<扫描所有模块中与该横切主题相关的文件>` -``` - -## Plan - -### 产物清单 -- [ ] <横切维度的产物> - -### 决策点 -1. <跨模块的统一决策> -2. ... - -## Verify - -- [ ] <跨模块一致性检查> -- [ ] <规范合规检查> -- [ ] ... - -## Execute - -### 全局规范 -<适用于所有模块的规则> - -### 模块适配 -<各模块的特殊处理> - -## Pitfalls - -1. **<跨模块一致性问题>**: <描述> -2. ... - -## Related References - -- [全局规范定义](reference/.md) -``` - ---- - -## 4. 模板使用注意事项 - -### 4.1 必须自定义的部分 +### 2.1 必须自定义的部分 - `<尖括号>` 中的所有占位符 - Plan 的产物清单和决策点必须来自 DDS - Verify 的检查项必须与模块设计细节对应 -- Pitfalls 必须与模块/主题强相关,不可用通用建议填充 +- Execute 的步骤必须绑定 reference/ 中的具体设计文档 +- Pitfalls 必须与模块强相关,不可用通用建议填充 -### 4.2 禁止照搬模板 +### 2.2 禁止照搬模板 模板是结构参考,不是内容来源。以下行为将导致自检 FAIL: - 产物清单中出现模板占位符 -- Pitfalls 与模块无关(如:在前端 Skill 中出现数据库 Pitfall) -- Verify 中没有引用任何 reference +- Pitfalls 与模块无关 +- Verify/Execute 中没有引用任何 reference +- Execute 步骤缺失具体的代码骨架或命令 -### 4.3 按 DDS 内容增减 +### 2.3 按 DDS 内容增减 -- 如果 DDS 中没有状态机,模块 Skill 可以不包含状态机相关 Verify -- 如果 DDS 中有额外的关注点(如性能优化、缓存策略),应增加对应章节 -- 横切 Skill 的数量和主题必须由 DDS 内容决定 +- 如果 DDS 中没有状态机,可以省略 Step 3 和状态机验证 +- 如果 DDS 中没有事件系统,可以省略 Step 4 和事件验证 +- 如果 DDS 中有额外的关注点(如缓存策略、性能优化),应在 Verify 和 Execute 中增加对应章节 +- Verify 和 Execute 的分层顺序可根据 DDS 中的技术架构调整,但必须保持"先基础后上层"的原则 + +### 2.4 全栈覆盖要求 + +作为唯一的开发指导书,必须确保: +- 所有原本属于"横切 Skill"(如数据库迁移、安全认证、可观测性)的知识都内嵌到 Verify/Execute 的对应步骤中 +- 原本属于"系统级 Skill"(如跨模块依赖、全局配置)的知识收入 Plan 的决策点或 Pitfalls 中 +- 所有设计细节的完整数据存放在 `reference/` 下,SKILL.md 中仅以引用方式指向 diff --git a/.agents/skills/dds-to-skill/scripts/verify-skill-output.sh b/.agents/skills/dds-to-skill/scripts/verify-skill-output.sh index 37d2935..01c6020 100644 --- a/.agents/skills/dds-to-skill/scripts/verify-skill-output.sh +++ b/.agents/skills/dds-to-skill/scripts/verify-skill-output.sh @@ -1,10 +1,14 @@ #!/bin/bash # verify-skill-output.sh -# 验证 DDS-to-Skill 转换输出的完整性和质量 +# 验证 DDS-to-Skill 转换输出的完整性和质量(单模块 All-in-One 模式) # # 用法:./verify-skill-output.sh # 示例:./verify-skill-output.sh /path/to/1-AgentSkills # +# 校验规则: +# - 仅允许存在 1 个 developing-* 目录 +# - 不允许存在 *-system、managing-*、designing-*、implementing-* 等越界 Skill +# # 依赖:bash, grep, sed, find, wc set -e @@ -37,26 +41,56 @@ warn() { } echo "============================================" -echo " DDS-to-Skill 输出质量验证" +echo " DDS-to-Skill 输出质量验证(单模块模式)" echo " 目标目录: $SKILLS_DIR" echo "============================================" echo "" # ============================================ -# 1. 结构完整性检查 +# 1. 唯一收敛性检查(最高优先级) # ============================================ -echo "--- 1. 结构完整性 ---" +echo "--- 1. 唯一收敛性 ---" -# S1: 检查是否有系统级 Skill -SYSTEM_SKILLS=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "*-system*" 2>/dev/null | wc -l) -if [ "$SYSTEM_SKILLS" -ge 1 ]; then - pass "S1: 存在系统级 Skill ($SYSTEM_SKILLS 个)" +# S1: 确认 developing-* 目录数量恰好为 1 +DEV_SKILLS=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "developing-*" 2>/dev/null | wc -l) +if [ "$DEV_SKILLS" -eq 1 ]; then + DEV_SKILL_NAME=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "developing-*" -exec basename {} \;) + pass "S1: 恰好存在 1 个模块 Skill: $DEV_SKILL_NAME" +elif [ "$DEV_SKILLS" -eq 0 ]; then + fail "S1: 未找到任何 developing-* 目录" "确认输出目录正确,并确保生成了 developing- Skill" else - warn "S1: 未找到系统级 Skill(名称包含 '-system')" + fail "S1: 发现 $DEV_SKILLS 个 developing-* 目录(应为 1 个)" "合并或删除多余的 developing-* 目录,仅保留 1 个" fi -# S4: 每个 Skill 都有 SKILL.md -SKILL_DIRS=$(find "$SKILLS_DIR" -maxdepth 1 -type d ! -name "$(basename "$SKILLS_DIR")" 2>/dev/null) +# S2: 反向校验 — 不允许存在系统级 Skill +SYSTEM_SKILLS=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "*-system*" 2>/dev/null | wc -l) +if [ "$SYSTEM_SKILLS" -eq 0 ]; then + pass "S2: 不存在越界的系统级 Skill (*-system)" +else + SYSTEM_NAMES=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "*-system*" -exec basename {} \; | tr '\n' ', ') + fail "S2: 发现 $SYSTEM_SKILLS 个越界的系统级 Skill: $SYSTEM_NAMES" "删除系统级 Skill,将跨模块内容收入唯一的 developing-* Skill" +fi + +# S3: 反向校验 — 不允许存在横切 Skill (managing-*, designing-*, implementing-*) +CROSSCUT_SKILLS=$(find "$SKILLS_DIR" -maxdepth 1 -type d \( -name "managing-*" -o -name "designing-*" -o -name "implementing-*" \) 2>/dev/null | wc -l) +if [ "$CROSSCUT_SKILLS" -eq 0 ]; then + pass "S3: 不存在越界的横切 Skill (managing-*/designing-*/implementing-*)" +else + CROSSCUT_NAMES=$(find "$SKILLS_DIR" -maxdepth 1 -type d \( -name "managing-*" -o -name "designing-*" -o -name "implementing-*" \) -exec basename {} \; | tr '\n' ', ') + fail "S3: 发现 $CROSSCUT_SKILLS 个越界的横切 Skill: $CROSSCUT_NAMES" "删除横切 Skill,将其内容收入唯一的 developing-* Skill 的 reference/ 和 Execute 中" +fi + +echo "" + +# ============================================ +# 2. 结构完整性检查 +# ============================================ +echo "--- 2. 结构完整性 ---" + +# 获取唯一的 developing-* 目录 +SKILL_DIRS=$(find "$SKILLS_DIR" -maxdepth 1 -type d -name "developing-*" 2>/dev/null) + +# S4: Skill 有 SKILL.md MISSING_SKILLMD=0 for dir in $SKILL_DIRS; do if [ ! -f "$dir/SKILL.md" ]; then @@ -64,28 +98,40 @@ for dir in $SKILL_DIRS; do ((MISSING_SKILLMD++)) fi done -if [ "$MISSING_SKILLMD" -eq 0 ]; then - pass "S4: 所有 Skill 目录都有 SKILL.md" +if [ "$MISSING_SKILLMD" -eq 0 ] && [ -n "$SKILL_DIRS" ]; then + pass "S4: Skill 目录有 SKILL.md" fi -# S5: 每个 Skill 都有 reference/ +# S5: Skill 有 reference/ MISSING_REF=0 for dir in $SKILL_DIRS; do if [ ! -d "$dir/reference" ]; then - warn "S5: $dir 缺少 reference/ 目录" + fail "S5: $dir 缺少 reference/ 目录" "创建 reference/ 并按 DDS 章节填充设计细节" ((MISSING_REF++)) fi done -if [ "$MISSING_REF" -eq 0 ]; then - pass "S5: 所有 Skill 目录都有 reference/" +if [ "$MISSING_REF" -eq 0 ] && [ -n "$SKILL_DIRS" ]; then + pass "S5: Skill 目录有 reference/" +fi + +# S6: Skill 有 scripts/verify.sh +MISSING_VERIFY=0 +for dir in $SKILL_DIRS; do + if [ ! -f "$dir/scripts/verify.sh" ]; then + fail "S6: $dir 缺少 scripts/verify.sh" "创建 scripts/verify.sh 验证脚本" + ((MISSING_VERIFY++)) + fi +done +if [ "$MISSING_VERIFY" -eq 0 ] && [ -n "$SKILL_DIRS" ]; then + pass "S6: Skill 目录有 scripts/verify.sh" fi echo "" # ============================================ -# 2. Frontmatter 规范检查 +# 3. Frontmatter 规范检查 # ============================================ -echo "--- 2. Frontmatter 规范 ---" +echo "--- 3. Frontmatter 规范 ---" for dir in $SKILL_DIRS; do SKILL_FILE="$dir/SKILL.md" @@ -106,6 +152,14 @@ for dir in $SKILL_DIRS; do fail "F2 [$SKILL_NAME]: 缺少 description 字段" "在 frontmatter 中添加 description 字段" fi + # F6: name 以 developing- 开头 + SKILL_NAME_VALUE=$(head -20 "$SKILL_FILE" | grep '^name:' | sed 's/^name:[[:space:]]*//') + if echo "$SKILL_NAME_VALUE" | grep -q '^developing-'; then + pass "F6 [$SKILL_NAME]: name 以 developing- 开头" + else + fail "F6 [$SKILL_NAME]: name 不以 developing- 开头 (当前: $SKILL_NAME_VALUE)" "修改 name 为 developing- 格式" + fi + # C1: 行数 < 500 LINE_COUNT=$(wc -l < "$SKILL_FILE") if [ "$LINE_COUNT" -lt 500 ]; then @@ -118,9 +172,9 @@ done echo "" # ============================================ -# 3. 内容质量检查 +# 4. 内容质量检查 # ============================================ -echo "--- 3. 内容质量 ---" +echo "--- 4. 内容质量 ---" for dir in $SKILL_DIRS; do SKILL_FILE="$dir/SKILL.md" @@ -156,9 +210,9 @@ done echo "" # ============================================ -# 4. Reference 质量检查 +# 5. Reference 质量检查 # ============================================ -echo "--- 4. Reference 质量 ---" +echo "--- 5. Reference 质量 ---" for dir in $SKILL_DIRS; do [ ! -d "$dir/reference" ] && continue @@ -201,7 +255,7 @@ echo "" # 总结 # ============================================ echo "============================================" -echo " 验证完成" +echo " 验证完成(单模块 All-in-One 模式)" echo " ✅ PASS: $PASS" echo " ❌ FAIL: $FAIL" echo " ⚠️ WARN: $WARN" diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..564cff9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..f646529 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,7 @@ + + \ No newline at end of file diff --git a/1-AgentSkills/andrej-karpathy-skills/SKILL.md b/1-AgentSkills/andrej-karpathy-skills/SKILL.md new file mode 100644 index 0000000..9f945db --- /dev/null +++ b/1-AgentSkills/andrej-karpathy-skills/SKILL.md @@ -0,0 +1,67 @@ +--- +name: karpathy-guidelines +description: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria. +license: MIT +--- + +# Karpathy Guidelines + +Behavioral guidelines to reduce common LLM coding mistakes, derived from [Andrej Karpathy's observations](https://x.com/karpathy/status/2015883857489522876) on LLM coding pitfalls. + +**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment. + +## 1. Think Before Coding + +**Don't assume. Don't hide confusion. Surface tradeoffs.** + +Before implementing: +- State your assumptions explicitly. If uncertain, ask. +- If multiple interpretations exist, present them - don't pick silently. +- If a simpler approach exists, say so. Push back when warranted. +- If something is unclear, stop. Name what's confusing. Ask. + +## 2. Simplicity First + +**Minimum code that solves the problem. Nothing speculative.** + +- No features beyond what was asked. +- No abstractions for single-use code. +- No "flexibility" or "configurability" that wasn't requested. +- No error handling for impossible scenarios. +- If you write 200 lines and it could be 50, rewrite it. + +Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify. + +## 3. Surgical Changes + +**Touch only what you must. Clean up only your own mess.** + +When editing existing code: +- Don't "improve" adjacent code, comments, or formatting. +- Don't refactor things that aren't broken. +- Match existing style, even if you'd do it differently. +- If you notice unrelated dead code, mention it - don't delete it. + +When your changes create orphans: +- Remove imports/variables/functions that YOUR changes made unused. +- Don't remove pre-existing dead code unless asked. + +The test: Every changed line should trace directly to the user's request. + +## 4. Goal-Driven Execution + +**Define success criteria. Loop until verified.** + +Transform tasks into verifiable goals: +- "Add validation" → "Write tests for invalid inputs, then make them pass" +- "Fix the bug" → "Write a test that reproduces it, then make it pass" +- "Refactor X" → "Ensure tests pass before and after" + +For multi-step tasks, state a brief plan: +``` +1. [Step] → verify: [check] +2. [Step] → verify: [check] +3. [Step] → verify: [check] +``` + +Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification. \ No newline at end of file diff --git a/1-AgentSkills/doc-sync-skill/SKILL.md b/1-AgentSkills/doc-sync-skill/SKILL.md new file mode 100644 index 0000000..5deb242 --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/SKILL.md @@ -0,0 +1,250 @@ +--- +name: doc-sync-skill +description: > + 当 PRD 文档版本更新时,自动分析两版 PRD 差异并生成 Change Intent,驱动 DDS 与 AgentSkill 的增量同步更新,最终归档版本矩阵。 + Automatically analyzes PRD version diffs, generates structured Change Intent, drives incremental DDS and AgentSkill updates, and archives version matrix. + 触发场景 Trigger: 当用户提供了新旧两版 PRD 文档并需要同步更新 DDS 和 Skill / 需要执行文档级联变更 / 需要生成版本归档矩阵。 + 关键词 Keywords: PRD, DDS, diff, 增量更新, incremental update, change intent, version matrix, skill sync, 文档同步, doc sync, 版本管理。 +version: 1.0.0 +author: wdd +argument-hint: "--old --new [--dds ] [--skills-dir ]" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Doc-Sync-Skill:PRD 增量变更驱动的文档级联同步 + +本 Skill 用于在软件开发流程中,当 PRD(产品需求文档)从旧版本更新到新版本时,自动完成以下四个阶段的级联同步: + +1. **Phase 1 — PRD Diff 分析**:对比新旧 PRD,生成结构化 Change Intent +2. **Phase 2 — DDS 增量更新**:基于 Change Intent 驱动 DDS 只改受影响章节 +3. **Phase 3 — AgentSkill 增量更新**:基于 DDS 变更同步更新相关 SKILL.md +4. **Phase 4 — 版本归档**:生成 VERSION_MATRIX.md 追踪所有文档版本关系 + +> **核心原则**: +> - **最小变更原则** — 只修改受 PRD 变更影响的章节,未提及部分绝对不动 +> - **溯源可追踪** — 每一处变更都能追溯到具体的 PRD 变更条目 +> - **幂等安全** — 相同输入多次执行应产生相同结果 + +--- + +## 前置条件 + +执行前必须确认以下文件存在: + +| 文件 | 必需 | 用途 | +|------|------|------| +| 旧版 PRD(`--old`) | ✅ | PRD diff 基准 | +| 新版 PRD(`--new`) | ✅ | PRD diff 目标 | +| 当前 DDS(`--dds`) | ⚠️ Phase 2 必需 | DDS 增量更新的基础 | +| Skills 目录(`--skills-dir`) | ⚠️ Phase 3 必需 | Skill 增量更新的目标目录 | + +### 文件不存在时的降级策略 + +- **旧版 PRD 不存在**:终止执行,提示用户提供旧版 PRD 路径 +- **新版 PRD 不存在**:终止执行,提示用户提供新版 PRD 路径 +- **DDS 不存在**:跳过 Phase 2,在 Phase 4 记录"DDS 待创建" +- **Skills 目录不存在**:跳过 Phase 3,在 Phase 4 记录"Skills 待创建" + +--- + +## Phase 1:PRD Diff 分析 → 生成 Change Intent + +### 1.1 执行 PRD 差异对比脚本 + +使用 `scripts/diff_prd.py` 对新旧两版 PRD 进行章节级对比: + +```bash +# 运行 PRD 差异对比 +python3 "$(dirname "$0")/scripts/diff_prd.py" --old "$OLD_PRD_PATH" --new "$NEW_PRD_PATH" +``` + +该脚本输出结构化 JSON,包含: +- `added_sections`:新增章节列表 +- `modified_sections`:修改章节列表(含 old/new 对比) +- `removed_sections`:删除章节列表 +- `summary`:变更摘要 + +### 1.2 生成 Change Intent 文档 + +基于脚本输出的 JSON,填充 `references/CHANGE_INTENT_TEMPLATE.md` 模板: + +1. 读取模板:`references/CHANGE_INTENT_TEMPLATE.md` +2. 根据 JSON 结果填充所有字段 +3. 输出完成的 Change Intent 文档到工作目录 + +**填充规则**: +- `变更版本`:从新版 PRD 的文档头提取版本号 +- `变更日期`:使用当前日期 +- `新增需求列表`:对应 `added_sections` +- `修改需求列表`:对应 `modified_sections` +- `废弃需求列表`:对应 `removed_sections` +- `影响模块列表`:从变更章节中提取涉及的模块/组件名称 +- `变更摘要`:使用 JSON 中的 `summary` 字段,必要时补充人工判断 + +### 1.3 Change Intent 质量门禁 + +生成的 Change Intent 必须通过以下检查: +- [ ] 所有字段非空(或显式标注"无") +- [ ] 影响模块列表至少 1 项(纯文案修改除外) +- [ ] 变更摘要不超过 500 字 +- [ ] 新增/修改/废弃列表与 diff 脚本输出一致 + +--- + +## Phase 2:DDS 增量更新 + +### 2.1 准备 DDS 更新 Prompt + +将 Change Intent 和当前 DDS 内容注入 `references/DDS_UPDATE_PROMPT.md`: + +1. 读取当前 DDS 全文 +2. 读取 Phase 1 生成的 Change Intent +3. 将两者填入 `references/DDS_UPDATE_PROMPT.md` 的对应占位符 + +**变量替换**: +- `{{CHANGE_INTENT}}` → 完整的 Change Intent 文档内容 +- `{{CURRENT_DDS}}` → 当前 DDS 全文 + +### 2.2 执行 DDS 更新 + +将准备好的 Prompt 发送给大模型,获得 DDS 增量更新内容。 + +**输出格式要求**(在 Prompt 中已约束): +- `[NEW]` 标注新增章节 +- `[MODIFIED]` 标注修改章节,含 diff 对比 +- `[DEPRECATED]` 标注废弃章节 +- 未提及的章节**绝对不修改** + +### 2.3 应用 DDS 变更 + +将大模型返回的增量更新逐章节应用到 DDS 文件: + +1. 对 `[NEW]` 章节:插入到 DDS 合适位置 +2. 对 `[MODIFIED]` 章节:替换对应章节内容 +3. 对 `[DEPRECATED]` 章节:标注废弃标记(保留原文,添加删除线或注释) +4. 更新 DDS 文档头的版本号(按 Prompt 建议) + +### 2.4 DDS 变更验证 + +- [ ] 只有 Change Intent 中涉及的章节被修改 +- [ ] 未涉及章节内容与原文完全一致 +- [ ] 文档版本号已更新 +- [ ] 无语法错误(Markdown lint 通过) + +--- + +## Phase 3:AgentSkill 增量更新 + +### 3.1 一致性检查 + +运行 `scripts/sync_check.py` 检查 DDS 与 Skills 的对应关系: + +```bash +python3 "$(dirname "$0")/scripts/sync_check.py" --dds "$DDS_PATH" --skills-dir "$SKILLS_DIR" +``` + +该脚本输出不一致报告: +- DDS 中有定义但无对应 Skill 的模块 +- Skills 目录中有 Skill 但无对应 DDS 章节的模块 + +### 3.2 确定需要更新的 Skill 列表 + +基于 Phase 2 的 DDS 变更内容,确定受影响的 Skill 列表: + +1. 提取 DDS 中 `[NEW]`/`[MODIFIED]`/`[DEPRECATED]` 章节涉及的模块名 +2. 在 Skills 目录中查找对应的 SKILL.md 文件 +3. 对于 DDS 新增模块但无 Skill 的情况,标记为"需新建 Skill" + +### 3.3 执行 Skill 增量更新 + +对每个受影响的 Skill,使用 `references/SKILL_UPDATE_PROMPT.md` 驱动更新: + +**变量替换**: +- `{{DDS_DIFF}}` → 该模块涉及的 DDS 变更内容(`[NEW]`/`[MODIFIED]`/`[DEPRECATED]` 片段) +- `{{SKILL_NAME}}` → 当前 Skill 的 name 值 +- `{{CURRENT_SKILL_MD}}` → 当前 SKILL.md 全文 + +**更新规则**: +- 只更新受 DDS 变更影响的部分 +- version 字段 patch 版本 +1 +- 输出完整的新 SKILL.md 内容(直接覆盖写入) + +### 3.4 Skill 更新验证 + +对每个更新后的 Skill 执行以下检查: +- [ ] SKILL.md 的 YAML frontmatter 格式正确 +- [ ] version 字段已递增 +- [ ] name 字段未被修改 +- [ ] description 保持单行且 < 1024 字符 +- [ ] 未受影响的章节内容未被修改 + +--- + +## Phase 4:版本归档 + +### 4.1 生成 VERSION_MATRIX.md + +基于 `assets/VERSION_MATRIX_TEMPLATE.md` 模板,追加一行新的版本记录: + +| 字段 | 取值来源 | +|------|---------| +| 迭代日期 | 当前执行日期 | +| PRD版本 | 新版 PRD 中提取的版本号 | +| DDS版本 | 更新后 DDS 的版本号 | +| 受影响Skill | Phase 3 中更新的 Skill 名称列表 | +| 变更摘要 | Change Intent 中的变更摘要 | +| Git Commit | 预留占位(手动填写或自动获取) | + +### 4.2 归档文件存放位置 + +VERSION_MATRIX.md 存放在项目根目录或用户指定目录,采用**追加模式**: +- 如果文件已存在,在表格末尾追加新行 +- 如果文件不存在,从模板创建并填入第一条记录 + +--- + +## 异常处理规则 + +| 异常场景 | 处理策略 | +|---------|---------| +| 旧版/新版 PRD 文件不存在 | 终止执行,输出错误信息 | +| diff_prd.py 脚本执行失败 | 输出错误日志,提示用户手动对比 | +| DDS 文件不存在 | 跳过 Phase 2/3,仅执行 Phase 1/4 | +| Skills 目录不存在 | 跳过 Phase 3,仅执行 Phase 1/2/4 | +| DDS 更新 Prompt 返回格式异常 | 要求重新生成,最多重试 2 次 | +| Skill 更新后 frontmatter 格式错误 | 回滚该 Skill 更新,标记为需人工修复 | +| sync_check.py 发现不一致模块 | 在 VERSION_MATRIX 中记录,不阻断流程 | + +--- + +## 输出清单 + +每次执行完成后,必须输出以下产物清单: + +``` +📋 Doc-Sync 执行报告 +├── [Phase 1] CHANGE_INTENT.md — PRD 变更意图文档 +├── [Phase 2] DDS 更新文件 — 增量更新后的 DDS(如适用) +├── [Phase 3] 更新的 SKILL.md 列表 — 增量更新后的 Skills(如适用) +├── [Phase 4] VERSION_MATRIX.md — 追加后的版本矩阵 +└── [报告] 执行摘要 — 各 Phase 执行状态汇总 +``` + +--- + +## Quick Reference + +| 需要了解... | 查阅... | +|------------|--------| +| Change Intent 的结构模板 | `references/CHANGE_INTENT_TEMPLATE.md` | +| DDS 增量更新 Prompt | `references/DDS_UPDATE_PROMPT.md` | +| Skill 增量更新 Prompt | `references/SKILL_UPDATE_PROMPT.md` | +| PRD 差异对比脚本 | `scripts/diff_prd.py` | +| DDS-Skill 一致性检查脚本 | `scripts/sync_check.py` | +| 版本矩阵归档模板 | `assets/VERSION_MATRIX_TEMPLATE.md` | diff --git a/1-AgentSkills/doc-sync-skill/assets/VERSION_MATRIX_TEMPLATE.md b/1-AgentSkills/doc-sync-skill/assets/VERSION_MATRIX_TEMPLATE.md new file mode 100644 index 0000000..394173b --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/assets/VERSION_MATRIX_TEMPLATE.md @@ -0,0 +1,27 @@ +# VERSION MATRIX — 文档版本追踪矩阵 + +> 本表记录每次 PRD → DDS → Skill 级联同步的版本变更历史。 +> 由 doc-sync-skill Phase 4 自动追加,请勿手动删除已有记录。 + +--- + +| 迭代日期 | PRD版本 | DDS版本 | 受影响Skill | 变更摘要 | Git Commit | +|---------|--------|--------|------------|---------|-----------| +| `` | `` | `` | `` | `<简要描述本次变更>` | `` | + +--- + +## 使用说明 + +1. **自动追加**:每次执行 doc-sync-skill 的 Phase 4 时,会在表格末尾追加一行新记录 +2. **手动补充**:Git Commit 列可在提交后手动填写,或通过 CI 自动获取 +3. **版本格式**:所有版本号遵循语义化版本规范(SemVer) +4. **历史保留**:请勿删除已有行,保持完整的变更历史 + +## 版本号约定 + +| 变更类型 | 版本递增规则 | 示例 | +|---------|------------|------| +| 文案/细节修正 | patch +1 | v1.0.0 → v1.0.1 | +| 新增功能模块 | minor +1 | v1.0.0 → v1.1.0 | +| 架构级重构 | major +1 | v1.0.0 → v2.0.0 | diff --git a/1-AgentSkills/doc-sync-skill/references/CHANGE_INTENT_TEMPLATE.md b/1-AgentSkills/doc-sync-skill/references/CHANGE_INTENT_TEMPLATE.md new file mode 100644 index 0000000..3132db6 --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/references/CHANGE_INTENT_TEMPLATE.md @@ -0,0 +1,93 @@ +# Change Intent — PRD 变更意图文档 + +> 本文档由 doc-sync-skill Phase 1 自动生成,描述 PRD 两个版本之间的结构化变更。 + +--- + +## 元信息 + +| 字段 | 值 | +|------|------| +| **变更版本** | `<旧版本号>` → `<新版本号>` | +| **变更日期** | `` | +| **变更范围** | `<全局 / 局部模块名列表>` | +| **变更发起人** | `<姓名或角色>` | + +--- + +## 新增需求列表 + +> 在新版 PRD 中新增、旧版中不存在的章节或需求。 + +| 序号 | 章节标题 | 需求概述 | 优先级 | +|------|---------|---------|-------| +| 1 | `<章节标题>` | `<一句话描述该新增需求>` | `` | +| 2 | `<章节标题>` | `<一句话描述该新增需求>` | `` | + +--- + +## 修改需求列表 + +> 在新版 PRD 中内容发生变化的章节(标题可能相同,但内容不同)。 + +| 序号 | 章节标题 | 变更类型 | 变更描述 | +|------|---------|---------|---------| +| 1 | `<章节标题>` | `<内容修改 / 重构 / 增强>` | `<具体变更描述,对比旧版说明改了什么>` | +| 2 | `<章节标题>` | `<内容修改 / 重构 / 增强>` | `<具体变更描述>` | + +### 修改详情 + +对于每个修改章节,记录关键 diff: + +#### M1. `<章节标题>` + +**旧版内容摘要**: +``` +<旧版关键内容摘要> +``` + +**新版内容摘要**: +``` +<新版关键内容摘要> +``` + +**变更原因**:`<为什么修改>` + +--- + +## 废弃需求列表 + +> 在旧版 PRD 中存在、但在新版中被移除或标记废弃的章节。 + +| 序号 | 章节标题 | 废弃原因 | 替代方案 | +|------|---------|---------|---------| +| 1 | `<章节标题>` | `<废弃原因>` | `<替代方案或"无">` | + +--- + +## 影响模块列表 + +> 基于上述变更分析,推断受影响的系统模块/组件。 + +| 模块名称 | 影响类型 | 影响说明 | +|---------|---------|---------| +| `<模块名>` | `<新增 / 修改 / 废弃>` | `<该模块如何受影响>` | + +--- + +## 变更摘要 + +> 用不超过 500 字概括本次 PRD 变更的整体目的和核心内容。 + +``` +<变更摘要正文> +``` + +--- + +## 后续动作建议 + +- [ ] 基于本 Change Intent 更新 DDS(Phase 2) +- [ ] 更新受影响的 AgentSkill(Phase 3) +- [ ] 归档版本矩阵(Phase 4) +- [ ] 通知相关开发人员 diff --git a/1-AgentSkills/doc-sync-skill/references/DDS_UPDATE_PROMPT.md b/1-AgentSkills/doc-sync-skill/references/DDS_UPDATE_PROMPT.md new file mode 100644 index 0000000..d3255c4 --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/references/DDS_UPDATE_PROMPT.md @@ -0,0 +1,125 @@ +# DDS 增量更新 Prompt + +> 本文档是一份完整的 Prompt 模板,用于驱动大模型对 DDS(详细设计文档)进行增量更新。 +> 使用时将 `{{CHANGE_INTENT}}` 和 `{{CURRENT_DDS}}` 替换为实际内容后,整体发送给大模型。 + +--- + +## Prompt 正文 + +``` +你是一名资深软件架构师,拥有 15 年以上的系统设计经验。你当前的任务是根据提供的 PRD 变更意图(Change Intent),对现有的详细设计文档(DDS)进行精确的增量更新。 + +## 你的角色与职责 + +- 你是一名严谨的架构师,只做必要的最小变更 +- 你必须保持 DDS 整体架构的一致性和连贯性 +- 你绝不会修改未被 Change Intent 提及的章节 +- 你会为每一处变更提供清晰的变更标注和理由 + +## 输入 + +### Change Intent(PRD 变更意图) + +{{CHANGE_INTENT}} + +### 当前 DDS 全文 + +{{CURRENT_DDS}} + +## 输出要求 + +请按照以下规则输出 DDS 增量更新内容: + +### 标注规则 + +对于每个需要变更的章节,使用以下标注格式: + +#### 1. 新增章节 — `[NEW]` + +```markdown +## [NEW] <章节标题> + + + +<新章节完整内容> +``` + +#### 2. 修改章节 — `[MODIFIED]` + +```markdown +## [MODIFIED] <章节标题> + + + +### 变更对比 + +#### 原内容: +​``` +<被修改部分的原文> +​``` + +#### 新内容: +​``` +<修改后的完整内容> +​``` + +### 完整更新后章节 + +<该章节更新后的完整内容,可直接替换原章节> +``` + +#### 3. 废弃章节 — `[DEPRECATED]` + +```markdown +## [DEPRECATED] <章节标题> + + + + +> ⚠️ 本章节已废弃,原因:<简述废弃原因> + +~~<原章节内容保留,加删除线>~~ +``` + +### 严格约束 + +1. **最小变更原则**:只输出 Change Intent 中提及的变更所影响的章节。如果 Change Intent 没有提到某个章节,**绝对不要输出该章节的任何内容**。 +2. **溯源标注**:每个 `[NEW]`/`[MODIFIED]`/`[DEPRECATED]` 标注必须在注释中说明对应的 Change Intent 条目。 +3. **结构保持**:新增或修改的章节必须与现有 DDS 的格式风格保持一致(标题层级、表格格式、代码块风格等)。 +4. **接口兼容**:修改涉及 API 接口时,必须标注是否存在 breaking change,如有则需提供迁移建议。 +5. **数据库兼容**:修改涉及数据库 Schema 时,必须提供迁移 SQL 或迁移策略说明。 +6. **状态机变更**:修改涉及状态机时,必须更新状态转移图并检查新旧状态的兼容性。 + +### 输出末尾追加 + +在所有章节变更输出完毕后,请追加以下版本信息: + +```markdown +--- + +## 版本号建议 + +- **当前版本**:<从 DDS 文档头提取的当前版本号> +- **建议新版本**:<根据变更范围建议的新版本号> + - 若仅修改细节/修复:patch +1(如 v1.0.0 → v1.0.1) + - 若新增功能模块:minor +1(如 v1.0.0 → v1.1.0) + - 若架构级重构或破坏性变更:major +1(如 v1.0.0 → v2.0.0) +- **版本号变更理由**:<一句话说明> +``` + +### 输出格式总结 + +你的完整输出结构应为: + +1. 所有 `[NEW]` 章节(如有) +2. 所有 `[MODIFIED]` 章节(如有) +3. 所有 `[DEPRECATED]` 章节(如有) +4. 版本号建议 + +如果 Change Intent 中没有任何实质性变更(例如仅文案修正),请输出: + +``` +无需更新 DDS。Change Intent 中的变更不影响系统设计层面。 +``` +``` diff --git a/1-AgentSkills/doc-sync-skill/references/SKILL_UPDATE_PROMPT.md b/1-AgentSkills/doc-sync-skill/references/SKILL_UPDATE_PROMPT.md new file mode 100644 index 0000000..f2476fa --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/references/SKILL_UPDATE_PROMPT.md @@ -0,0 +1,83 @@ +# AgentSkill 增量更新 Prompt + +> 本文档是一份完整的 Prompt 模板,用于驱动大模型对单个 AgentSkill 的 SKILL.md 进行增量更新。 +> 使用时将 `{{DDS_DIFF}}`、`{{SKILL_NAME}}` 和 `{{CURRENT_SKILL_MD}}` 替换为实际内容后,整体发送给大模型。 + +--- + +## Prompt 正文 + +``` +你是一名 AgentSkill 维护专家,精通 Anthropic Agent Skill 规范。你当前的任务是根据 DDS 的增量变更内容,对指定的 AgentSkill SKILL.md 文件进行精确的增量更新。 + +## 你的角色与职责 + +- 你是一名严谨的 Skill 维护者,只修改受 DDS 变更影响的部分 +- 你必须保持 SKILL.md 格式规范的完整性 +- 你绝不会修改未受影响的章节内容 +- 你会确保每次更新后 SKILL.md 仍然是一份完整可用的文档 + +## 输入 + +### DDS 变更内容(Diff) + +以下是与该 Skill 相关的 DDS 变更片段,使用 [NEW]/[MODIFIED]/[DEPRECATED] 标注: + +{{DDS_DIFF}} + +### 当前 Skill 信息 + +- **Skill 名称**:{{SKILL_NAME}} + +### 当前 SKILL.md 全文 + +{{CURRENT_SKILL_MD}} + +## 输出要求 + +### 更新规则 + +1. **只更新受影响部分**:根据 DDS 变更内容,判断 SKILL.md 中哪些章节需要更新,只修改这些章节。 +2. **version 字段递增**:在 YAML frontmatter 中,将 version 的 patch 版本号 +1(例如 `1.0.0` → `1.0.1`,`1.2.3` → `1.2.4`)。 +3. **保持 name 不变**:YAML frontmatter 中的 name 字段绝对不能修改。 +4. **description 保持单行**:更新 description 时必须保持单行格式,且长度 < 1024 字符。 +5. **格式一致性**:更新后的内容必须与现有 SKILL.md 的格式风格保持一致。 + +### 变更类型与处理 + +根据 DDS 变更的标注类型,采取以下处理策略: + +| DDS 变更标注 | SKILL.md 处理策略 | +|-------------|-----------------| +| `[NEW]` 新增章节 | 在 SKILL.md 的 Execute/Verify/Plan 中添加相关步骤或检查项 | +| `[MODIFIED]` 修改章节 | 更新 SKILL.md 中对应的步骤描述、checklist 或 reference 引用 | +| `[DEPRECATED]` 废弃章节 | 从 SKILL.md 中移除或标注废弃相关步骤,更新 Pitfalls 提醒 | + +### 输出格式 + +请直接输出**完整的、更新后的 SKILL.md 文件内容**,从 YAML frontmatter 的 `---` 开始,到文件末尾结束。 + +输出的 SKILL.md 必须满足以下格式检查: + +- [ ] YAML frontmatter 格式正确(以 `---` 开头和结尾) +- [ ] name 字段只含小写字母、数字和连字符,≤ 64 字符 +- [ ] description 为单行,< 1024 字符 +- [ ] version 字段已递增 patch 版本 +- [ ] 包含必要的标准章节(Plan / Verify / Execute / Pitfalls 等,如原文有) +- [ ] 文件总行数 < 500 行 + +### 严格约束 + +1. **禁止创造性发挥**:只基于提供的 DDS 变更内容进行更新,不要添加 DDS 中没有的内容。 +2. **禁止删除无关内容**:不受 DDS 变更影响的章节必须原封不动保留。 +3. **禁止修改 name**:SKILL 的 name 字段是标识符,绝对不能修改。 +4. **reference 更新**:如果 SKILL.md 引用了 reference/ 中的文件,且这些文件内容因 DDS 变更而需要更新,在 SKILL.md 中标注 ``。 + +### 无需更新的情况 + +如果 DDS 变更内容与该 Skill 完全无关(例如变更的是其他模块的内容),请输出: + +``` +该 Skill ({{SKILL_NAME}}) 不受本次 DDS 变更影响,无需更新。 +``` +``` diff --git a/1-AgentSkills/doc-sync-skill/scripts/diff_prd.py b/1-AgentSkills/doc-sync-skill/scripts/diff_prd.py new file mode 100644 index 0000000..5b9d8a1 --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/scripts/diff_prd.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +diff_prd.py - PRD 文档章节级差异对比工具 + +按章节(## 标题)级别对比两个 Markdown 格式的 PRD 文档, +输出结构化 JSON 包含新增、修改和删除的章节信息。 + +Usage: + python diff_prd.py --old --new + +Output: + JSON 格式的差异报告,写入 stdout +""" + +import argparse +import json +import re +import sys +import os +from typing import Dict, List, Tuple +from difflib import unified_diff + + +def parse_sections(content: str) -> Dict[str, str]: + """ + 将 Markdown 文档按 ## 标题级别拆分为章节字典。 + + Args: + content: Markdown 文档全文 + + Returns: + 有序字典,key 为章节标题(去除 ## 前缀),value 为章节内容 + """ + sections: Dict[str, str] = {} + current_title = "__HEADER__" # 文档头部(## 之前的内容) + current_lines: List[str] = [] + + for line in content.splitlines(): + # 匹配 ## 级别标题(不匹配 # 和 ### 及以下) + match = re.match(r'^##\s+(.+)$', line) + if match: + # 保存上一个章节 + section_content = '\n'.join(current_lines).strip() + if section_content or current_title != "__HEADER__": + sections[current_title] = section_content + + current_title = match.group(1).strip() + current_lines = [] + else: + current_lines.append(line) + + # 保存最后一个章节 + section_content = '\n'.join(current_lines).strip() + if section_content or current_title != "__HEADER__": + sections[current_title] = section_content + + return sections + + +def compute_diff(old_text: str, new_text: str) -> str: + """ + 计算两段文本的 unified diff。 + + Args: + old_text: 旧版文本 + new_text: 新版文本 + + Returns: + unified diff 字符串 + """ + old_lines = old_text.splitlines(keepends=True) + new_lines = new_text.splitlines(keepends=True) + + diff = unified_diff( + old_lines, + new_lines, + fromfile='old', + tofile='new', + lineterm='' + ) + return ''.join(diff) + + +def compare_sections( + old_sections: Dict[str, str], + new_sections: Dict[str, str] +) -> Tuple[List[str], List[Dict[str, str]], List[str]]: + """ + 对比两个版本的章节字典,找出新增、修改和删除的章节。 + + Args: + old_sections: 旧版章节字典 + new_sections: 新版章节字典 + + Returns: + (added, modified, removed) 三元组 + """ + old_titles = set(old_sections.keys()) + new_titles = set(new_sections.keys()) + + # 新增章节:在新版中存在,旧版中不存在 + added = sorted(list(new_titles - old_titles)) + + # 删除章节:在旧版中存在,新版中不存在 + removed = sorted(list(old_titles - new_titles)) + + # 修改章节:两版都存在但内容不同 + common_titles = old_titles & new_titles + modified = [] + for title in sorted(common_titles): + old_content = old_sections[title] + new_content = new_sections[title] + if old_content != new_content: + modified.append({ + "title": title, + "old": old_content, + "new": new_content, + "diff": compute_diff(old_content, new_content) + }) + + return added, modified, removed + + +def generate_summary( + added: List[str], + modified: List[Dict[str, str]], + removed: List[str] +) -> str: + """ + 生成变更摘要。 + + Args: + added: 新增章节标题列表 + modified: 修改章节详情列表 + removed: 删除章节标题列表 + + Returns: + 变更摘要字符串 + """ + parts = [] + + total_changes = len(added) + len(modified) + len(removed) + if total_changes == 0: + return "无变更:两个版本的 PRD 内容完全一致。" + + parts.append(f"共检测到 {total_changes} 处章节级变更。") + + if added: + parts.append(f"新增 {len(added)} 个章节:{', '.join(added)}。") + + if modified: + mod_titles = [m['title'] for m in modified] + parts.append(f"修改 {len(modified)} 个章节:{', '.join(mod_titles)}。") + + if removed: + parts.append(f"删除 {len(removed)} 个章节:{', '.join(removed)}。") + + return ' '.join(parts) + + +def read_file(filepath: str) -> str: + """ + 读取文件内容,支持 UTF-8 编码。 + + Args: + filepath: 文件路径 + + Returns: + 文件内容字符串 + + Raises: + FileNotFoundError: 文件不存在 + UnicodeDecodeError: 编码错误 + """ + abs_path = os.path.abspath(filepath) + if not os.path.exists(abs_path): + raise FileNotFoundError(f"文件不存在: {abs_path}") + + if not os.path.isfile(abs_path): + raise ValueError(f"路径不是文件: {abs_path}") + + # 尝试多种编码 + encodings = ['utf-8', 'utf-8-sig', 'gbk', 'gb2312', 'latin-1'] + for encoding in encodings: + try: + with open(abs_path, 'r', encoding=encoding) as f: + return f.read() + except UnicodeDecodeError: + continue + + raise UnicodeDecodeError( + 'utf-8', b'', 0, 1, + f"无法以任何支持的编码读取文件: {abs_path}" + ) + + +def main(): + parser = argparse.ArgumentParser( + description='PRD 文档章节级差异对比工具', + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=""" +示例: + python diff_prd.py --old prd_v1.md --new prd_v2.md + python diff_prd.py --old prd_v1.md --new prd_v2.md 2>/dev/null + +输出格式: + JSON 对象,包含以下字段: + - added_sections: 新增章节标题列表 + - modified_sections: 修改章节详情列表 + - removed_sections: 删除章节标题列表 + - summary: 变更摘要 + """ + ) + + parser.add_argument( + '--old', + required=True, + help='旧版 PRD 文件路径(Markdown 格式)' + ) + parser.add_argument( + '--new', + required=True, + help='新版 PRD 文件路径(Markdown 格式)' + ) + parser.add_argument( + '--output', + default=None, + help='输出文件路径(默认输出到 stdout)' + ) + + args = parser.parse_args() + + try: + # 读取文件 + old_content = read_file(args.old) + new_content = read_file(args.new) + + # 解析章节 + old_sections = parse_sections(old_content) + new_sections = parse_sections(new_content) + + # 对比差异 + added, modified, removed = compare_sections(old_sections, new_sections) + + # 生成摘要 + summary = generate_summary(added, modified, removed) + + # 构建结果(修改章节中去除 diff 字段的冗余信息,只保留标题和新旧内容) + modified_output = [] + for m in modified: + modified_output.append({ + "title": m["title"], + "old": m["old"], + "new": m["new"] + }) + + result = { + "added_sections": added, + "modified_sections": modified_output, + "removed_sections": removed, + "summary": summary + } + + # 输出结果 + output_json = json.dumps(result, ensure_ascii=False, indent=2) + + if args.output: + output_path = os.path.abspath(args.output) + os.makedirs(os.path.dirname(output_path), exist_ok=True) + with open(output_path, 'w', encoding='utf-8') as f: + f.write(output_json) + print(f"差异报告已写入: {output_path}", file=sys.stderr) + else: + print(output_json) + + except FileNotFoundError as e: + print(json.dumps({ + "error": str(e), + "type": "FileNotFoundError" + }, ensure_ascii=False), file=sys.stderr) + sys.exit(1) + + except UnicodeDecodeError as e: + print(json.dumps({ + "error": f"文件编码错误: {str(e)}", + "type": "UnicodeDecodeError" + }, ensure_ascii=False), file=sys.stderr) + sys.exit(1) + + except Exception as e: + print(json.dumps({ + "error": f"未预期的错误: {str(e)}", + "type": type(e).__name__ + }, ensure_ascii=False), file=sys.stderr) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/1-AgentSkills/doc-sync-skill/scripts/sync_check.py b/1-AgentSkills/doc-sync-skill/scripts/sync_check.py new file mode 100644 index 0000000..9c63cc6 --- /dev/null +++ b/1-AgentSkills/doc-sync-skill/scripts/sync_check.py @@ -0,0 +1,454 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +sync_check.py - DDS 与 AgentSkill 一致性检查工具 + +扫描 DDS 文档中定义的所有接口/模块名称,检查在 Skills 目录下是否存在对应的 SKILL.md。 +输出不一致报告: +- DDS 中定义但没有对应 Skill 的模块 +- Skills 目录中存在但无对应 DDS 章节的 Skill + +Usage: + python sync_check.py --dds --skills-dir + +Output: + JSON 格式的一致性报告,写入 stdout +""" + +import argparse +import json +import os +import re +import sys +from typing import Dict, List, Set, Tuple + + +def read_file(filepath: str) -> str: + """ + 读取文件内容,支持 UTF-8 编码。 + + Args: + filepath: 文件路径 + + Returns: + 文件内容字符串 + + Raises: + FileNotFoundError: 文件不存在 + """ + abs_path = os.path.abspath(filepath) + if not os.path.exists(abs_path): + raise FileNotFoundError(f"文件不存在: {abs_path}") + + if not os.path.isfile(abs_path): + raise ValueError(f"路径不是文件: {abs_path}") + + encodings = ['utf-8', 'utf-8-sig', 'gbk', 'gb2312', 'latin-1'] + for encoding in encodings: + try: + with open(abs_path, 'r', encoding=encoding) as f: + return f.read() + except UnicodeDecodeError: + continue + + raise UnicodeDecodeError( + 'utf-8', b'', 0, 1, + f"无法以任何支持的编码读取文件: {abs_path}" + ) + + +def extract_dds_modules(content: str) -> List[Dict[str, str]]: + """ + 从 DDS 文档中提取模块/接口名称。 + + 提取策略(按优先级): + 1. 匹配 ## 级别标题中包含"模块"、"接口"、"服务"等关键词的章节 + 2. 匹配代码块中的模块/包/服务定义 + 3. 匹配表格中定义的模块列表 + + Args: + content: DDS 文档全文 + + Returns: + 模块信息列表,每项包含 name 和 source(来源标记) + """ + modules: List[Dict[str, str]] = [] + seen_names: Set[str] = set() + + # 策略 1:从 ## 标题提取模块名 + # 匹配模式:## xxx模块 / ## xxx服务 / ## xxx接口 / ## xxx-xxx + section_pattern = re.compile( + r'^##\s+(?:\d+[\.\s]*)?' # ## 和可选的编号 + r'(.+?)' # 标题内容 + r'\s*$', + re.MULTILINE + ) + + for match in section_pattern.finditer(content): + title = match.group(1).strip() + + # 尝试从标题中提取模块名 + # 模式:xxx模块、xxx服务、xxx接口、xxx组件 + module_match = re.match( + r'(.+?)\s*(?:模块|服务|接口|组件|子系统|处理器|引擎|管理器)', + title + ) + if module_match: + name = module_match.group(1).strip() + normalized = normalize_module_name(name) + if normalized and normalized not in seen_names: + seen_names.add(normalized) + modules.append({ + "name": normalized, + "display_name": name, + "source": f"章节标题: {title}" + }) + + # 策略 2:从表格中提取模块名 + # 匹配 | 模块名 | 或 | 名称 | 格式的表格行 + table_pattern = re.compile( + r'^\|\s*(.+?)\s*\|.*(?:模块|服务|接口|职责|说明)', + re.MULTILINE + ) + + # 查找表格头行之后的数据行 + lines = content.splitlines() + in_module_table = False + for i, line in enumerate(lines): + # 检测表格头 + if re.match(r'^\|.*(?:模块|名称|组件|服务).*\|', line): + in_module_table = True + continue + + # 跳过分隔行 + if in_module_table and re.match(r'^\|[\s\-:]+\|', line): + continue + + # 提取表格数据行 + if in_module_table and line.startswith('|'): + cells = [c.strip() for c in line.split('|') if c.strip()] + if cells: + name = cells[0].strip('`').strip() + normalized = normalize_module_name(name) + if normalized and normalized not in seen_names: + seen_names.add(normalized) + modules.append({ + "name": normalized, + "display_name": name, + "source": f"表格第 {i + 1} 行" + }) + elif in_module_table and not line.startswith('|'): + in_module_table = False + + # 策略 3:从代码块中提取 package/module 定义 + code_pattern = re.compile( + r'(?:package|module|service)\s+(\w[\w\-]*)', + re.MULTILINE + ) + for match in code_pattern.finditer(content): + name = match.group(1).strip() + normalized = normalize_module_name(name) + if normalized and normalized not in seen_names and len(normalized) > 2: + seen_names.add(normalized) + modules.append({ + "name": normalized, + "display_name": name, + "source": "代码块定义" + }) + + return modules + + +def normalize_module_name(name: str) -> str: + """ + 标准化模块名称为 Skill 命名格式(小写、连字符分隔)。 + + Args: + name: 原始模块名称 + + Returns: + 标准化后的名称 + """ + if not name: + return "" + + # 移除中文括号和英文括号中的内容 + name = re.sub(r'[((].+?[))]', '', name) + + # 转小写 + name = name.lower().strip() + + # 中文转拼音或直接使用(这里简单处理,保留英文部分) + # 如果全是中文,暂时保留原名 + has_english = bool(re.search(r'[a-z]', name)) + + if has_english: + # 提取英文部分 + english_parts = re.findall(r'[a-z][a-z0-9]*', name) + name = '-'.join(english_parts) + else: + # 纯中文名称,保留原文 + name = name.replace(' ', '-') + + # 清理连续的连字符 + name = re.sub(r'-+', '-', name).strip('-') + + return name + + +def scan_skills_directory(skills_dir: str) -> List[Dict[str, str]]: + """ + 扫描 Skills 目录,获取所有现有 Skill 信息。 + + Args: + skills_dir: Skills 目录路径 + + Returns: + Skill 信息列表,每项包含 name、path 和 has_skill_md + """ + abs_dir = os.path.abspath(skills_dir) + if not os.path.exists(abs_dir): + raise FileNotFoundError(f"Skills 目录不存在: {abs_dir}") + + if not os.path.isdir(abs_dir): + raise ValueError(f"路径不是目录: {abs_dir}") + + skills: List[Dict[str, str]] = [] + + for entry in sorted(os.listdir(abs_dir)): + entry_path = os.path.join(abs_dir, entry) + if not os.path.isdir(entry_path): + continue + + skill_md_path = os.path.join(entry_path, 'SKILL.md') + has_skill_md = os.path.isfile(skill_md_path) + + skill_info: Dict[str, str] = { + "name": entry, + "path": entry_path, + "has_skill_md": has_skill_md + } + + # 如果有 SKILL.md,尝试提取 frontmatter 中的 name + if has_skill_md: + try: + skill_content = read_file(skill_md_path) + fm_match = re.search( + r'^---\s*\n(.*?)\n---', + skill_content, + re.DOTALL + ) + if fm_match: + fm_content = fm_match.group(1) + name_match = re.search(r'^name:\s*(.+)$', fm_content, re.MULTILINE) + if name_match: + skill_info["frontmatter_name"] = name_match.group(1).strip() + + version_match = re.search(r'^version:\s*(.+)$', fm_content, re.MULTILINE) + if version_match: + skill_info["version"] = version_match.group(1).strip() + except Exception: + pass + + skills.append(skill_info) + + return skills + + +def check_consistency( + dds_modules: List[Dict[str, str]], + skills: List[Dict[str, str]] +) -> Dict: + """ + 检查 DDS 模块与 Skills 的一致性。 + + Args: + dds_modules: DDS 中提取的模块列表 + skills: Skills 目录中扫描到的 Skill 列表 + + Returns: + 一致性报告字典 + """ + dds_names = {m["name"] for m in dds_modules} + skill_names = {s["name"] for s in skills} + + # 也收集 frontmatter 中的 name + skill_fm_names = { + s.get("frontmatter_name", s["name"]) + for s in skills + } + + # DDS 中有但 Skills 中没有的模块 + missing_skills: List[Dict[str, str]] = [] + for module in dds_modules: + name = module["name"] + # 检查是否有匹配的 Skill(目录名或 frontmatter name 匹配) + # 常见 Skill 命名模式:developing- + possible_skill_names = { + name, + f"developing-{name}", + f"implementing-{name}", + f"managing-{name}" + } + + if not (possible_skill_names & skill_names) and \ + not (possible_skill_names & skill_fm_names): + missing_skills.append({ + "module_name": module["name"], + "display_name": module["display_name"], + "source": module["source"], + "suggested_skill_name": f"developing-{name}" + }) + + # Skills 中有但 DDS 中没有的 Skill + orphan_skills: List[Dict[str, str]] = [] + for skill in skills: + skill_name = skill["name"] + # 从 Skill 名称中提取模块名(去除 developing-/implementing-/managing- 前缀) + module_name = re.sub( + r'^(?:developing|implementing|managing|designing)-', + '', + skill_name + ) + + if module_name not in dds_names and skill_name not in dds_names: + orphan_skills.append({ + "skill_name": skill_name, + "skill_path": skill["path"], + "has_skill_md": skill["has_skill_md"], + "expected_dds_module": module_name + }) + + # 匹配成功的映射 + matched: List[Dict[str, str]] = [] + for module in dds_modules: + name = module["name"] + possible_skill_names = { + name, + f"developing-{name}", + f"implementing-{name}", + f"managing-{name}" + } + + for skill in skills: + if skill["name"] in possible_skill_names or \ + skill.get("frontmatter_name", "") in possible_skill_names: + matched.append({ + "dds_module": module["name"], + "skill_name": skill["name"], + "has_skill_md": skill["has_skill_md"] + }) + break + + return { + "summary": { + "total_dds_modules": len(dds_modules), + "total_skills": len(skills), + "matched": len(matched), + "missing_skills": len(missing_skills), + "orphan_skills": len(orphan_skills) + }, + "missing_skills": missing_skills, + "orphan_skills": orphan_skills, + "matched": matched + } + + +def main(): + parser = argparse.ArgumentParser( + description='DDS 与 AgentSkill 一致性检查工具', + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=""" +示例: + python sync_check.py --dds design.md --skills-dir ./skills + python sync_check.py --dds dds_v2.md --skills-dir ../1-AgentSkills + +输出格式: + JSON 对象,包含以下字段: + - summary: 统计摘要 + - missing_skills: DDS 中有但无对应 Skill 的模块列表 + - orphan_skills: 有 Skill 但无对应 DDS 章节的列表 + - matched: 已匹配的 DDS-Skill 映射列表 + """ + ) + + parser.add_argument( + '--dds', + required=True, + help='DDS 文件路径(Markdown 格式)' + ) + parser.add_argument( + '--skills-dir', + required=True, + help='AgentSkills 目录路径' + ) + parser.add_argument( + '--output', + default=None, + help='输出文件路径(默认输出到 stdout)' + ) + + args = parser.parse_args() + + try: + # 读取 DDS 并提取模块 + dds_content = read_file(args.dds) + dds_modules = extract_dds_modules(dds_content) + + if not dds_modules: + print( + "⚠️ 警告:未能从 DDS 文档中提取到任何模块定义。" + "请检查 DDS 文档是否使用了 ## 标题格式定义模块。", + file=sys.stderr + ) + + # 扫描 Skills 目录 + skills = scan_skills_directory(args.skills_dir) + + # 检查一致性 + report = check_consistency(dds_modules, skills) + + # 添加元信息 + report["meta"] = { + "dds_path": os.path.abspath(args.dds), + "skills_dir": os.path.abspath(args.skills_dir), + "dds_modules_extracted": [ + {"name": m["name"], "display_name": m["display_name"]} + for m in dds_modules + ] + } + + # 输出结果 + output_json = json.dumps(report, ensure_ascii=False, indent=2) + + if args.output: + output_path = os.path.abspath(args.output) + os.makedirs(os.path.dirname(output_path), exist_ok=True) + with open(output_path, 'w', encoding='utf-8') as f: + f.write(output_json) + print(f"一致性报告已写入: {output_path}", file=sys.stderr) + else: + print(output_json) + + # 如果有不一致项,返回非零退出码 + if report["summary"]["missing_skills"] > 0 or \ + report["summary"]["orphan_skills"] > 0: + sys.exit(2) # Exit code 2 表示有不一致但非致命错误 + + except FileNotFoundError as e: + print(json.dumps({ + "error": str(e), + "type": "FileNotFoundError" + }, ensure_ascii=False), file=sys.stderr) + sys.exit(1) + + except Exception as e: + print(json.dumps({ + "error": f"未预期的错误: {str(e)}", + "type": type(e).__name__ + }, ensure_ascii=False), file=sys.stderr) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/16-ProjectMoneyM-转FireFlyIII/1-原始需求/0-产品经理-prompt.md b/16-ProjectMoneyM-废弃/1-原始需求/0-产品经理-prompt.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/1-原始需求/0-产品经理-prompt.md rename to 16-ProjectMoneyM-废弃/1-原始需求/0-产品经理-prompt.md diff --git a/16-ProjectMoneyM-转FireFlyIII/1-原始需求/1-初始需求稿.md b/16-ProjectMoneyM-废弃/1-原始需求/1-初始需求稿.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/1-原始需求/1-初始需求稿.md rename to 16-ProjectMoneyM-废弃/1-原始需求/1-初始需求稿.md diff --git a/16-ProjectMoneyM-转FireFlyIII/1-原始需求/2-1-优化产品需求文档PRD.md b/16-ProjectMoneyM-废弃/1-原始需求/2-1-优化产品需求文档PRD.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/1-原始需求/2-1-优化产品需求文档PRD.md rename to 16-ProjectMoneyM-废弃/1-原始需求/2-1-优化产品需求文档PRD.md diff --git a/16-ProjectMoneyM-转FireFlyIII/1-原始需求/2-优化产品需求文档PRD.md b/16-ProjectMoneyM-废弃/1-原始需求/2-优化产品需求文档PRD.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/1-原始需求/2-优化产品需求文档PRD.md rename to 16-ProjectMoneyM-废弃/1-原始需求/2-优化产品需求文档PRD.md diff --git a/16-ProjectMoneyM-转FireFlyIII/2-概要详细设计/0-概要设计prompt.md b/16-ProjectMoneyM-废弃/2-概要详细设计/0-概要设计prompt.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/2-概要详细设计/0-概要设计prompt.md rename to 16-ProjectMoneyM-废弃/2-概要详细设计/0-概要设计prompt.md diff --git a/16-ProjectMoneyM-转FireFlyIII/2-概要详细设计/3-详细设计说明书.md b/16-ProjectMoneyM-废弃/2-概要详细设计/3-详细设计说明书.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/2-概要详细设计/3-详细设计说明书.md rename to 16-ProjectMoneyM-废弃/2-概要详细设计/3-详细设计说明书.md diff --git a/16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/1-ProjectMoneyM-PRD.md b/16-ProjectMoneyM-废弃/3-实现详细稿/1-ProjectMoneyM-PRD.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/1-ProjectMoneyM-PRD.md rename to 16-ProjectMoneyM-废弃/3-实现详细稿/1-ProjectMoneyM-PRD.md diff --git a/16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/2-ProjectMoneyM-DDS.md b/16-ProjectMoneyM-废弃/3-实现详细稿/2-ProjectMoneyM-DDS.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/2-ProjectMoneyM-DDS.md rename to 16-ProjectMoneyM-废弃/3-实现详细稿/2-ProjectMoneyM-DDS.md diff --git a/16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/3-DataGrip-DDS.md b/16-ProjectMoneyM-废弃/3-实现详细稿/3-DataGrip-DDS.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/3-DataGrip-DDS.md rename to 16-ProjectMoneyM-废弃/3-实现详细稿/3-DataGrip-DDS.md diff --git a/16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/4-DDS-to-Stitch-Prompt-Guide.md b/16-ProjectMoneyM-废弃/3-实现详细稿/4-DDS-to-Stitch-Prompt-Guide.md similarity index 100% rename from 16-ProjectMoneyM-转FireFlyIII/3-实现详细稿/4-DDS-to-Stitch-Prompt-Guide.md rename to 16-ProjectMoneyM-废弃/3-实现详细稿/4-DDS-to-Stitch-Prompt-Guide.md diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/docs/AirScript-文档.md b/18-基础架构及交付部署特战队/1-项目部署-管理/docs/AirScript-文档-备份.md similarity index 100% rename from 18-基础架构及交付部署特战队/1-项目部署-管理/docs/AirScript-文档.md rename to 18-基础架构及交付部署特战队/1-项目部署-管理/docs/AirScript-文档-备份.md diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-official-doc.md b/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-official-doc.md new file mode 100644 index 0000000..878f9a9 --- /dev/null +++ b/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-official-doc.md @@ -0,0 +1,30670 @@ +# AirScript + 多维表 API 离线规格文档(主源:365.kdocs.cn) + +> 生成时间: 2026-03-19 09:18:58 +> +> 主入口: [WPS多维表格开发能力体系](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/dbsheet-standard) +> +> 抓取策略: 365 开放平台内部接口全量拉取 `dbsheet-standard` + `AirScript/*` + `Api/*` + +## 抓取统计 + +- 页面总数: **578** +- AirScript 页面: **12** +- Api 页面: **565** + +## 页面索引 + +1. **开发指南 / WPS多维表格开发 / WPS多维表格开发能力体系** + - 路径: `/app-integration-dev/guide/dbsheet/dbsheet-standard` + - 文档ID: `app-integration-dev_guide_dbsheet_dbsheet-standard` +2. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 内置基础类型** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-build-in` +3. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本经典案例** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-demo` +4. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 简介** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-instro` +5. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 快速入门** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-quickstart` +6. **开发指南 / WPS多维表格开发 / API文档 / 简介** + - 路径: `/app-integration-dev/guide/dbsheet/Api/api-instro` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_api-instro` +7. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 云文档 API** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-KSDrive` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-advanced-KSDrive` +8. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 邮件 API** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-SMTP` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-advanced-SMTP` +9. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 网络 API** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-http` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-advanced-http` +10. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 简介** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-instro` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-advanced-instro` +11. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 数据库 API** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-sql` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-advanced-sql` +12. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 接口说明** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-api` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-apitoken-api` +13. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 应用场景** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-demo` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-apitoken-demo` +14. **开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 简介** + - 路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-instro` + - 文档ID: `app-integration-dev_guide_dbsheet_AirScript_AirScript-apitoken-instro` +15. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 创建合并表** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_CreateSummarySheet` +16. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 创建同步表** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_CreateSyncDBSheets` +17. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置默认值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_DefaultVal` +18. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 删除字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Delete` +19. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 禁止录入重复值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_IsValueUnique` +20. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置字段名** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Name` +21. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听删除字段的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_OnDelete` +22. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听修改字段的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_OnUpdate` +23. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置字段类型** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Type` +24. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 新增字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_AddField` +25. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听增加字段的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_OnCreate` +26. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 复制字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Copy` +27. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 移动字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Move` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Move` +28. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 隐藏/显示字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Visible` +29. **开发指南 / WPS多维表格开发 / API文档 / 筛选 / 设置筛选条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Criteria` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_Criteria` +30. **开发指南 / WPS多维表格开发 / API文档 / 筛选 / 删除筛选条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_Delete` +31. **开发指南 / WPS多维表格开发 / API文档 / 筛选 / 添加筛选条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Add` +32. **开发指南 / WPS多维表格开发 / API文档 / 分组 / 删除分组** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group_Delete` +33. **开发指南 / WPS多维表格开发 / API文档 / 分组 / 添加分组** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_Add` +34. **开发指南 / WPS多维表格开发 / API文档 / 分组 / 分组折叠** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_FoldAll` +35. **开发指南 / WPS多维表格开发 / API文档 / 分组 / 展开分组** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_UnFoldAll` +36. **开发指南 / WPS多维表格开发 / API文档 / 其他 / 设置导航栏可见性** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Navigator_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Navigator_Visible` +37. **开发指南 / WPS多维表格开发 / API文档 / 公告 / 公告-展开/收起** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NoticeBar_Visible` +38. **开发指南 / WPS多维表格开发 / API文档 / 评论 / 插入** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Add` +39. **开发指南 / WPS多维表格开发 / API文档 / 评论 / 删除** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Delete` +40. **开发指南 / WPS多维表格开发 / API文档 / 评论 / 监听插入评论** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_OnCreate` +41. **开发指南 / WPS多维表格开发 / API文档 / 评论 / 监听删除评论** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_OnDelete` +42. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 插入记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Add` +43. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 筛选记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Condition` +44. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格的字体颜色** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Font` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Font` +45. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格的填充颜色** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Interior` +46. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 监听删除记录的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_OnDeleteRecord` +47. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 监听修改记录的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_OnUpdate` +48. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格内容** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Value` +49. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 选中记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Select` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Select` +50. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 删除记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Delete` +51. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 查看记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Item` +52. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 添加说明** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_AddDescription` +53. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 创建副本** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Copy` +54. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 设置图标** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Icon` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Icon` +55. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 重命名** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Name` +56. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听删除数据表的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_OnDelete` +57. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听重命名数据表的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_OnRename` +58. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 新建数据表** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Add` +59. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 删除数据表** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Delete` +60. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 移动数据表** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Move` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Move` +61. **开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听增加数据表的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_OnCreateSheet` +62. **开发指南 / WPS多维表格开发 / API文档 / 排序 / 设置排序升序属性** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sort_IsAscending` +63. **开发指南 / WPS多维表格开发 / API文档 / 排序 / 添加排序条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_Add` +64. **开发指南 / WPS多维表格开发 / API文档 / 排序 / 移动排序条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_ChangeOrder` +65. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 合并表-添加数据源** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Add` +66. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 合并表-删除数据源** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Delete` +67. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 刷新数据** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SyncDBSheet_RefreshSyncSheet` +68. **开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 解除同步关系** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SyncDBSheet_RemoveSheetSyncLink` +69. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 复制视图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Copy` +70. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 删除视图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Delete` +71. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 设置快速访问视图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_IsFavView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_IsFavView` +72. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 设置个人/公共视图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_IsPersonal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_IsPersonal` +73. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 重命名** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Name` +74. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听删除视图的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_OnDelete` +75. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听重命名视图的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_OnRename` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_OnRename` +76. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 新建视图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_Add` +77. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听增加视图的事件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_OnCreate` +78. **开发指南 / WPS多维表格开发 / API文档 / 其他 / 代理界面元素** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_BailHook` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_BailHook` +79. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 展开记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_DisplayRecord` +80. **开发指南 / WPS多维表格开发 / API文档 / 记录 / 关闭记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_HiddenAllRecord` +81. **开发指南 / WPS多维表格开发 / API文档 / 其他 / 窗口导航栏** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_Navigator` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_Navigator` +82. **开发指南 / WPS多维表格开发 / API文档 / 公告 / 窗口公告栏** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_NoticeBar` +83. **开发指南 / WPS多维表格开发 / API文档 / 其他 / 设置经典布局** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_SetLayout` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_SetLayout` +84. **开发指南 / WPS多维表格开发 / API文档 / API / AddressField / AddressField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField` +85. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 填写详细地址** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_IsDetailedAddress` +86. **开发指南 / WPS多维表格开发 / API文档 / API / AddressField / IsDetailedAddress** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_IsDetailedAddress` +87. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 预设指定地址** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_IsUsePresetAddress` +88. **开发指南 / WPS多维表格开发 / API文档 / API / AddressField / IsUsePresetAddress** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_IsUsePresetAddress` +89. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 地址级别数** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_Level` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_Level` +90. **开发指南 / WPS多维表格开发 / API文档 / API / AddressField / Level** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_Level` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_Level` +91. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 默认值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_PresetAddress` +92. **开发指南 / WPS多维表格开发 / API文档 / API / AddressField / PresetAddress** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_PresetAddress` +93. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_getValue` +94. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AddressField_setValue` +95. **开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / ApiResult对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ApiResult` +96. **开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / Code** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult_Code` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ApiResult_Code` +97. **开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / Message** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult_Message` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ApiResult_Message` +98. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / Attachment对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment` +99. **开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / AttachmentField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField` +100. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 设置显示样式** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_DisplayStyle` +101. **开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / DisplayStyle** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_DisplayStyle` +102. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 仅可通过移动端拍摄上传** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_IsOnlyCameraUpload` +103. **开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / IsOnlyCameraUpload** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_IsOnlyCameraUpload` +104. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_getValue` +105. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AttachmentField_setValue` +106. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_FileId` +107. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileName** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileName` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_FileName` +108. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileSize** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileSize` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_FileSize` +109. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_FileType` +110. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / ImgSize** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_ImgSize` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_ImgSize` +111. **开发指南 / WPS多维表格开发 / API文档 / API / Attachment / LinkUrl** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_LinkUrl` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Attachment_LinkUrl` +112. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / AutoLinkCondition对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition` +113. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / DateIntersectedValues** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_DateIntersectedValues` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_DateIntersectedValues` +114. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / IntersectedConds** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_IntersectedConds` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_IntersectedConds` +115. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / LinkSheetFieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_LinkSheetFieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_LinkSheetFieldId` +116. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / OpType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_OpType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_OpType` +117. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / SheetCondContents** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondContents` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_SheetCondContents` +118. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / SheetCondType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkCondition_SheetCondType` +119. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / AutoLinkConditions对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkConditions` +120. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkConditions_Add` +121. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkConditions_Count` +122. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkConditions_Delete` +123. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkConditions_Item` +124. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroup / AutoLinkGroup对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroup` +125. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroup / Conditions** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup_Conditions` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroup_Conditions` +126. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / AutoLinkGroups对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroups` +127. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroups_Add` +128. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroups_Count` +129. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroups_Delete` +130. **开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutoLinkGroups_Item` +131. **开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / AutomationField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField` +132. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 通知联系人** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_ContactField` +133. **开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / ContactField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_ContactField` +134. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 触发时间** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_ExecuteTime` +135. **开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / ExecuteTime** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_ExecuteTime` +136. **开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / TriggerField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_TriggerField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_TriggerField` +137. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 类型** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_Type` +138. **开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_AutomationField_Type` +139. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / ButtonField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField` +140. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / BackgroundColor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_BackgroundColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField_BackgroundColor` +141. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / Icon** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_Icon` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField_Icon` +142. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / SuccessText** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_SuccessText` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField_SuccessText` +143. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / Text** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_Text` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField_Text` +144. **开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / TextColor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_TextColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ButtonField_TextColor` +145. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / CalendarView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView` +146. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 开始日期字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_BeginField` +147. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / BeginField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_BeginField` +148. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 结束日期字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_EndField` +149. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / EndField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_EndField` +150. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 时间线颜色** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TimelineColor` +151. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TimelineColor` +152. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColorFollowField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorFollowField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TimelineColorFollowField` +153. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColorType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TimelineColorType` +154. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 标题设置** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TitleField` +155. **开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TitleField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CalendarView_TitleField` +156. **开发指南 / WPS多维表格开发 / API文档 / API / CardViewUI / CardViewUI对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CardViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CardViewUI` +157. **开发指南 / WPS多维表格开发 / API文档 / API / CardViewUI / ViewMode** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CardViewUI_ViewMode` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CardViewUI_ViewMode` +158. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / CascadeField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField` +159. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 设置选项** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_AllCascadeOption` +160. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / AllCascadeOption** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_AllCascadeOption` +161. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 显示完整的选择路径** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_IsDisplayAllLevel` +162. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / IsDisplayAllLevel** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_IsDisplayAllLevel` +163. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 选项标题** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_Title` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_Title` +164. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / Title** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_Title` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_Title` +165. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_getValue` +166. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeField_setValue` +167. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / CascadeOption对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOption` +168. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Children** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Children` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOption_Children` +169. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOption_Id` +170. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Value** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOption_Value` +171. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / CascadeOptions对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOptions` +172. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOptions_Add` +173. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOptions_Count` +174. **开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_CascadeOptions_Item` +175. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Chart对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart` +176. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Copy** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart_Copy` +177. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart_Delete` +178. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart_Id` +179. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart_Name` +180. **开发指南 / WPS多维表格开发 / API文档 / API / Chart / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Chart_Type` +181. **开发指南 / WPS多维表格开发 / API文档 / API / Charts / Charts对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Charts` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Charts` +182. **开发指南 / WPS多维表格开发 / API文档 / API / Charts / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Charts_Add` +183. **开发指南 / WPS多维表格开发 / API文档 / API / Charts / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Charts_Count` +184. **开发指南 / WPS多维表格开发 / API文档 / API / Charts / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Charts_Item` +185. **开发指南 / WPS多维表格开发 / API文档 / API / ContactField / ContactField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField` +186. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 插入多个联系人** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_IsSupportMulti` +187. **开发指南 / WPS多维表格开发 / API文档 / API / ContactField / IsSupportMulti** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_IsSupportMulti` +188. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 发送通知** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_IsSupportNotice` +189. **开发指南 / WPS多维表格开发 / API文档 / API / ContactField / IsSupportNotice** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_IsSupportNotice` +190. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_getValue` +191. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ContactField_setValue` +192. **开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Criteria对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Criteria` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Criteria` +193. **开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Field** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Field` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Criteria_Field` +194. **开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Op** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Op` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Criteria_Op` +195. **开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Value** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Criteria_Value` +196. **开发指南 / WPS多维表格开发 / API文档 / API / DBCellValue / DBCellValue对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DBCellValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DBCellValue` +197. **开发指南 / WPS多维表格开发 / API文档 / API / DBCellValue / Value** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DBCellValue_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DBCellValue_Value` +198. **开发指南 / WPS多维表格开发 / API文档 / API / DataSource / DataSource对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource` +199. **开发指南 / WPS多维表格开发 / API文档 / API / DataSource / CreateSummarySheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_CreateSummarySheet` +200. **开发指南 / WPS多维表格开发 / API文档 / API / DataSource / CreateSyncDBSheets** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_CreateSyncDBSheets` +201. **开发指南 / WPS多维表格开发 / API文档 / API / DataSource / ImportFromCloud** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromCloud` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_ImportFromCloud` +202. **开发指南 / WPS多维表格开发 / API文档 / API / DataSource / ImportFromLocal** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromLocal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DataSource_ImportFromLocal` +203. **开发指南 / WPS多维表格开发 / API文档 / API / DateField / DateField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField` +204. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 面板标记休息日** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowHoliday` +205. **开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowHoliday** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowHoliday` +206. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 显示时间** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowTime` +207. **开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowTime** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowTime` +208. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 显示星期** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowWeek` +209. **开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowWeek** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_IsShowWeek` +210. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_getValue` +211. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DateField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DateField_setValue` +212. **开发指南 / WPS多维表格开发 / API文档 / API / DbComment / DbComment对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DbComment` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DbComment` +213. **开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DbComment_Delete` +214. **开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DbComment_Id` +215. **开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Text** + - 路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Text` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_DbComment_Text` +216. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbAutomationPresetType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbAutomationPresetType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbAutomationPresetType` +217. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbButtonIcon** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbButtonIcon.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbButtonIcon` +218. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbFieldValueType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbFieldValueType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbFieldValueType` +219. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbFilterCriteriaOpType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbFilterCriteriaOpType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbFilterCriteriaOpType` +220. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbGroupUnit** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbGroupUnit.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbGroupUnit` +221. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbLookupFunction** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbLookupFunction.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbLookupFunction` +222. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbPermissionType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbPermissionType` +223. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbSharedCriteriaType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbSharedCriteriaType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_DbSharedCriteriaType` +224. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / EditableAndViewableRecordsConfigType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_EditableAndViewableRecordsConfigType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_EditableAndViewableRecordsConfigType` +225. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / FilterOpType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_FilterOpType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_FilterOpType` +226. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / RoleBuildInType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_RoleBuildInType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_RoleBuildInType` +227. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / SharedLinkPermissionType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkPermissionType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_SharedLinkPermissionType` +228. **开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / SharedLinkToType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkToType.md` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Enum_SharedLinkToType` +229. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Field对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field` +230. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / FieldDescriptor对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor` +231. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Apply** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Apply` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Apply` +232. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / DefaultVal** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_DefaultVal` +233. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / DefaultValType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultValType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_DefaultValType` +234. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Delete` +235. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Description** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Description` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Description` +236. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Id` +237. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / IsSyncField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsSyncField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_IsSyncField` +238. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / IsValueUnique** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_IsValueUnique` +239. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Name` +240. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / NumberFormat** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_NumberFormat` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_NumberFormat` +241. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / OnDelete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_OnDelete` +242. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / OnUpdate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_OnUpdate` +243. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptor_Type` +244. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / FieldDescriptors对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors` +245. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / AddField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_AddField` +246. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_Count` +247. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_Delete` +248. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / FieldDescriptor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_FieldDescriptor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_FieldDescriptor` +249. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_Item` +250. **开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / OnCreate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FieldDescriptors_OnCreate` +251. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Copy** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Copy` +252. **开发指南 / WPS多维表格开发 / API文档 / API / Field / FieldDescriptor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_FieldDescriptor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_FieldDescriptor` +253. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Id` +254. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Move** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Move` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Move` +255. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Name` +256. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Type` +257. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Visible** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Visible` +258. **开发指南 / WPS多维表格开发 / API文档 / API / Field / Width** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Field_Width` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Field_Width` +259. **开发指南 / WPS多维表格开发 / API文档 / API / Fields / Fields对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Fields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Fields` +260. **开发指南 / WPS多维表格开发 / API文档 / API / Fields / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Fields_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Fields_Count` +261. **开发指南 / WPS多维表格开发 / API文档 / API / Fields / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Fields_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Fields_Item` +262. **开发指南 / WPS多维表格开发 / API文档 / API / Filter / Filter对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter` +263. **开发指南 / WPS多维表格开发 / API文档 / API / Filter / Criteria** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Criteria` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_Criteria` +264. **开发指南 / WPS多维表格开发 / API文档 / API / Filter / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_Delete` +265. **开发指南 / WPS多维表格开发 / API文档 / API / Filter / FieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_FieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_FieldId` +266. **开发指南 / WPS多维表格开发 / API文档 / API / Filter / FilterId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filter_FilterId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filter_FilterId` +267. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Filters对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters` +268. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Add` +269. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Clear** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Clear` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Clear` +270. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Count` +271. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Item` +272. **开发指南 / WPS多维表格开发 / API文档 / API / Filters / Operator** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Operator` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Filters_Operator` +273. **开发指南 / WPS多维表格开发 / API文档 / API / Font / Font对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Font` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Font` +274. **开发指南 / WPS多维表格开发 / API文档 / API / Font / Color** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Font_Color` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Font_Color` +275. **开发指南 / WPS多维表格开发 / API文档 / API / FormView / FormView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormView` +276. **开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / FormViewUI对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormViewUI` +277. **开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / DesignForm** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI_DesignForm` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormViewUI_DesignForm` +278. **开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / FillInForm** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI_FillInForm` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormViewUI_FillInForm` +279. **开发指南 / WPS多维表格开发 / API文档 / API / FormView / RequiredFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormView_RequiredFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormView_RequiredFields` +280. **开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / FormulaField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormulaField` +281. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 公式字段 / 公式的文本表达式** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormulaField_Formula` +282. **开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / Formula** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormulaField_Formula` +283. **开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / IsShowPercentAsProgress** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_IsShowPercentAsProgress` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormulaField_IsShowPercentAsProgress` +284. **开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / ValueType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_ValueType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_FormulaField_ValueType` +285. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / GanttView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView` +286. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / GanttViewUI对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI` +287. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 设置折叠** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_GanttGridFold` +288. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / GanttGridFold** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_GanttGridFold` +289. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / NextPage** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_NextPage` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_NextPage` +290. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 定位上一页** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_PrevPage` +291. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / PrevPage** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_PrevPage` +292. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 定位至今天** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_Today` +293. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / Today** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_Today` +294. **开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / ViewMode** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_ViewMode` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttViewUI_ViewMode` +295. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 开始日期字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_BeginField` +296. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / BeginField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_BeginField` +297. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / Calendars** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_Calendars` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_Calendars` +298. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 结束日期字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_EndField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_EndField` +299. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / EndField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_EndField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_EndField` +300. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 工时统计** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_IsOnlyWorkDay` +301. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / IsOnlyWorkDay** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_IsOnlyWorkDay` +302. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 时间线颜色** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_TimelineColor` +303. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColor** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_TimelineColor` +304. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColorFollowField** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorFollowField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_TimelineColorFollowField` +305. **开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColorType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GanttView_TimelineColorType` +306. **开发指南 / WPS多维表格开发 / API文档 / API / GridView / GridView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GridView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GridView` +307. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 表格视图 / 冻结列数** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GridView_FrozenCols` +308. **开发指南 / WPS多维表格开发 / API文档 / API / GridView / FrozenCols** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GridView_FrozenCols` +309. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 表格视图 / 行高** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GridView_RowHeight` +310. **开发指南 / WPS多维表格开发 / API文档 / API / GridView / RowHeight** + - 路径: `/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_GridView_RowHeight` +311. **开发指南 / WPS多维表格开发 / API文档 / API / Group / Group对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group` +312. **开发指南 / WPS多维表格开发 / API文档 / API / Group / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group_Delete` +313. **开发指南 / WPS多维表格开发 / API文档 / API / Group / Field** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group_Field` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group_Field` +314. **开发指南 / WPS多维表格开发 / API文档 / API / Group / IsAscending** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group_IsAscending` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group_IsAscending` +315. **开发指南 / WPS多维表格开发 / API文档 / API / Group / Unit** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Group_Unit` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Group_Unit` +316. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / Groups对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups` +317. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_Add` +318. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_Count` +319. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / FoldAll** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_FoldAll` +320. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / IsTempUnFold** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_IsTempUnFold` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_IsTempUnFold` +321. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_Item` +322. **开发指南 / WPS多维表格开发 / API文档 / API / Groups / UnFoldAll** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Groups_UnFoldAll` +323. **开发指南 / WPS多维表格开发 / API文档 / API / Interior / Interior对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Interior` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Interior` +324. **开发指南 / WPS多维表格开发 / API文档 / API / Interior / Color** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Interior_Color` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Interior_Color` +325. **开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / KanbanView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_KanbanView` +326. **开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / MoveUnGroupToFirst** + - 路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToFirst` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_KanbanView_MoveUnGroupToFirst` +327. **开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / MoveUnGroupToLast** + - 路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToLast` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_KanbanView_MoveUnGroupToLast` +328. **开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / SetGroupCondition** + - 路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_SetGroupCondition` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_KanbanView_SetGroupCondition` +329. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField` +330. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关系组集合** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_AutoLinkGroups` +331. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / AutoLinkGroups** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_AutoLinkGroups` +332. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 自动关联** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_IsAutoLink` +333. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / IsAutoLink** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_IsAutoLink` +334. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联多条记录** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_IsSupportMultiLinks` +335. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / IsSupportMultiLinks** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_IsSupportMultiLinks` +336. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联表格ID** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_LinkSheet` +337. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkSheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_LinkSheet` +338. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联视图ID** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_LinkView` +339. **开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkView** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_LinkView` +340. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_getValue` +341. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LinkField_setValue` +342. **开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LookupField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LookupField` +343. **开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LinkFieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LinkFieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LookupField_LinkFieldId` +344. **开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupFieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupFieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LookupField_LookupFieldId` +345. **开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupSheetId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupSheetId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LookupField_LookupSheetId` +346. **开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_LookupField_LookupType` +347. **开发指南 / WPS多维表格开发 / API文档 / API / Navigator / Navigator对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Navigator` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Navigator` +348. **开发指南 / WPS多维表格开发 / API文档 / API / Navigator / Visible** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Navigator_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Navigator_Visible` +349. **开发指南 / WPS多维表格开发 / API文档 / API / NoticeBar / NoticeBar对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NoticeBar` +350. **开发指南 / WPS多维表格开发 / API文档 / API / NoticeBar / Visible** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NoticeBar_Visible` +351. **开发指南 / WPS多维表格开发 / API文档 / API / NumberField / NumberField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NumberField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NumberField` +352. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 显示千位符** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NumberField_IsShowThousand` +353. **开发指南 / WPS多维表格开发 / API文档 / API / NumberField / IsShowThousand** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NumberField_IsShowThousand` +354. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NumberField_getValue` +355. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_NumberField_setValue` +356. **开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Permission2对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Permission2` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Permission2` +357. **开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Collaborators** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_Collaborators` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Permission2_Collaborators` +358. **开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / DefaultRole** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_DefaultRole` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Permission2_DefaultRole` +359. **开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / GroupDefaultRole** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_GroupDefaultRole` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Permission2_GroupDefaultRole` +360. **开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Roles** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_Roles` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Permission2_Roles` +361. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / PermissionSetting对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting` +362. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableAndViewableRecordsConfigType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableAndViewableRecordsConfigType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_EditableAndViewableRecordsConfigType` +363. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableFieldSetting** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableFieldSetting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_EditableFieldSetting` +364. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableRecordSetting** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableRecordSetting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_EditableRecordSetting` +365. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / IsAllowAddRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowAddRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_IsAllowAddRecord` +366. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / IsAllowRemoveRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowRemoveRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_IsAllowRemoveRecord` +367. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / PermissionType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_PermissionType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_PermissionType` +368. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / Sheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_Sheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_Sheet` +369. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / ViewableFieldSetting** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableFieldSetting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_ViewableFieldSetting` +370. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / ViewableRecordSetting** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableRecordSetting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSetting_ViewableRecordSetting` +371. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / PermissionSettings对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSettings` +372. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSettings_Count` +373. **开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_PermissionSettings_Item` +374. **开发指南 / WPS多维表格开发 / API文档 / API / QueryView / QueryView对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/QueryView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_QueryView` +375. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 查询视图 / 设置背景图** + - 路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_QueryView_BackgroundImage` +376. **开发指南 / WPS多维表格开发 / API文档 / API / QueryView / BackgroundImage** + - 路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_QueryView_BackgroundImage` +377. **开发指南 / WPS多维表格开发 / API文档 / 视图 / 查询视图 / 设置查询条件** + - 路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_QueryView_QueryFields` +378. **开发指南 / WPS多维表格开发 / API文档 / API / QueryView / QueryFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_QueryView_QueryFields` +379. **开发指南 / WPS多维表格开发 / API文档 / API / RatingField / RatingField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RatingField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RatingField` +380. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 设置等级** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RatingField_MaxRating` +381. **开发指南 / WPS多维表格开发 / API文档 / API / RatingField / MaxRating** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RatingField_MaxRating` +382. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RatingField_getValue` +383. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RatingField_setValue` +384. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Record对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record` +385. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / RecordComment对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment` +386. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Add` +387. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Count` +388. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Delete` +389. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComment_Item` +390. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / RecordComments对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments` +391. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_Count` +392. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_Item` +393. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / OnCreate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_OnCreate` +394. **开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / OnDelete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordComments_OnDelete` +395. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / RecordRange对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange` +396. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Add` +397. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Condition** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Condition` +398. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Count` +399. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Delete` +400. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / FieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_FieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_FieldId` +401. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Font** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Font` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Font` +402. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Id` +403. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Index** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Index` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Index` +404. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Interior** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Interior` +405. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Item` +406. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / OnDeleteRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_OnDeleteRecord` +407. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / OnUpdate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_OnUpdate` +408. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Select** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Select` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Select` +409. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / SetValues** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_SetValues` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_SetValues` +410. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Text** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Text` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Text` +411. **开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Value** + - 路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_RecordRange_Value` +412. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Delete` +413. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Id` +414. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Item` +415. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Select** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Select` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Select` +416. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Text** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Text` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Text` +417. **开发指南 / WPS多维表格开发 / API文档 / API / Record / Value** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Record_Value` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Record_Value` +418. **开发指南 / WPS多维表格开发 / API文档 / API / Records / Records对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records` +419. **开发指南 / WPS多维表格开发 / API文档 / API / Records / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Add` +420. **开发指南 / WPS多维表格开发 / API文档 / API / Records / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Count` +421. **开发指南 / WPS多维表格开发 / API文档 / API / Records / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Delete` +422. **开发指南 / WPS多维表格开发 / API文档 / API / Records / FindNext** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_FindNext` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_FindNext` +423. **开发指南 / WPS多维表格开发 / API文档 / API / Records / FindPrevious** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_FindPrevious` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_FindPrevious` +424. **开发指南 / WPS多维表格开发 / API文档 / API / Records / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Records_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Records_Item` +425. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Role对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role` +426. **开发指南 / WPS多维表格开发 / API文档 / API / Role / AddUser** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_AddUser` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_AddUser` +427. **开发指南 / WPS多维表格开发 / API文档 / API / Role / DeleteAndReplacedBy** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_DeleteAndReplacedBy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_DeleteAndReplacedBy` +428. **开发指南 / WPS多维表格开发 / API文档 / API / Role / DeleteUser** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_DeleteUser` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_DeleteUser` +429. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Description** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_Description` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_Description` +430. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_Id` +431. **开发指南 / WPS多维表格开发 / API文档 / API / Role / IsBuiltIn** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_IsBuiltIn` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_IsBuiltIn` +432. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_Name` +433. **开发指南 / WPS多维表格开发 / API文档 / API / Role / PermissionSettings** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_PermissionSettings` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_PermissionSettings` +434. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_Type` +435. **开发指南 / WPS多维表格开发 / API文档 / API / Role / Users** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Role_Users` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Role_Users` +436. **开发指南 / WPS多维表格开发 / API文档 / API / Roles / Roles对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Roles` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Roles` +437. **开发指南 / WPS多维表格开发 / API文档 / API / Roles / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Roles_Add` +438. **开发指南 / WPS多维表格开发 / API文档 / API / Roles / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Roles_Count` +439. **开发指南 / WPS多维表格开发 / API文档 / API / Roles / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Roles_Item` +440. **开发指南 / WPS多维表格开发 / API文档 / API / Roles / NoPermissionRole** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Roles_NoPermissionRole` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Roles_NoPermissionRole` +441. **开发指南 / WPS多维表格开发 / API文档 / API / SelectField / SelectField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField` +442. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 允许填写时添加选项** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_IsAddItemWhenInputting` +443. **开发指南 / WPS多维表格开发 / API文档 / API / SelectField / IsAddItemWhenInputting** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_IsAddItemWhenInputting` +444. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 设置选项** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_Items` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_Items` +445. **开发指南 / WPS多维表格开发 / API文档 / API / SelectField / Items** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_Items` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_Items` +446. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_getValue` +447. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SelectField_setValue` +448. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / Selection对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection` +449. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / GetSelectionType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_GetSelectionType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_GetSelectionType` +450. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / IsCell** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_IsCell` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_IsCell` +451. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / IsRowSelect** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_IsRowSelect` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_IsRowSelect` +452. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectCell** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectCell` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_SelectCell` +453. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectCol** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectCol` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_SelectCol` +454. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectRange** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectRange` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_SelectRange` +455. **开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectRow** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectRow` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Selection_SelectRow` +456. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Sheet对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet` +457. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AddDescription** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_AddDescription` +458. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AppendFromCloud** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromCloud` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_AppendFromCloud` +459. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AppendFromLocal** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromLocal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_AppendFromLocal` +460. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Copy** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Copy` +461. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / CreateFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_CreateFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_CreateFields` +462. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Delete` +463. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / DeleteFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_DeleteFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_DeleteFields` +464. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / FieldDescriptors** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_FieldDescriptors` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_FieldDescriptors` +465. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / FieldId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_FieldId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_FieldId` +466. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / GetFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_GetFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_GetFields` +467. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Icon** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Icon` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Icon` +468. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Id` +469. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Name` +470. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnCreateRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnCreateRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_OnCreateRecord` +471. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnDelete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_OnDelete` +472. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnRename** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_OnRename` +473. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / RecordRange** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_RecordRange` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_RecordRange` +474. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Share** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Share` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Share` +475. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / UpdateFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_UpdateFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_UpdateFields` +476. **开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Views** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Views` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheet_Views` +477. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Sheets对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets` +478. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Add` +479. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Delete` +480. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / GetActiveSheetId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_GetActiveSheetId` +481. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / GetActiveSheetIndex** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetIndex` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_GetActiveSheetIndex` +482. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Item` +483. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / ItemById** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_ItemById` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_ItemById` +484. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Move** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Move` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_Move` +485. **开发指南 / WPS多维表格开发 / API文档 / API / Sheets / OnCreateSheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sheets_OnCreateSheet` +486. **开发指南 / WPS多维表格开发 / API文档 / API / Sort / Sort对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sort` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sort` +487. **开发指南 / WPS多维表格开发 / API文档 / API / Sort / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sort_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sort_Delete` +488. **开发指南 / WPS多维表格开发 / API文档 / API / Sort / Field** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sort_Field` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sort_Field` +489. **开发指南 / WPS多维表格开发 / API文档 / API / Sort / IsAscending** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sort_IsAscending` +490. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Sorts对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts` +491. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_Add` +492. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / ChangeOrder** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_ChangeOrder` +493. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_Count` +494. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / IsAuto** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_IsAuto` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_IsAuto` +495. **开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Sorts_Item` +496. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / SummarySheet对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySheet` +497. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / RefreshSyncSheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_RefreshSyncSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySheet_RefreshSyncSheet` +498. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / RemoveSheetSyncLink** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_RemoveSheetSyncLink` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySheet_RemoveSheetSyncLink` +499. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / SourceConfigs** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_SourceConfigs` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySheet_SourceConfigs` +500. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SummarySourceConfig对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfig` +501. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / FileId** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_FileId` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfig_FileId` +502. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SetSheets** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetSheets` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfig_SetSheets` +503. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SetUrl** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetUrl` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfig_SetUrl` +504. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SheetIds** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SheetIds` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfig_SheetIds` +505. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / SummarySourceConfigs对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs` +506. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Add` +507. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Apply** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Apply` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Apply` +508. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Count` +509. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Delete` +510. **开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SummarySourceConfigs_Item` +511. **开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / SyncDBSheet对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SyncDBSheet` +512. **开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / RefreshSyncSheet** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SyncDBSheet_RefreshSyncSheet` +513. **开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / RemoveSheetSyncLink** + - 路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_SyncDBSheet_RemoveSheetSyncLink` +514. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / TextLinkRun对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRun` +515. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Address** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Address` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRun_Address` +516. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Length** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Length` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRun_Length` +517. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / LinkRunsType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_LinkRunsType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRun_LinkRunsType` +518. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Pos** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Pos` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRun_Pos` +519. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / TextLinkRuns对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRuns` +520. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRuns_Count` +521. **开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_TextLinkRuns_Item` +522. **开发指南 / WPS多维表格开发 / API文档 / API / UrlField / UrlField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/UrlField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_UrlField` +523. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 设置显示样式** + - 路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_UrlField_HyperLinkText` +524. **开发指南 / WPS多维表格开发 / API文档 / API / UrlField / HyperLinkText** + - 路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_UrlField_HyperLinkText` +525. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 获取字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_getValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_UrlField_getValue` +526. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 设置字段值** + - 路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_setValue` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_UrlField_setValue` +527. **开发指南 / WPS多维表格开发 / API文档 / API / View / View对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View` +528. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ViewShare对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare` +529. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / CanAddRemoveRecords** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_CanAddRemoveRecords` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_CanAddRemoveRecords` +530. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ChangePermission** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_ChangePermission` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_ChangePermission` +531. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / EditableFieldsInfo** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableFieldsInfo` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_EditableFieldsInfo` +532. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / EditableRecType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableRecType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_EditableRecType` +533. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / SetEnable** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_SetEnable` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_SetEnable` +534. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ShareUrl** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_ShareUrl` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_ShareUrl` +535. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / SharedLinkInfo** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_SharedLinkInfo` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_SharedLinkInfo` +536. **开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / VisibleRecType** + - 路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_VisibleRecType` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_ViewShare_VisibleRecType` +537. **开发指南 / WPS多维表格开发 / API文档 / API / View / Activate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Activate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Activate` +538. **开发指南 / WPS多维表格开发 / API文档 / API / View / Copy** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Copy` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Copy` +539. **开发指南 / WPS多维表格开发 / API文档 / API / View / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Delete` +540. **开发指南 / WPS多维表格开发 / API文档 / API / View / Description** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Description` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Description` +541. **开发指南 / WPS多维表格开发 / API文档 / API / View / Fields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Fields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Fields` +542. **开发指南 / WPS多维表格开发 / API文档 / API / View / Filters** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Filters` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Filters` +543. **开发指南 / WPS多维表格开发 / API文档 / API / View / Groups** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Groups` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Groups` +544. **开发指南 / WPS多维表格开发 / API文档 / API / View / Id** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Id` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Id` +545. **开发指南 / WPS多维表格开发 / API文档 / API / View / IsFavView** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_IsFavView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_IsFavView` +546. **开发指南 / WPS多维表格开发 / API文档 / API / View / IsPersonal** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_IsPersonal` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_IsPersonal` +547. **开发指南 / WPS多维表格开发 / API文档 / API / View / Name** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Name` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Name` +548. **开发指南 / WPS多维表格开发 / API文档 / API / View / OnDelete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_OnDelete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_OnDelete` +549. **开发指南 / WPS多维表格开发 / API文档 / API / View / OnRename** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_OnRename` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_OnRename` +550. **开发指南 / WPS多维表格开发 / API文档 / API / View / RecordRange** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_RecordRange` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_RecordRange` +551. **开发指南 / WPS多维表格开发 / API文档 / API / View / Records** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Records` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Records` +552. **开发指南 / WPS多维表格开发 / API文档 / API / View / Selection** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Selection` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Selection` +553. **开发指南 / WPS多维表格开发 / API文档 / API / View / Sorts** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Sorts` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Sorts` +554. **开发指南 / WPS多维表格开发 / API文档 / API / View / Type** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_Type` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_Type` +555. **开发指南 / WPS多维表格开发 / API文档 / API / View / ViewShare** + - 路径: `/app-integration-dev/guide/dbsheet/Api/View_ViewShare` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_View_ViewShare` +556. **开发指南 / WPS多维表格开发 / API文档 / API / Views / Views对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views` +557. **开发指南 / WPS多维表格开发 / API文档 / API / Views / ActiveView** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_ActiveView` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_ActiveView` +558. **开发指南 / WPS多维表格开发 / API文档 / API / Views / Add** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_Add` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_Add` +559. **开发指南 / WPS多维表格开发 / API文档 / API / Views / Count** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_Count` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_Count` +560. **开发指南 / WPS多维表格开发 / API文档 / API / Views / Delete** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_Delete` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_Delete` +561. **开发指南 / WPS多维表格开发 / API文档 / API / Views / Item** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_Item` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_Item` +562. **开发指南 / WPS多维表格开发 / API文档 / API / Views / ItemById** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_ItemById` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_ItemById` +563. **开发指南 / WPS多维表格开发 / API文档 / API / Views / OnCreate** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Views_OnCreate` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Views_OnCreate` +564. **开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / WatchedField对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_WatchedField` +565. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 最后修改人/最后修改时间字段 / 监听所有字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_WatchedField_IsWatchedAll` +566. **开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / IsWatchedAll** + - 路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_WatchedField_IsWatchedAll` +567. **开发指南 / WPS多维表格开发 / API文档 / 字段 / 最后修改人/最后修改时间字段 / 监听某些字段** + - 路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_WatchedField_WatchedFields` +568. **开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / WatchedFields** + - 路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_WatchedField_WatchedFields` +569. **开发指南 / WPS多维表格开发 / API文档 / API / Window / Window对象** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window` +570. **开发指南 / WPS多维表格开发 / API文档 / API / Window / BailHook** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_BailHook` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_BailHook` +571. **开发指南 / WPS多维表格开发 / API文档 / API / Window / DisplayRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_DisplayRecord` +572. **开发指南 / WPS多维表格开发 / API文档 / API / Window / FormViewUI** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_FormViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_FormViewUI` +573. **开发指南 / WPS多维表格开发 / API文档 / API / Window / GanttViewUI** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_GanttViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_GanttViewUI` +574. **开发指南 / WPS多维表格开发 / API文档 / API / Window / GridViewUI** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_GridViewUI` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_GridViewUI` +575. **开发指南 / WPS多维表格开发 / API文档 / API / Window / HiddenAllRecord** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_HiddenAllRecord` +576. **开发指南 / WPS多维表格开发 / API文档 / API / Window / Navigator** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_Navigator` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_Navigator` +577. **开发指南 / WPS多维表格开发 / API文档 / API / Window / NoticeBar** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_NoticeBar` +578. **开发指南 / WPS多维表格开发 / API文档 / API / Window / SetLayout** + - 路径: `/app-integration-dev/guide/dbsheet/Api/Window_SetLayout` + - 文档ID: `app-integration-dev_guide_dbsheet_Api_Window_SetLayout` + +--- + +## 1. 开发指南 / WPS多维表格开发 / WPS多维表格开发能力体系 + +- 页面路径: `/app-integration-dev/guide/dbsheet/dbsheet-standard` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/dbsheet-standard + +```markdown +# WPS多维表格能力体系 +WPS多维表格提供丰富的API给用户进行功能开发,用户可以借助它扩展多维表的功能。 +WPS多维表格API的开放能力可以支持多种场景的应用,包括在线脚本AirScript、内嵌使用SDK、WPS多维表格插件 + +## 在线脚本AirScript +在线脚本AirScript给用户提供撰写 JavaScript 脚本的能力,使WPS多维表格能够执行自定义自动化任务。脚本是运行在服务端环境,没有前端界面,无法定义前端的界面的操作,所有的API调用都是同步调用。更多信息查看[在线脚本AirScript](/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro) + +## 内嵌SDK +SDK提供了丰富的 **API** 对各类文档进行操作,通过使用 SDK,网页开发者可以自定义文档界面的元素、操作文档的内容、监听文档事件等操作,SDK 为用户提供了优质的在线文档体验。更多信息查看[内嵌使用SDK](/app-integration-dev/guide/dbsheet/Weboffice/weboffice-instro) + + +## WPS多维表格插件 +WPS多维表格插件提供自定义仪表盘、视图、记录卡片的能力,可以对应用、同步表、自动化流程进行扩展。 + + + + +## 能力体系概览图 +![WPS多维表格能力体系](https://cloudcdn.qwps.cn/open/_img/c1a4310149.jpg 'WPS多维表格能力体系') +``` + +## 2. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 内置基础类型 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in + +```markdown +# 内置基础类型 +内置的基本数据类型、对象和函数用来帮助开发者开发,遵循**JavaScript**函数命名的标准规范,同时不能和OpenApi提供对象重名。 + + +## 基本数据类型: +- [Boolean type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type) +- [Null type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type) +- [Undefined type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type) +- [Number type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type) +- [String type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type) + +## 内置对象: +- Object +- Array +- Map +- JSON +- BigInt +- Math +- Date +- Error + +## 内置函数: +- [isNaN()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/isNaN) +- [parseFloat()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) +- [parseInt()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/parseInt) +- [decodeURI()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/decodeURI) +- [decodeURIComponent()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) +- [encodeURI()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/encodeURI) +- [encodeURIComponent()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) +- [RegExp()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp) +- [...更多内置函数](#更多内置函数) + +## 全局对象: +- Application(DB OpenApi) + +## 日志输出: +- console.log +- console.error +- console.info + +## 自动补全: +支持自定义函数的自动补全功能。支持[JsDoc](https://jsdoc.app/about-getting-started)。 + +``` JavaScript +/** + * 数字增加1. + * + * @param {number} input 被加数. + * @return +1. + * @customfunction + */ +function inc(input) { + return input + 1; +} +``` + +## 更多内置函数 + +下面这些内置函数是用来帮助开发者处理字符串编码/解码、信息处理、参数获取和其他杂项任务的实用函数 + +## Crypto + +对信息进行加密,摘要处理 + +### 示例 + +``` javascript +// 摘要foo这个字符串信息 +console.log(Crypto.createHash("md5").update("foo").digest("hex")) // acbd18db4cc2f85cedef654fccc4a4d8 +console.log(Crypto.createHmac("sha256", "a secret").update('some data to hash').digest('hex')) //7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|----------------------------|---------------|-----------------------------------------------------| +| createHash(algorithm) | [hash](#hash) | 创建摘要算法实例,允许"md5", "sha1", "sha", "sha256", "sha512" | +| createHmac(algorithm, key) | [hmac](#hmac) | 创建HMAC算法实例,允许"md5", "sha1", "sha", "sha256", "sha512" | + +## hash + +摘要对象,由[Crypto](#crypto)产生 + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|----------------------------------------|-----------------|----------------------------------------------------------------------------------------------------------| +| update(data[ ,inputEncoding]) | [hash](#hash) | 使用给定的 data 更新哈希内容,如果未提供 encoding,且 data 是字符串,则强制为 'utf8' 编码,如果 data 是 Buffer,则忽略 inputEncoding,可重复调用添加数据 | +| digest([encoding] | string\| Buffer | 计算传给被哈希的所有数据的摘要,如果提供了 encoding,则将返回字符串;否则返回 Buffer。 | + +## hmac + +hmac对象,由[Crypto](#crypto)产生 + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|-------------------------------|-----------------|------------------------------------------------------------------------------------------------------------| +| update(data[ ,inputEncoding]) | [hash](#hash) | 使用给定的 data 更新hmac内容,如果未提供 encoding,且 data 是字符串,则强制为 'utf8' 编码,如果 data 是 Buffer,则忽略 inputEncoding,可重复调用添加数据 | +| digest([encoding] | string\| Buffer | 计算传给被hmac的所有数据的摘要,如果提供了 encoding,则将返回字符串;否则返回 Buffer。 | + +## Buffer + +产生一个 Buffer 实例 + +### 示例 + +``` javascript +// 创建包含字符串 'buffer' 的 UTF-8 字节的新缓冲区。 +const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); +console.log(buf.toString()) // buffer +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|-------------------------------------------|--------|--------------------------------------| +| from(array) | Buffer | 使用 0 – 255 范围内的字节 array 分配新的 Buffer。 | +| from(string[, encoding]) | Buffer | 从字符串转化为Buffer | +| from(arrayBuffer[, byteOffset[, length]]) | Buffer | 截断arrayBuffer的部分字节,生成新的Buffer | + +## Time + +时间函数,提供如休眠的方法 + +### 示例 + +``` javascript +Time.sleep(1000) // 休眠一秒 +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|------------|-----------|---------| +| sleep(millisecond) | undefined | 休眠指定毫秒数 | + +## Arguments + +方便获取配置的参数数据 + +### 示例 + +``` javascript +Arguments.get("foo.bar", "defaults") // 如果自定义参数是{foo : {bar : "value"}},则返回"value",如果不存在,则返回第二个参数"defaults" +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +|----------|------|-------------------------------------------------------------------------------------------------------------------| +| get(string[, defaults]) | any | 通过获取自定义参数的值,key支持使用.进行多次查找,如a.b会寻找{a : {b : ""}}这个结构体的b值。可指定默认值,如果找不到key对应的自定义参数,就返回默认值,没有指定默认值也找不到key返回undefined | + + + + + +``` + +## 3. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本经典案例 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo + +```markdown +# 脚本经典案例 +## 例子1:选中区域快速批量填值 + +``` javascript +function main(){ + const time = getNowTime() + const date = getNowDate() + ActiveView.Selection(null, ["@日期", "@时间", "@分类"]).Value = [date, time, 'B'] +} +// 获取当前时间,格式为 "hh:mm:ss" +function getNowTime() { + return (new Date()).toTimeString().split(" ")[0] +} +// 获取当前日期,格式为 "yyyy:MM:dd" +function getNowDate() { + const date = new Date() + return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() +} + +main() +``` + +## 例子2:快速实现“一键归档” + +下面代码实现了一个文件中两张数据结构相同的表 +把表一中的已完成的数据插入到表二中,并删除表一中数据 +表结构如下图所示: + +![例子2](https://cloudcdn.qwps.cn/open/_img/3f355a248d.png) + +``` javascript +function main() { + const criterias = [] + criterias.push(Criteria("@分类", "Equals", ["B"])) + criterias.push(Criteria("@完成", "Equals", ["1"])) + // 创建filters + const filters = [] + const filter = {Criterias: criterias, Op: "AND"} + filters.push(filter) + const range1 = Sheets(1).Views(1).RecordRange.Condition(filters, "AND") + if(!range1){ + return + } + const length = range1.Count + const range2 = Sheets(2).Views(1).RecordRange.Add(1, undefined, length) + range2.Value = range1.Value + range1.Delete() +} + +main() +``` + +> 结合上面两个例子,可以实现自动设置归档日期和时间,或者选中记录一键归档等等功能 + + +## 例子3:快速删除空白数据 + +删除名称字段中 值为空的数据 + +``` javascript +function deleteRecords() { + const criterias = [] + criterias.push(Criteria("@名称", "Equals",[''])) + const filters = [] + const filter = {Criterias: criterias, Op: "AND"} + filters.push(filter) + Sheets(3).Views(1).RecordRange.Condition(filters, "AND").Delete() +} +deleteRecords() +``` + +## 例子4:快速创建一张表 + +``` javascript +function main() { + Application.Sheets.Add( + { + Type:'xlEtDataBaseSheet', + Config:{ + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15,listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + }) +} +main() +``` + +## 例子5:格式化数据批量插入 + +``` javascript +function main(){ + const range = Application.Sheets(4).Views(1).RecordRange.Add(1, undefined, 300)// 在第1行,向上方添加300条记录 + const template = ["商品", 10] + const range1 = [] + // 给1-300行赋值 + for (let i = 1; i < 301; i++ ) { + if(i<101){ + range1.push([template[0]+i,template[1],'A']) + }else if(i<201){ + range1.push([template[0]+i,template[1]+10,'B']) + }else{ + range1.push([template[0]+i,template[1]+10,'C']) + } + } + range.Value = range1 +} +main() +``` + +## 例子 6:自动双向关联 + +先来看一下表结构 + +- 客户表 + +![例子6](https://cloudcdn.qwps.cn/open/_img/346955a3c4.png) + +- 拜访记录表 + +![例子6](https://cloudcdn.qwps.cn/open/_img/477605cfc7.png) + +对 【客户表】 中的"拜访记录" 和 【拜访记录表】 中的 "客户详情"做自动关联 + +> 通过客户名称来进行匹配 + +``` javascript +function main() { + const clientsView = Application.Sheets(1).Views(1) + const clientsCount = clientsView.RecordRange.Count + + const visitsView = Application.Sheets(2).Views(1) + const visitsCount = visitsView.RecordRange.Count + + const clients = clientsView.RecordRange('1:'+clientsCount) + const visits = visitsView.RecordRange('1:'+visitsCount) + + linkVisits(clients, visits) + linkClients(clients, visits) +} +// 关联拜访记录表中的客户 +function linkClients(clients,visits){ + let name1 = '' + let name2 = '' + let id = 0 + // {"value":[{"id":"XP","str":"金山办公"}]} + for(let i=1;i 第一张表中存着所有数据,其他几张表中存着分类数据 +> 当主表中数据更新的时候,期望其他表数据也更新 + +``` javascript +// 读取整个表 +function getAllRecords(sheetIndex) { + const view = Application.Sheets(sheetIndex).Views(1) + const count = view.RecordRange.Count + return view.RecordRange("1:"+count) +} +// 获取子表中匹配的同步字段数组 +function getMatchFields(sheetIndex,toSyncFields){ + const matchFields = [] + const fieldDescs = Application.Sheets(sheetIndex).FieldDescriptors + for(let i=0;i1?v1:[v1]} +} + +// 同步副表数据 +function syncSheet(sheetIndex, mainRecordMap, { + keyField, + toSyncFields, +}) { + const records = getAllRecords(sheetIndex) + const matchFields = getMatchFields(sheetIndex,toSyncFields) + // console.log(matchFields) + const toUpdateIds = [] + const toUpdateVals = [] + for (let i = 1; i < records.Count+1; i++) { + const record = records.Item(i) + const name = records.Item(i,['@'+keyField]).Value + if(name === '') continue + const mainRecord = mainRecordMap[name] + if (mainRecord) { + const updatedResult = checkFields(mainRecord, record, matchFields) + if (updatedResult) { + toUpdateIds.push(updatedResult.id) + toUpdateVals.push(updatedResult.val) + } + } else { + console.error('没有在主表里面找到此条记录: ', name) + } + } + if (toUpdateIds.length > 0) { + // console.log(toUpdateVals) + records(toUpdateIds,matchFields).Value = toUpdateVals + } +} + +// 同步主表数据到其他表 +function syncMainSheetToOthers(mainSheetName, keyField, toSyncFields) { + const sheets = Application.Sheet.GetSheets() + const mainIndex = sheets.findIndex(item => item.name === mainSheetName)+1 + const mainRecords = getAllRecords(mainIndex) + const recordsMap = {} + for (let i = 1; i < mainRecords.Count+1; i++) { + const name = mainRecords.Item(i,'@'+keyField).Value + if(name === '') continue + if (recordsMap[name]) { + console.error('有重复的记录', name) + } + recordsMap[name] = mainRecords.Item(i) + } + for(let index=1;index{ + // console.log('调用1次') + let resp = HTTP.fetch('https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token='+access_token,{ + method:"POST", + timeout:2000, + headers:{ + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': 'application/json', + 'Authorization': access_token + }, + body: `url=${encodeURIComponent(url)}` + }) + if(resp.status !== 200){ + throw new Error("fetch err! status is "+resp.status) + } + return word + resp.text() + },'') + return word +} +main() +``` + +# 脚本示例(08/26更新) + +``` javascript +function main(){ + addSheetViewField() + setDemoValue() + testRecordRange() + testFilters() + testSorts() + testGroups() + testGridView() +} +function addSheetViewField(){ + const sheet = Application.Sheets.Add({After:1,Type:"xlEtDataBaseSheet"}) + sheet.Views.Add("Grid",'新建的表格视图') + addField("MultiLineText","富文本") + addField("Time","时间") + addField("Currency","货币") + addField("Percentage","百分比") + addField("ID","身份证") + addField("Phone","电话") + addField("Email","邮箱") +} +function setDemoValue(){ + setValue("@文本","100") + setValue("@文本","200",'4:6') + setValue(2,123) + setValue(2,456,'4:6') + setValue(3,"2024/07/13") + setValue(3,"2024/08/13","4:6") + setValue("@单选项","选项1") + setValue("@单选项","选项2","4:6") + setValue(6,3) + setValue(6,4,"4:6") + setValue("@富文本","dfsafdasfdasf") + setValue("@富文本","fdsfagzgzgfgvcbc","4:6") + setValue("@时间","8:48:16") + setValue("@时间","10:48:16","4:6") + setValue("@货币","123213") + setValue("@货币","1434434","4:6") + // setValue(10,1.23) + // setValue(10,2.35,"4:6") + setValue("@身份证","43211620050917691X") + setValue("@身份证","43211620050917691X","4:6") + setValue("@电话","18064038091") + setValue("@电话","18064838691","4:6") + setValue("@邮箱","1437252712@qq.com") + setValue("@邮箱","1437257777@qq.com","4:6") +} +function addField(type,name,index,valueUnique,defaultValue,defaultValueType,numberFormat,arg1,arg2,arg3,arg4){ + const desc = Application.Sheets(2).FieldDescriptors.FieldDescriptor(type, name) + if (type === 'SingleSelect' || type === 'MultipleSelect') { + desc.Items = arg1 + } + if(type === 'Rating'){ + desc.MaxRating = arg1 + } + if(type === 'Formula'){ + if (arg1) { + desc.ValueUnique = arg1 + }if (arg2) { + desc.ValueType =arg2 + }if (arg3) { + desc.ShowPercentAsProgress = arg3 + } + } + if(type === 'Cascade'){ + const options = Application.CascadeOptions() + if(typeof arg1 ==='object'){ + const o1 = options.Add(arg1[0]) + const children = arg1[1] + for(let i=0;i更多API用法可参考[多维表API](/app-integration-dev/guide/dbsheet/Api/api-instro) +``` + +## 4. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 简介 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro + +```markdown +# 在线脚本AirScript 简介 +AirScript 是一个简单快速的轻量级脚本应用开发平台,给用户提供撰写 JavaScript 脚本的能力,使WPS多维表格能够执行自定义自动化任务。 + +## AirScript 能做什么​ +AirScript 目前主要为WPS多维表格打造二开平台,通过编程的方式,提供对表格数据的增删查改、单元格式修改、属性设置等能力。 + +工具优势​ +- 无需搭建本地环境,直接在文档内进行脚本云开发。 +- 内置定制化的全局 Application 对象,编辑器智能提示,开发、调试、运行一条龙服务。 +- 同步获取属性,同步执行方法,减少传统的异步调用带来的心智负担。 +- 得益于集成化开发环境,无论是创建定时任务,还是批量处理数据,亦或是自动化生成文档,开发者可以在这里尽情发挥自己的想象力。 + +## 如何使用 AirScript +- 打开WPS多维表格,点击「脚本」- 「JS脚本」下的 「新建脚本」,点击即可调起 AirScript 编辑器,如图: +![alt text](https://cloudcdn.qwps.cn/open/_img/4087023f52.png) +![alt text](https://cloudcdn.qwps.cn/open/_img/baf4725f6a.png) + + +- 自动化流程中,点击「执行以下操作」 - 「执行AirScript脚本」,选择脚本和配置参数。更多自动化配置请查看 [自动化配置](/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart#autotask) +![alt text](https://cloudcdn.qwps.cn/open/_img/d965000689.png) + + +``` + +## 5. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 快速入门 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart + +```markdown +# 开始​ +## 在AirScript 编辑器中运行 +1. 在金山文档首页新建一个WPS多维表格并打开来体验AirScript。 +2. 打开WPS多维表格,点击「脚本」- 「JS脚本」下的 「新建脚本」,点击即可调起 AirScript 编辑器。 +3. 将下方的例子,逐个运行,查看效果来快速上手AirScript。 + +``` javascript +function main(){ + console.log("hello world!") +} + +main() +``` + +``` javascript +function main(){ + // 遍历并打印所有工作表的名称 + let sheets = Application.Sheets + for (let i = 0; i < sheets.Count; i++) { + let sheet = sheets.Item(i + 1) + console.log(sheet.Name) // 打印每个工作表的名称 + } + const sheet = Application.Selection.GetActiveSheet() + // 打印当前激活Sheet的名称 + console.log(sheet.name) + + // 打印单元格内容 + console.log(Application.ActiveView.RecordRange(1,1).Text) + + // 修改单元格内容 + Application.ActiveView.RecordRange(1,1).Value = 2; + + // 打印修改后的单元格内容 + console.log(Application.ActiveView.RecordRange(1,1).Text) +} + +main() +``` + +>更多例子请查看 [AirScript脚本经典案例](/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo) + + +## 在自动化流程中运行 +1. 进入一个自动化流程的配置,在步骤中选择「执行AirScript脚本」,选择脚本和配置参数,「脚本入参」中配置传递给脚本的参数: + +![alt text](https://cloudcdn.qwps.cn/open/_img/7d86144eab.png) +2. 在脚本中获取到传递的参数 进行开发使用: + +![alt text](https://cloudcdn.qwps.cn/open/_img/b0b846e1e9.png) + +> 更多自动化请查看 [执行AirScript脚本操作使用指南](https://kdocs.cn/l/cdQOqc6TZuMk) + + + + + + + +``` + +## 6. 开发指南 / WPS多维表格开发 / API文档 / 简介 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/api-instro` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/api-instro + +```markdown +# API简介 +WPS多维表格为开发者提供了一套功能完备的聚合 API 体系,借助配套的 [SDK](/app-integration-dev/guide/dbsheet/Weboffice/weboffice-instro),开发者既能够在浏览器环境中灵活调用 API 开展项目开发,也能依托 [在线脚本AirScript](/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro) 运用 API 来编写脚本,拓展业务功能。 +丰富多样的 API 接口,赋予了用户极大的自主开发空间,扩展多维表的功能,定制个性化功能。 + +## 怎么使用 API +> 以快速创建一张表为例,下面分别是在 **浏览器环境** 和 **AirScript脚本编辑器** 中的使用示例 + +### 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add( + null,1,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +``` +### 脚本编辑器示例 +``` javascript +function main() { + Application.Sheets.Add( + 1,null,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +main() +``` + +### 相同点 + +- 两者都是采用 JavaScript 语言编写 +- 采用同一套 **API** 体系,接口一致 + +### 差异点 + +- 浏览器环境中,使用 Async、Await 语法来获取数据和设置数据,脚本编辑器中,不支持使用 Async、Await、Promise 语法 +- 脚本编辑器中,内置了一些[基本数据类型、对象和函数](/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in)用来帮助开发者开发 +``` + +## 7. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 云文档 API + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-KSDrive` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-KSDrive + +```markdown +# 云文档 API + +AirScript 提供全局的 KSDrive 对象,通过此对象即可轻松**查看、修改和创建**您的云文档 + +>在使用 KSDrive 对象操作云文档时,确保您已添加`云文档API`服务,在脚本编辑器的服务菜单内添加即可。 + +### 快速使用 + +``` js +// 打开指定文档 +let file = KSDrive.openFile('https://www.kdocs.cn/l/xxxxxxxxxxxx') +// 打印指定文档的A1单元格内容 +console.log(file.Application.Range('A1').Text) +// 使用结束之后调用close关闭文档,否则无法再次调用KSDrive.openFile +file.close() +// 获取我的云文档下面的et,ksheet文档列表 +const fileList = KSDrive.listFiles({ includeExts: ['et', 'ksheet'] }) +// 打开我的云文档目录下的第一个文档 +file = KSDrive.openFile(fileList.files[0]) +console.log(file.Application.Range('A1').Text) +// 关闭文档 +file.close() +``` + +### 属性列表 + +| 属性名 | 数据类型 | 说明 | +| --------------------- | -------- | ------------------ | +| [FileType](#filetype) | object | 支持的文件类型集合 | + +### 方法列表 + +| 方法名 | 返回类型 | 说明 | +| --------------------------- | ----------------------- | ------------------------ | +| [createFile()](#createfile) | string | 创建或另存一个文件 | +| [openFile()](#openfile) | [File](#file) | 额外打开一个文件 | +| [listFiles()](#listfiles) | [FilesInfo](#filesinfo) | 列出某个目录下的表格文件 | + +## FileType + +云文档支持的文件类型,可用于新建文件时指定新文件的类型 + +### 属性说明 + +| 属性名 | 数据类型 | 说明 | +| ------ | -------- | -------- | +| AP | string | 智能文档 | +| KSheet | string | 智能表格 | +| ET | string | 表格 | +| DB | string | 多维表 | + +## createFile() + +创建一个新文件,也可以将一个源文件另存为新文件 + +### 参数 + +| 名称 | 类型 | 必填 | 说明 | +| ------------- | --------------------- | ---- | ---------------- | +| type | [FileType](#filetype) | 是 | 新文件的类型 | +| createOptions | CreateOptions | 是 | 新文件的参数选项 | + +### CreateOptions 对象说明{#createOptions} + +| 名称 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------- | +| name | string | 是 | 新文件的文件名 | +| dirUrl | string | 否 | 新文件的文件目录 | +| source | string | 否 | 将目标文件另存为新文件 | + +### 返回值 + +url - string 新文件的 URL + +### 示例 + +``` js +// 创建ET文件,指定保存位置 +let url = KSDrive.createFile(KSDrive.FileType.ET, { + name: 'et测试', + dirUrl: '指定保存位置' +}) +console.log(url) +// 新建DB文件 +url = KSDrive.createFile(KSDrive.FileType.DB) +console.log(url) +// 新建KSheet文件 +url = KSDrive.createFile(KSDrive.FileType.KSheet) +console.log(url) +// 新建AP文件 +url = KSDrive.createFile(KSDrive.FileType.AP) +console.log(url) +// 文件另存 +url = KSDrive.createFile(KSDrive.FileType.KSheet, { + source: 'https://www.kdocs.cn/l/cqQwuiG2mo7E', + name: '复制表格' +}) +console.log(url) +``` + +## openFile() + +额外打开一个文件,并返回一个 JavaScript 对象[File](#file)。 + +### 示例 + +``` js +let file = KSDrive.openFile('https://www.kdocs.cn/l/xxxxxxxxxxxx') +console.log(file.Application.ActiveSheet.Range('A1').Text) +file.close() +``` + +### 参数 + +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ----------------------------------------------------------- | +| openInfo | URL / [FileInfo](#fileinfo) | 是 | 打开文件的信息,可以为文件分享链接或者[FileInfo](#fileinfo) | + +### 返回值 + +[File](#file) - 一个 JavaScript 对象 + +## listFiles() + +列出某个目录下的所有文件和对应信息 + +### 示例 + +``` js +// 遍历获取某个文件夹下的所有文件的文件名 +for (let offset = 0; offset >= 0; ) { + const list = KSDrive.listFiles({ + dirUrl: 'https://www.kdocs.cn/mine/xxxxxxxxxx', + offset: offset, + count: 100 + }) + for (let i = 0; i < list.files.length; i++) { + console.log(list.files[i].fileName) + } + offset = list.nextOffset +} +``` + +### 参数 + +| 名称 |
类型
| 默认值 | 必填 | 说明 | +| ------- | ---------------------------------- | --------- | ---- | ------------------------------------------------------------------------------------ | +| options | object | undefined | 否 | 一个 JavaScript 对象,undefined 时获取我的云文档目录下面的文件数据,详细参数如下所示 | + +### 详细参数 + +|
参数名
|
参数类型
|
默认值
|
必填
| 说明 | +| ------------------------------------ | -------------------------------------- | ------------------------------------ | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| dirUrl | string | | false | 目录链接,如`https://www.kdocs.cn/mine/xxxxxx`,为空时获取我的云文档目录下面的文件数据 | +| offset | number | 0 | false | 开始位置。通常由[listFiles()](#listfiles)函数返回。比如,[listFiles()](#listfiles)函数在某次检索中返回了 nextOffset 为 100,而想要获取更多文件信息,则下一次调用[listFiles()](#listfiles)函数时把 100 作为此可选参数传入。 | +| count | number | 30 | false | 文件个数 | +| includeExts | string[] | | false | 指定文件类型,支持参数及对应关系,ksheet:"表格",et:"WPS 表格",db:"多维表",otl:"文档",wpp:"演示",wps:"WPS 文字" | + +### 返回值 + +[FilesInfo](#filesinfo) - 一个 JavaScript 对象,文件信息 + +## File + +打开文件函数[openFile()](#openfile)返回的一个 JavaScript 对象。 + +### 属性 + +| 名称 | 类型 | 说明 | +| ----------- | ---------------------------------------------------- | -------------------------------------------------------- | +| Application | Application(ET/Ksheet/DBT) | 被打开文件的操作对象,目前支持 et,ksheet,dbt | +| close | Function | 关闭文件的函数,使用完 file 对象之后调用,关闭打开的文件 | + +## FilesInfo + +获取文件夹信息函数[listFiles(options)](#listfiles)返回的一个 JavaScript 对象。 + +### 属性 + +| 名称 | 类型 | 说明 | +| ---------- | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| files |
[FileInfo](#fileinfo)[]
| 文件信息,详细参数如下所示 | +| nextOffset | number | 下一页的偏移量,可以作为[listFiles(options)](#listfiles)的参数而输出下一页文件内容,当下一页为空时,nextOffset 为-1 | + +### FileInfo + +| 名称 | 类型 | 说明 | +| ---------- | ------ | --------------- | +| fileName | string | 文件名 | +| fileId | string | 加密后的文件 id | +| createTime | number | 文件创建时间戳 | +| updateTime | number | 文件修改时间戳 | + +``` + +## 8. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 邮件 API + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-SMTP` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-SMTP + +```markdown +# 邮件 API + +通过外部邮件服务发送邮件。 + +### 快速使用 + +``` javascript +// 登录 +let mailer = SMTP.login({ + host: "smtp.example.com", // 域名 + port: 465, // 端口 + secure: true, // TLS + username: "sender@example.com", // 账户名 + password: "Pa55W0rd" // 密码 +}) +// 客户端发送邮件 +mailer.send({ + from: "sender@example.com", // 发件人 + to: "reciever@example.com", // 收件人 + subject: "this is subject.", // 主题 + text: "this is text.", // 文本 + html: `

this is html

` // HTML代码 +}) +// 支持指定昵称 +mailer.send({ + from: "管理员 ", + to: "接受者 ", + subject: "this is subject.", + text: "this is text.", + html: `

this is html

` +}) +// 支持发送多个邮箱 +mailer.send({ + from: "管理员 ", + to: ["username1@example.com","接受者2 "], + subject: "this is subject.", + text: "this is text.", + html: `

this is html

` +}) +``` + +## SMTP + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +| ---------------------------- | ----------------- | -------------------- | +| [login(argvs)](#login-argvs) | [Mailer](#mailer) | 登录并返回邮件发送者 | + +## login(argvs) + +登录并返回邮件发送对象 + +``` javascript +// 登录qq邮箱 +let mailer = SMTP.login({ + host: "smtp.qq.com", // QQ 的SMTP服务器的域名 + port: 465, + username: "1000000000@qq.com", // qq 邮箱地址 + password: "xxxxxxxxxxxx", // qq邮箱的SMTP密码,非qq密码 + secure: true +}); +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填 | 说明 | +| ----- |------------| --------- | ---- | ------------------------------------------------ | +| argvs | LoginArgvs | undefined | true | 一个JavaScript对象,用于配置SMTP的参数,如下所示 | + +### LoginArgvs + +|
名称
| 类型 | 默认值 | 必填 | 说明 | +|----------------------------------|---------|-----------|-------|-----------------------------------------------------------------------------------------| +| host | string | undefined | true | 邮箱服务器域名 | +| port | number | undefined | true | SMTP服务端口,当host为undefined时,取默认值,默认值由secure决定,当secure是false时默认值为587,当secure是true时默认值为465。 | +| secure | boolean | undefined | true | 是否使用TLS连接服务器,在大多数情况下,如果要连接到端口465,请将此值设置为true;如果要连接到端口587或25,请将此值设置为false。 | +| username | string | undefined | true | 用于身份验证的账户名 | +| password | string | undefined | true | 用于身份验证的密码 | +| timeout | number | 10000 | false | 等待建立连接的时间,单位毫秒(ms) | + +### 返回值 + +[Mailer](#mailer)- 邮件发送者 + +## Mailer + +由 [login(argvs)](#login-argvs)创建的对象,用于发送邮件 + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +| ------------------------------ | --------- | -------- | +| [send(message)](#send-message) | undefined | 发送邮件 | + +## send(message) + +发送邮件 + +``` javascript +mailer.send({ + from: ["Administrator "], + to: ["username@example.com", "UserName "], + subject: "this is subject.", + text: "this is text.", + html: `

this is html

` +}) +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填 | 说明 | +| ------- |--------------| --------- | ---- | ---------------------------------------------- | +| message | messageArgvs | undefined | true | 一个JavaScript对象,要发送的邮件内容,如下所示 | + +### messageArgvs + +| 名称 | 类型 | 默认值 | 必填 | 说明 | +|---------|-------------------|-----------|-------|-------------| +| from | string | undefined | true | 发件人的电子邮箱地址 | +| to | string / string[] | undefined | true | 收件人的电子邮箱地址 | +| subject | string | undefined | true | 电子邮件的主题 | +| text | string | undefined | true | 电子邮件显示的文本 | +| html | string | undefined | false | 电子邮件的HTML代码 | + + +``` + +## 9. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 网络 API + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-http` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-http + +```markdown +# 网络 API + +AirScript 提供一个全局的 HTTP 对象,开发者可通过此对象提供的方法请求外部服务,请求成功后会同步返回服务器的响应。 + +该 API 的使用方式与浏览器内的 fetch()函数基本一致,对于前端开发者来说应该可以很快上手。 + +>在使用 HTTP 对象提供的方法发送请求之前,确保您已添加`网络API`服务,在脚本编辑器的【工具栏】-【服务】菜单内添加即可。 + +### 快速使用 + +``` javascript +// 发起网络请求 +const resp = HTTP.fetch('https://open.iciba.com/dsapi/', { + timeout: 2000 +}) +const data = resp.json() +console.log(data.note, data.content) +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +| ---------------------------------- | --------------------- | -------------------------- | +| [fetch(url[, options])](#fetch) | [Response](#response) | 发起自定义类型的网络请求 | +| [get(url[, options])](#get) | [Response](#response) | 发起 GET 类型的网络请求 | +| [delete(url[, options])](#delete) | [Response](#response) | 发起 DELETE 类型的网络请求 | +| [post(url,body[, options])](#post) | [Response](#response) | 发起 POST 类型的网络请求 | +| [put(url,body[, options])](#put) | [Response](#response) | 发起 PUT 类型的网络请求 | + +## fetch(url[, options]) + +发起一个网络请求,可以自定义设置 headers 和 body。 + +### 示例 + +``` javascript +const resp = HTTP.fetch('https://www.kdocs.cn', { + method: 'GET', + timeout: 2000, + headers: { + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' + } +}) +console.log(resp.text()) +``` + +### 参数 + +|
名称
| 类型 | 默认值 |
必填项
| 说明 | +| ---------------------------------- | --------------------------------------------------------------- | --------- | ------------------------------------ | ---------------------------------------------------------- | +| url | string | | true | 需要访问的网络地址,只允许访问不带端口号的域名 | +| options |
[RequestOption](#requestoption)
| undefined | false | 一个 JavaScript 对象,可指定发起请求的可选参数,如下所示。 | + +### RequestOption + +|
名称
| 类型 | 默认值 |
必填项
| 说明 | +| ---------------------------------- | ------ | --------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- | +| method | string | GET | false | 发起网络请求的方法,例如`GET`、`POST`、`PUT`、`DELETE`等 | +| timeout | number | 10000 | false | 发起网络请求的超时时间,单位毫秒(ms),数据范围为 0~60000,超出范围的数据将被设为默认值 10 秒。 | +| headers | object | undefined | false | 发起网络请求的头部。例如`cookie`等 | +| body | string | undefined | false | 发起网络请求的主体内容。 | + +### 返回值 + +[Response](#response) - 服务器返回的响应 + +## get(url[, options]) + +发起 GET 类型的网络请求。 + +### 示例 + +``` javascript +const resp = HTTP.get('https://reqres.in/api/users/2') +console.log(resp.json()) +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填项 | 说明 | +| ------- | --------------------------------------------------------------------------- | --------- | ------ | ---------------------------------------------------------- | +| url | string | | true | 需要访问的网络地址,只允许访问不带端口号的域名 | +| options |
[MethodRequestOption](#methodrequestoption)
| undefined | false | 一个 JavaScript 对象,可指定特定请求的可选参数,如下所示。 | + +### MethodRequestOption + +|
名称
| 类型 | 默认值 |
必填项
| 说明 | +| ---------------------------------- | ------ | --------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- | +| timeout | number | 10000 | false | 发起网络请求的超时时间,单位毫秒(ms),数据范围为 0~60000,超出范围的数据将被设为默认值 10 秒。 | +| [headers](#headers) | object | undefined | false | 发起网络请求的头部。例如`cookie`等 | + +### 返回值 + +[Response](#response) - 服务器返回的响应 + +## delete(url[, options]) + +发起 DELETE 类型的网络请求。 + +### 示例 + +``` javascript +const resp = HTTP.delete('https://reqres.in/api/users/2') +console.log(resp.status) +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填项 | 说明 | +| ------- | --------------------------------------------------------------------------- | --------- | ------ | ---------------------------------------------------------- | +| url | string | | true | 需要访问的网络地址,只允许访问不带端口号的域名 | +| options |
[MethodRequestOption](#methodrequestoption)
| undefined | false | 一个 JavaScript 对象,可指定特定请求的可选参数,如下所示。 | + +### 返回值 + +[Response](#response) - 服务器返回的响应 + +## post(url,body[, options]) + +发起 POST 类型的网络请求。 + +### 示例 + +``` javascript +// 发送form +const formResp = HTTP.post( + 'https://www.example.cn', + { foo: 'bar' }, + { headers: { 'content-type': 'multipart/form-data' } } +) + +//发送json +const resp = HTTP.post('https://reqres.in/api/users', { + name: 'morpheus', + job: 'leader' +}) + +console.log(resp.json()) +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填项 | 说明 | +| ------- | --------------------------------------------------------------------------- | --------- | ------ | ---------------------------------------------------------- | +| url | string | | true | 需要访问的网络地址,只允许访问不带端口号的域名 | +| body | string\| object | | true | 请求体 | +| options |
[MethodRequestOption](#methodrequestoption)
| undefined | false | 一个 JavaScript 对象,可指定特定请求的可选参数,如下所示。 | + +### 返回值 + +[Response](#response) - 服务器返回的响应 + +## put(url,body[, options]) + +发起 PUT 类型的网络请求。 + +### 示例 + +``` javascript +const resp = HTTP.put('https://reqres.in/api/users/200', { + name: 'wps', + job: 'developer' +}) +console.log(resp.json()) +``` + +### 参数 + +| 名称 | 类型 | 默认值 | 必填项 | 说明 | +| ------- | --------------------------------------------------------------------------- | --------- | ------ | ---------------------------------------------------------- | +| url | string | | true | 需要访问的网络地址,只允许访问不带端口号的域名 | +| body | string\| object | | true | 请求体 | +| options |
[MethodRequestOption](#methodrequestoption)
| undefined | false | 一个 JavaScript 对象,可指定特定请求的可选参数,如下所示。 | + +### 返回值 + +[Response](#response) - 服务器返回的响应 + +## Response + +HTTP 发起网络请求后返回的响应,response 是流数据,只有首次调用 text(),json()或 binary()能获取到数据 + +### 示例 + +``` javascript +let resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.status) // 200 +console.log(resp.statusText) // OK +console.log(resp.text()) // `{foo:"bar"}` +console.log(resp.json()) // {foo:"bar"} +console.log(resp.status) // [...] +``` + +### 方法列表 + +| 方法 | 返回类型 | 简介 | +| ------------------------- | -------------------------------------------------------------- | -------------------------------------------- | +| [status](#status) | number | 获取响应的 HTTP 状态码 | +| [statusText](#statustext) | string | 获取响应的 HTTP 状态 | +| [headers](#headers) | object | 获取响应的 header | +| [text()](#text) | string | 获取服务器返回的文本 Body | +| [json()](#json) | any | 将服务器返回的 json 类型的 Body 转化为结构体 | +| [binary()](#binary) | [Buffer](https://nodejs.org/docs/latest-v17.x/api/buffer.html) | 获取服务器返回的二进制结构的 Body | + +## status + +获取响应的 HTTP 状态码 + +### 示例 + +``` javascript +const resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.status) // 200 +``` + +### 返回值 + +number - 服务器返回响应的 HTTP 状态码 + +## statusText + +获取响应的 HTTP 状态 + +### 示例 + +``` javascript +const resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.statusText) // OK +``` + +### 返回值 + +string - 服务器返回响应的 HTTP 状态 + +## headers + +获取响应的 header + +### 示例 + +``` javascript +let resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.headers) // {"content-length":"44","content-type":"text/html; charset=utf-8"} +``` + +### 返回值 + +object - 服务器返回响应的 header + +## text() + +获取服务器返回的 Body + +### 示例 + +``` javascript +let resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.text()) // this is an example. +``` + +### 返回值 + +string - 服务器返回的响应的 Body,以文本接受并返回 + +## json() + +获取服务器返回的 Body + +### 示例 + +``` javascript +let resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.json()) // {msg:"this is an example."} +``` + +### 返回值 + +Object, Array, string, number, boolean, or null - 服务器返回的响应的 Body,以文本接受并经过 JSON.parse()后返回 + +## binary() + +获取服务器返回的 Body + +### 示例 + +``` javascript +let resp = HTTP.get('https://open.iciba.com/dsapi/') +console.log(resp.binary().toString('base64')) +``` + +### 返回值 + +[Buffer](https://nodejs.org/docs/latest-v17.x/api/buffer.html) - 服务器返回的响应的 Body,以 Buffer 接受二进制数据并返回 + +``` + +## 10. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 简介 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-instro` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-instro + +```markdown +# 简介 +借助AirScript的高级服务,开发者只需要完成较少设置,即可连接到某些公开的金山文档API。 它们的使用方式与AirScript脚本的内置函数十分相似。 + +AirScript在运行时会自动处理[授权流程](#授权流程​)。 不过开发者必须[启用高级服务](#高级服务),才能在脚本中使用该服务,若跳过该步骤,会因为找不到该服务而抛出**undefined**错误。 + +## 启用高级服务​ +要使用高级服务,请按以下说明操作: + +1. 打开**AirScript编辑工具**弹出编辑页面。 +2. 点击AirScript编辑工具上方的**服务**。 +3. 点击**添加服务**。 +![alt text](https://cloudcdn.qwps.cn/open/_img/32fa555afe.png) +4. 选择一项服务,然后点击**确认**。 + +启用高级服务后,该服务会在自动补全中显示。 + +## 授权流程​ +AirScript需要用户授权才能访问高级服务中的私密数据。 + +### 授予运行权限​ +AirScript会根据开发者编写脚本时启用高级服务的配置内容来确定授权范围 (例如访问指定文件或访问网络)。如果脚本需要授权,用户在运行脚本时会弹出授权对话框。 描述这个脚本涉及到的授权范围。 + +普通的代码更改并不会清空用户对脚本的授权。但如果开发者对更改了高级服务的配置(新增,修改或删除), 那用户对脚本的授权也会清空,再次运行脚本时会重新触发授权流程。 + +### 取消授权​ +用户可以对已授权的脚本手动取消授权,请按以下说明操作 + +1. 打开**AirScript编辑工具**弹出编辑页面。 +2. 找到脚本列表下想取消授权的脚本,点击 … 显示更多操作。 +3. 点击**取消服务授权** + +## 使用限制​ +为防止向用户提供恶意的脚本,出于安全性考虑,使用高级服务存在一些限制。 + +- 过于高频地使用高级服务,当出现这种情况时,脚本的运行会抛出明显的错误通知用户异常调用。 +- 使用[HTTP](/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-http)服务时,禁止使用IP地址发起请求,禁止使用端口发起请求。 +- 使用[HTTP](/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-http)服务时,收到内容的消息体最大为2M,超过2M会抛出错误。 +- 使用[KSDrive.openFile](/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-KSDrive) 获得的File对象没有调用close, 就再次使用KSDrive.openFile 会报错。 + +``` + +## 11. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 高级服务 / 数据库 API + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-sql` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-advanced-sql + +```markdown +# 数据库 API + +AirScript 提供一个全局的 SQL 对象,开发者可通过此对象提供的属性和方法连接到**外部数据库**服务,连接成功后即可执行 SQL 语句,对数据进行增删改查。 + +>在使用 SQL 对象连接数据库之前,确保您已添加`数据库API`服务,在脚本编辑器的【工具栏】-【服务】菜单内添加即可。 + +### 快速使用 + +``` js +// 连接MySQL数据库 +const connection = SQL.connect(SQL.Drivers.MySQL, { + host: '127.0.0.1', + username: 'root', + password: '123456', + database: 'mydb', + port: 3306 +}) + +// 执行SQL语句,查询test表的所有数据 +const result1 = connection.queryAll('SELECT * FROM test') +// 打印执行结果 +console.log(result1) + +// 执行SQL语句,插入数据 +const result2 = connection.queryAll( + 'INSERT INTO test (id,test_data) VALUES (?,?), (?,?)', + [1, 1, 2, 2] +) +// 打印执行结果 +console.log(result2) + +// 关闭数据库连接 +connection.close() +``` + +### 属性列表 + +| 属性名 | 数据类型 | 说明 | +| ------------------- | -------- | --------------------------------------- | +| [Drivers](#drivers) | object | 数据库连接驱动集 | +| [Types](#types) | object | 数据库字段类型集(仅适用于 SQL server) | + +### 方法列表 + +| 方法 | 返回类型 | 说明 | +| ---------------------------------- | ---------- | -------------- | +| [connect()](#connect) | Connection | 连接目标数据库 | +| [Connection.queryAll()](#queryall) | Result | 执行 SQL 语句 | +| [Connection.close()](#close) | null | 关闭数据库连接 | + +## Drivers + +数据库驱动集,调用[connect()](#connect)方法连接数据库时传入对应驱动,目前仅支持 MySQL 和 SQL server 两种驱动,只读 + +### 属性说明 + +| 属性名 | 数据类型 | 说明 | +| ---------- | -------- | --------------------- | +| MySQL | string | MySQL 数据库驱动 | +| PostgreSQL | string | PostgreSQL 数据库驱动 | +| SQLServer | string | SQL server 数据库驱动 | + +## Types + +数据库字段类型集,请注意,该类型集仅适用于 SQL server 数据库,MySQL 数据库不需要传递此值 + +### 属性说明 + +#### Exact numerics + +| 属性名 | 对应 Javascript 类型 | +| ---------- | -------------------- | +| Bit | Boolean | +| TinyInt | Number | +| SmallInt | Number | +| Int | Number | +| BigInt | String | +| Numeric | Number | +| Decimal | Number | +| SmallMoney | Number | +| Money | Number | + +#### Approximate numerics + +| 属性名 | 对应 Javascript 类型 | +| ------ | -------------------- | +| Float | Number | +| Real | Number | + +#### Date and Time + +| 属性名 | 对应 Javascript 类型 | +| -------------- | -------------------- | +| SmallDateTime | Date | +| DateTime | Date | +| DateTime2 | Date | +| DateTimeOffset | Date | +| Time | Date | +| Date | Date | + +#### Character Strings + +| 属性名 | 对应 Javascript 类型 | +| ------- | -------------------- | +| Char | String | +| VarChar | String | +| Text | String | + +#### Unicode Strings + +| 属性名 | 对应 Javascript 类型 | +| -------- | -------------------- | +| NChar | String | +| NVarChar | String | +| NText | String | + +#### Binary Strings + +| 属性名 | 对应 Javascript 类型 | +| --------- | -------------------- | +| Binary | Buffer | +| VarBinary | Buffer | +| Image | Buffer | + +#### Other Data Types + +| 属性名 | 对应 Javascript 类型 | +| ---------------- | -------------------- | +| Null | null | +| TVP | Object | +| UDT | Buffer | +| UniqueIdentifier | String | +| Variant | any | +| xml | String | + +## connect() + +连接目标数据库,目前仅支持 MySQL、PostgreSQL 和 SQL server 三种类型的数据库,连接成功后会返回数据库连接对象,可通过此对象执行 SQL 语句,程序结束之前请调用[close()](#close)方法关闭数据库连接。 + +### 参数 + +| 属性 | 数据类型 | 默认值 | 必填 | 说明 | +| ------- | ------------------- | ------ | ---- | ------------------ | +| driver | [Driver](#drivers) | null | 是 | 指定目标数据库驱动 | +| options | [Options](#options-对象说明) | null | 是 | 数据库连接信息 | + +### options 对象说明 + +| 属性 | 数据类型 | 默认值 | 必填 | 说明 | +| -------- | -------- | ------ | ---- | -------------------- | +| host | string | null | 是 | 目标数据库主机 | +| port | number | null | 是 | 目标数据库端口 | +| username | string | null | 是 | 目标数据库连接用户名 | +| password | string | null | 是 | 目标数据库连接密码 | +| database | string | null | 是 | 目标数据库名 | + +### 返回值 + +Connection - 数据库连接对象 + +### 示例 + +``` js +// 连接MySQL数据库 +const connection = SQL.connect(SQL.Drivers.MySQL, { + host: '127.0.0.1', + port: 3340, + username: 'jinxiaomeng', + password: '123', + database: 'WPS_TEST' +}) +``` + +## Connection.queryAll() + +通过上述的[connect()](#connect)方法成功连接数据库后,会返回数据库连接对象,通过此对象即可调用 queryAll()方法执行 SQL 语句 + +### 参数 + +| 属性 | 数据类型 | 默认值 | 必填 | 说明 | +| ---------- | ---------------------------------- | ------ | ---- | ----------------- | +| sql | string | null | 是 | 要执行的 sql 语句 | +| InsertData | any[] \| [InsertData](#insertdata) | null | 否 | 需要插入的数据 | + +### InsertData 对象说明 + +| 属性 | 数据类型 | 默认值 | 必填 | 说明 | +| ----- | --------------- | ------ | ---- | ----------------------------------------------- | +| name | string | null | 是 | 插入数据的字段名 | +| value | string | null | 是 | 插入数据的值 | +| type | [Types](#types) | null | 否 | 插入数据的类型,SQL server 数据库必须传递该类型 | + +### 返回值 + +Result 对象,包含受影响的行数以及返回的数据行 + +| 属性 | 数据类型 | 说明 | +| -------------- | -------- | -------------------------------------- | +| affectRowCount | number | 执行 sql 语句后受到影响的行数 | +| rows | Array | 数据行,根据实际查询的表的数据结构返回 | + +### 返回示例 + +``` json +// 查询时的返回 +{ + "affectRowCount": 0, + "rows": [ + [ + { + "name": "1", + "value": 2 + } + ] + ] +} + +// 增删改时的返回 +{ + "affectRowCount": 1, + "rows": [] +} +``` + +### 示例 + +``` js +// 连接SQL server数据库 +const connection = SQL.connect(SQL.Drivers.SQLServer, { + host: 'x.x.x.x', + username: 'x', + password: 'x', + database: 'x', + port: 1433 +}) + +// 执行sql语句,插入两条数据 +const result1 = connection.queryAll( + 'INSERT INTO TestSchema.Employees (Name, Location) OUTPUT INSERTED.Id VALUES (@Name, @Location);', + [ + { + name: 'Name', + type: SQL.Types.NVarChar, + value: 'zhangsan' + }, + { + name: 'Location', + type: SQL.Types.NVarChar, + value: 'zhuhai' + } + ] +) + +// 打印执行结果 +console.log(result1) + +// 执行sql语句,查询员工表 +const result2 = connection.queryAll( + 'SELECT Id, Name, Location FROM TestSchema.Employees;' +) + +// 打印执行结果 +console.log(result2) + +// 关闭数据库连接 +connection.close() +``` + +## Connection.close() + +关闭数据库连接,请务必在程序结束前调用此方法 + +### 示例 + +``` js +// 连接MySQL数据库 +const connection = SQL.connect(SQL.Drivers.MySQL, { + host: '127.0.0.1', + port: 3340, + username: 'jinxiaomeng', + password: '123', + database: 'WPS_TEST' +}) + +// do something + +// 关闭数据库连接 +connection.close() +``` + +``` + +## 12. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 接口说明 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-api` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-api + +```markdown +# 接口说明​ +成功生成脚本令牌后,就可以通过 HTTP 接口执行脚本了,我们提供了同步执行和异步执行两种脚本执行接口供开发者使用。 + +相较而言,前者使用更简单,接口调用后会直接返回执行结果,适用于执行耗时一般的场景;而后者则略微复杂一点,接口调用后不会返回最终的执行的结果,但会立即返回一个`task_id`,您需要根据此`task_id`轮询脚本执行的日志,而无需同步等待结果阻塞业务流程,该接口适用于执行耗时比较大的场景。 + +无论使用您使用哪个接口,都必须先获取到文件 ID 和脚本 ID,请先进入脚本编辑器,在侧边栏列表的更多菜单里复制 webhook 链接即可。 + +## 同步执行脚本​ +`POST /api/v3/ide/file/:file_id/script/:script_id/sync_task` + +### Header 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|Content-Type|是|string|`application/json`| +|AirScript-Token|是|string|传入您通过 AirScript 编辑器生成的脚本令牌(APIToken)| + +### path 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|script_id|是|string|脚本的 ID| +|file_id|是|string|运行脚本的文件 ID| + +### body 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|Context|是|Object|运行时的上下文参数| +|Context.argv |否 |Object|传入的上下文参数对象,比如传入`{name: 'xiaomeng', age: 18}`,在 AS 代码中可通过`Context.argv.name`获取到传入的值| +|Context.sheet_name |否|string|db,et,ksheet 运行时所在表名| +|Context.range|否|string|et,ksheet 运行时所在区域,例如`$B$156`| +|Context.link_from |否|string|et,ksheet 点击超链接所在单元格| +|Context.db_active_view |否|string|db 运行时所在 view 名| +|Context.db_selection |否|string|db 运行时所在选区| + + +### 返回参数 +|参数|必须|类型|说明| +|-|-|-|-| +|data|是|Object|任务执行数据对象| +|data.result|是|string|任务执行返回的数据| +|data.logs|是|Array|任务执行日志| +|data.logs[i].filename|是|string|执行文件的名称| +|data.logs[i].timestamp|是|string|执行时间| +|data.logs[i].unix_time|是|number|执行 unix 时间戳| +|data.logs[i].level|是|string|日志级别| +|data.logs[i].args|是|string[]|日志打印参数| +|status|是|string|任务是否执行完毕| +|error|是|string|任务执行错误信息| +|error_details|是|Object|错误信息详情对象| +|error_details.name|否|string|错误信息名称| +|error_details.msg|否|string|错误信息| +|error_details.stack|否|string[]|错误信息栈| +|error_details.unix_time|否|number|错误信息 unix 时间| + +### 请求示例 +``` shell +curl --request POST \ + --url https://www.kdocs.cn/api/v3/ide/file/:file_id/script/:script_id/sync_task \ + --header 'AirScript-Token: xxx' \ + --header 'Content-Type: application/json' \ + --data '{"Context":{"argv":{},"sheet_name":"表名"}}' +``` + +### 返回示例 +``` javascript +{ + "data": { + "logs": [ + { + "filename": "", + "timestamp": "16:44:08.271", + "unix_time": 1690274648271, + "level": "info", + "args": ["脚本环境初始化..."] + }, + { + "filename": "", + "timestamp": "16:44:08.953", + "unix_time": 1690274648953, + "level": "info", + "args": ["已开始执行"] + }, + { + "filename": "未命名脚本.js:1:9", + "timestamp": "16:44:08.968", + "unix_time": 1690274648968, + "level": "info", + "args": ["打印参数A:111"] + }, + { + "filename": "", + "timestamp": "16:44:08.969", + "unix_time": 1690274648969, + "level": "info", + "args": ["执行完毕"] + } + ], + "result": "[Undefined]" + }, + "error": "", + "status": "finished" +} +``` + +## 异步执行脚本 +`POST /api/v3/ide/file/:file_id/script/:script_id/task` + +### Header 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|Content-Type|是|string|`application/json`| +|AirScript-Token|是|string|传入您通过 AirScript 编辑器生成的脚本令牌(APIToken)| + +### path 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|script_id|是|string|脚本的 ID| +|file_id|是|string|运行脚本的文件 ID| + +### body 参数 +|参数|必须|类型|说明| +|-|-|-|-| +|Context|是|Object|运行时的上下文参数| +|Context.argv |否 |Object|传入的上下文参数对象,比如传入`{name: 'xiaomeng', age: 18}`,在 AS 代码中可通过`Context.argv.name`获取到传入的值| +|Context.sheet_name |否|string|db,et,ksheet 运行时所在表名| +|Context.range|否|string|et,ksheet 运行时所在区域,例如`$B$156`| +|Context.link_from |否|string|et,ksheet 点击超链接所在单元格| +|Context.db_active_view |否|string|db 运行时所在 view 名| +|Context.db_selection |否|string|db 运行时所在选区| + +### 返回参数 +|参数|必须|类型|说明| +|-|-|-|-| +|task_id|是|string|运行的任务 Id,用于轮循运行结果| +|task_type|是|string|任务类型| + +### 请求示例 +``` shell +curl --request POST \ + --url https://www.kdocs.cn/api/v3/ide/file/:file_id/script/:script_id/task \ + --header 'AirScript-Token: xxx' \ + --header 'Content-Type: application/json' \ + --data '{"Context":{"argv":{},"sheet_name":"表名"}}' +``` + +### 返回示例 +``` javascript +{ + "data": { + "task_id": "GN/KU3B3BG84MdCjraN5mukx0Rt5Sp1eJ9k2qClmcaOkkF3PUVNDOYPY7Kz4aQMXSvXn9N08QabldRKjPfzii87fuGYydIuK2la2HMfcxmGK1Pf4WcPEflb5xOOkQQEo8fmEbzcobhurYg==" + }, + "task_id": "GN/KU3B3BG84MdCjraN5mukx0Rt5Sp1eJ9k2qClmcaOkkF3PUVNDOYPY7Kz4aQMXSvXn9N08QabldRKjPfzii87fuGYydIuK2la2HMfcxmGK1Pf4WcPEflb5xOOkQQEo8fmEbzcobhurYg==", + "task_type": "open_air_script" +} +``` + +## 获取任务运行情况 + +`GET /api/v3/script/task` + +### query 参数 + +| 参数 | 必须 | 类型 | 说明 | +| ------- | ---- | ------ | ----------------------- | +| task_id | 是 | string | 执行异步任务时返回的 ID | + + +>任务ID为query参数,拼接时请注意先编码下,比如`encodeURIComponent(task_id)` + +### 返回参数 + +| 参数 | 必须 | 类型 | 说明 | +| ----------------------- | ---- | -------- | ------------------ | +| data | 是 | Object | 任务执行数据对象 | +| data.result | 是 | string | 任务执行返回的数据 | +| data.logs | 是 | Array | 任务执行日志 | +| data.logs[i].filename | 是 | string | 执行文件的名称 | +| data.logs[i].timestamp | 是 | string | 执行时间 | +| data.logs[i].unix_time | 是 | number | 执行 unix 时间戳 | +| data.logs[i].level | 是 | string | 日志级别 | +| data.logs[i].args | 是 | string[] | 日志打印参数 | +| status | 是 | string | 任务是否执行完毕 | +| error | 是 | string | 任务执行错误信息 | +| error_details | 否 | object | 错误信息详情对象 | +| error_details.name | 否 | string | 错误信息名称 | +| error_details.msg | 否 | string | 错误信息 | +| error_details.stack | 否 | string[] | 错误信息栈 | +| error_details.unix_time | 否 | number | 错误信息 unix 时间 | + +### 请求示例 + +``` shell +curl --request GET \ + --url https://www.kdocs.cn/api/v3/script/task +``` + +### 返回示例 + +``` json +{ + "data": { + "logs": [ + { + "filename": "", + "timestamp": "17:05:16.164", + "unix_time": 1692090316164, + "level": "info", + "args": ["脚本环境初始化..."] + } + ], + "result": null + }, + "error": "Unexpected token (1:91)", + "error_details": { + "name": "SyntaxError", + "msg": "Unexpected token (1:91)", + "stack": [" at 未命名脚本.js:1:91"], + "unix_time": 1692090318372 + }, + "status": "finished" +} +``` + +``` + +## 13. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 应用场景 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-demo` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-demo + +```markdown +# 应用场景​ +在脚本令牌的加持下,WPS多维表格的强大能力得到完美释放,开发者能以一种更为高效和准确的方式执行任务。无论是网页爬取、数据分析,还是自动化流程,我都可以借助脚本令牌来完成。 + +如下为我们根据实际场景写的一些示例和说明,希望能给开发者一定的启发。 + +## 1. 私密信息查询​ +现代社会越来越重视个人的隐私。这种趋势在很多方面都有所体现。 + +首先,在教育领域,许多学校开始加强对学生在校期间的信息保护,禁止将学生的个人信息出售或分享给他人。这包括学生的家庭信息、教育记录、考试成绩等。 + +其次,在医疗保健领域,病人的隐私保护成为了一个重要的问题。医生和其他医疗工作者需要遵守严格的隐私规定,确保病人的个人信息不会被泄露。 + +此外,在社交媒体领域,许多平台也开始加强对用户信息的保护。他们采取了更严格的数据安全措施,以确保用户的数据不会被泄露或滥用。 + +如下,我们将展示一个学生成绩查询的在线示例,你可以在线体验利用脚本令牌实现的私密信息查询的功能。现有学生成绩表如下图所示: + +![alt text](https://cloudcdn.qwps.cn/open/_img/20f358300f.png) + +你可以根据上表提供的学生信息,输入对应学生的学号和姓名后,即可查询到对应学生的成绩,下面有脚本的示例。 + +>注意 +>真实使用场景中,会要求输入密码或者手机验证等。 + +![alt text](https://cloudcdn.qwps.cn/open/_img/21f561c4e9.png) + +``` javascript +function main() { + // 获取学生的学号 + const student_id = '1' + // 获取学生的姓名 + const student_name = '金小妹' + // 获取记录区域 + const rg = Application.Sheets(1).Views(1).RecordRange + // 获取记录区域的行数 + const rowCount = rg.Count + + // 获取匹配的学生数据 + const data = [] + for (let i = 1; i <= rowCount; i++) { + const studentId = rg(i, "@学号").Value + const studentName = rg(i, "@姓名").Value + + if (studentId === student_id && studentName === student_name) { + const sex = rg(i, "@性别").Value + const className = rg(i, "@班级").Value + const language = rg(i, "@语文").Value + const math = rg(i, "@数学").Value + const english = rg(i, "@英语").Value + + data.push({ + id: studentId, + name: studentName, + sex: sex, + className: className, + language: language, + math: math, + english: english, + }) + break + } + } + // 返回匹配的学生数据 + return data +} +main() +``` + +## 2. 电商数据同步​ +电商数据同步是一个重要的环节,确保电商平台在销售和运营方面能够高效运作。在数据来源上,它可能是多个不同的系统,包括数据库、ERP系统、CRM系统等。而开发者首先要做的是手动导出或者 webhook 的形式获取到商品信息、订单信息、物流信息等数据,然后在您的个人服务器内得到这些数据,进行数据清洗和转换,最后再通过脚本令牌写入到金山文档多维表格内,完成数据的同步。 + +## 3. RPA 数据同步​ +如果开发者有自己的 RPA 平台,需要从金山文档内获取值班信息,再通过 RPA 发送到他们的工作群内。传统的实现方式很麻烦,需要先利用 AirScript 的邮件服务将内容发送到邮件里,然后新建定时任务定时执行脚本,最后通过 RPA 读取邮件内容后转发到企业微信。 + +有了脚本令牌后,再也不用这么辛苦的“曲线救国”了,想要什么数据,通过脚本令牌直线获取即可。 + +## 4. 简易数据库​ +一些开发者有自己的个人网站,用户量很少或者仅作为个人学习使用,直接购买云数据库成本太高不划算。 + +此时大家可以想想,数据库里的表是表,多维表格里的表也是表,在某种条件下,有没有可能多维表格可以平替掉云数据库? + +当然有可能,使用脚本令牌您可以轻松的完成数据的增删改查,扔掉老爷车 SQL,使用 JavaScript 来进行“为所欲为”的结构化查询,快来体验一下吧。 + +>注意 +>以上仅提供一个新思路,只适用于个人学习或者非常轻量级的服务,毕竟玩归玩闹归闹,别拿数据开玩笑。 + +## 5. 作为数据工具使用​ +有时候我们需要在自己的系统内使用到表格提供的高级功能,来完成对数据的筛选和过滤操作。比如现在有这么一个场景:开发者使用影刀 RPA 进行一个网站的数据爬取,爬取完了之后存到一个 excel,对 excel 做完数据清理之后才能进行下一步操作。但是有了脚本令牌后,就可以先将数据写入金山文档表格中,然后执行 AirScript 基于规则进行一个自动清理,直接就能进行下一步操作。 +``` + +## 14. 开发指南 / WPS多维表格开发 / 在线脚本AirScript / 脚本令牌 / 简介 + +- 页面路径: `/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-instro` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-instro + +```markdown +# 脚本令牌(APIToken)​ +开发者通过 AirScript 编辑器编写的脚本,可以直接在编辑器内运行,也可以粘贴链接在单元格运行,或者是通过定时任务面板自动运行。 + +但是上述几种运行方式均集成在我们的平台方,如果开发者希望在自身的业务系统内使用到 AirScript 的能力,则需要借助我们的脚本令牌。 + +## 什么是脚本令牌?​ +脚本令牌即 APIToken,是我们为外部系统引入 AirScript 能力而专门设计的。通过脚本令牌,您可以轻松使用到金山文档 AirScript 提供的能力,执行脚本获取文档数据或者是写入文档内容。 + +![alt text](https://cloudcdn.qwps.cn/open/_img/d00887e5cd.png) + + +## 如何创建脚本令牌?​ +1. 进入WPS多维表格后,打开脚本编辑器,在工具栏点击【脚本令牌】按钮 +2. 如果之前未创建过脚本令牌,会提示脚本令牌创建所需要注意的点,勾选【我已知晓】,然后点击【创建脚本令牌】即可 +3. 为保证一定的安全,如果您还未进行过实名认证,需要先完成实名认证流程 +4. 创建成功后即可获取到您的个人脚本令牌,复制令牌信息然后妥善保存 + +![alt text](https://cloudcdn.qwps.cn/open/_img/6a7f6b7087.png) + +## 如何使用脚本令牌?​ +脚本令牌是外部执行脚本的凭证,在您成功生成自己的脚本令牌后,便可以开始着手使用脚本令牌进行脚本的执行调用。 + +首先,打开脚本编辑器,在侧边栏任意一个文档脚本的更多菜单里复制脚本的 webhook 链接。 + +![alt text](https://cloudcdn.qwps.cn/open/_img/f45c212ebd.png) + +查看复制到的链接的内容如下所示: + +`https://www.kdocs.cn/api/v3/ide/file/caEkI6K5RDG2/script/V2-5rSiBiN7y5xdOd5x5ZYI2r/sync_task` + +链接内已拼接好了当前脚本的脚本 ID 和所在文档的文件 ID,接下来请求该链接即可读取和编辑本人相应的文档,注意调用的时候必须设置请求头`AirScript-Token`,值为您的脚本令牌,更详细的说明请参阅[接口说明](/app-integration-dev/guide/dbsheet/AirScript/AirScript-apitoken-api)。 + +这里假设目标脚本的代码如下所示,将单元格的值修改为AirScript,并返回一个对象: + +``` javascript +Application.ActiveView.RecordRange(1,1).Value = 'AirScript'; +return { + name: '金小朦', + age: 17 +} +``` + +通过脚本令牌和 webhook 我们构造了一个 http 请求,如下所示: + +``` shell +curl --request POST \ + --url https://www.kdocs.cn/api/v3/ide/file/caEkI6K5RDG2/script/V2-5rSiBiN7y5xdOd5x5ZYI2r/sync_task \ + --header 'AirScript-Token: xxx' \ + --header 'Content-Type: application/json' \ + --data '{"Context":{"argv":{}}}' +``` + +如果请求成功,将会返回如下数据,其内容主要包含脚本运行的日志信息和在代码中 return 的数据,如果您的脚本代码书写有误,相应的报错信息也会在日志中有所体现。 + +``` javascript +{ + "data": { + "logs": [ + { + "filename": "", + "timestamp": "12:03:20.711", + "unix_time": 1691726600711, + "level": "info", + "args": ["脚本环境初始化..."] + }, + { + "filename": "", + "timestamp": "12:03:22.129", + "unix_time": 1691726602129, + "level": "info", + "args": ["已开始执行"] + }, + { + "filename": "", + "timestamp": "12:03:22.312", + "unix_time": 1691726602312, + "level": "info", + "args": ["执行完毕"] + } + ], + "result": { + "age": 17, + "name": "金小朦" + } + }, + "error": "", + "status": "finished" +} +``` + +## 注意事项​ +1. 由于脚本令牌允许第三方访问到平台的服务端资源,为提高一定的安全性,我们需要您完成实名认证(已认证可忽略) +2. 脚本令牌,是外部执行脚本的凭证,属于个人隐私信息,通过脚本令牌配合脚本 webhook,可读取和编辑本人相应的文件,需妥善管理,请勿对外传播 +3. 脚本令牌与用户绑定,每个用户最多有且仅有一个脚本令牌,创建新的令牌时,需要先对老令牌进行删除(重新创建的脚本令牌需与原令牌不同) +4. 脚本令牌默认 180 天到期,用户可在创建时手动进行延期,不做限制,可多次延期 + + +``` + +## 15. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 创建合并表 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet + +```markdown +# 创建合并表 +DataSource.CreateSummarySheet(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +将数据源表合并成一个合并表。 + +## 语法 +表达式.CreateSummarySheet(SummarySourceConfigs) + +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| SummarySourceConfigs | 是 | SummarySourceConfigs | 数据源配置对象 | + +## 返回值 +SummarySheet + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 通过SummarySourceConfigs对象构造符合规范的数据源配置对象,来创建合并表 + const configs = await app.SummarySourceConfigs; + await configs.Add('100138603654', [1]) + const sheet = await app.DataSource.CreateSummarySheet(configs) + console.log(sheet) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 通过SummarySourceConfigs对象构造符合规范的数据源配置对象,来创建合并表 + const configs = Application.SummarySourceConfigs; + configs.Add('100138603654', [1]) + const sheet = Application.DataSource.CreateSummarySheet(configs) + console.log(sheet) +} +main() +``` +``` + +## 16. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 创建同步表 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets + +```markdown +# 创建同步表 +DataSource.CreateSyncDBSheets(方法) + + +## 说明 +创建同步表 + +## 语法 +表达式.CreateSyncDBSheets(FileId, OfficeType, SheetIds) +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| FileId | 是 | string | 在线表格文件的 fileId | +| OfficeType | 是 | 'd' \| 'k' | 在线表格文件的类型:d 代表多维表格,k 代表智能表格 | +| SheetIds | 是 | number[] | 在线表格文件的 stId 数组 | + +## 返回值 +SyncDBSheet[] + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const syncSheets = await app.DataSource.CreateSyncDBSheets('100127684526', 'd', [1]) + console.log(syncSheets) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const syncSheets = Application.DataSource.CreateSyncDBSheets('100127684526', 'd', [1]) + console.log(syncSheets) +} +main() +``` +``` + +## 17. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置默认值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal + +```markdown +# 设置默认值 +FieldDescriptor.DefaultVal(属性) + + +## 说明 +可读写 + +设置默认值 + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + field.DefaultVal = "1" + field.Apply() + console.log(await field.DefaultVal) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + field.DefaultVal = "1" + field.Apply() + console.log(field.DefaultVal) +} +main() +``` +``` + +## 18. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 删除字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete + +```markdown +# 删除字段 + +## 说明 +删除字段 + +## 语法 +表达式.Delete(RemoveReversedLink) + +表达式:FieldDescriptor + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|RemoveReversedLink|否|Boolean|| + + +## 返回值 +Boolean + + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + field.Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const app = Application; + const field = Application.Sheets(1).FieldDescriptors(2) + field.Delete() +} +main() +``` + +``` + +## 19. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 禁止录入重复值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique + +```markdown +# 禁止录入重复值 +FieldDescriptor.ValueUnique(属性) + + +## 说明 +可读写 + +是否唯一值,禁止重复录入 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.ValueUnique) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.ValueUnique) +} +main() +``` +``` + +## 20. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置字段名 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name + +```markdown +# 设置字段名称 +FieldDescriptor.Name(属性) + + +## 说明 +可读写 + +字段名称 + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + field.Name = "字段名" + field.Apply() + + console.log(await field.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + field.Name = "字段名" + field.Apply() + + console.log(await field.Name) +} +main() +``` +``` + +## 21. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听删除字段的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete + +```markdown +# 监听删除字段的事件 +FieldDescriptor.OnDelete(方法) + + + +## 说明 + +为 FieldDescriptor 添加 Delete 事件,当删除 FieldDescriptor 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: FieldDescriptor + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptor.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| -------- | ------ | -------------- | +| sheetId | Number | 表的 Id | +| fieldId | String | 字段的 Id | +| fieldIds | Array | 字段集合的 Ids | + +## 事件返回数据示例 + +``` +{ + fieldId: "C" + fieldIds: ['C'] + sheetId: 1 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2); + let eventContext; + eventContext = await field.OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + await field.Delete(); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2); + let eventContext; + eventContext = field.OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + field.Delete(); + field.Delete(); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 22. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听修改字段的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate + +```markdown +# 监听修改字段的事件 +FieldDescriptor.OnUpdate(方法) + + + +## 说明 + +为 FieldDescriptor 添加 Update 事件,当更新 FieldDescriptor 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnUpdate(Callback) + +表达式: FieldDescriptor + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ------ | ------------------| +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptor.OnUpdate(()=>{ ... }) | + +## 返回值 +EventContext + +## 事件返回数据 + +FieldDescriptor + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldId = app.Sheets(1).FieldId('修改前字段名'); + const fieldDescriptor = app.Sheets(1).FieldDescriptors(fieldId); + let eventContext + eventContext = await fieldDescriptor.OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy() + }); + + fieldDescriptor.Name = '修改字段名'; + fieldDescriptor.Apply(); + //这里会执行OnUpdate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const fieldDescriptor = Application.Sheets(1).FieldDescriptors(1); + let eventContext + eventContext = fieldDescriptor.OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy() + }); + fieldDescriptor.Name = '修改字段名'; + fieldDescriptor.Apply(); + //这里会执行OnUpdate的回调 +} +main(); +``` + +``` + +## 23. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 设置字段类型 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type + +```markdown +# 设置字段类型 +FieldDescriptor.Type + + +## 说明 +可读写 + +返回当前字段类型 + + +## 返回值 +|字段类型|描述| +|---|---| +|ID|身份证| +|Phone|电话| +|Email|电子邮箱| +|Url|超链接| +|Checkbox|复选框| +|SingleSelect|单选项| +|MultipleSelect|多选项| +|Rating|等级| +|Complete|进度条| +|CellPicture|单元格图片| +|Contact|联系人| +|Attachment|附件| +|Note|富文本字段,备注| +|Link|关联| +|OneWayLink|单向关联| +|Lookup|引用| +|Address|地址,特殊级联字段| +|Cascade|级联| +|Automations|触发器| +|AutoNumber|编号| +|CreatedBy|创建者| +|CreatedTime|创建时间| +|LastModifiedBy|最后修改者| +|LastModifiedTime|最后修改时间| +|Formula|公式| + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.Type) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.Type) +} +main() +``` +``` + +## 24. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 新增字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField + +```markdown +# 新增字段 + +## 说明 +往表中新增新的字段 + +## 语法 +表达式.AddField(FieldDescriptor, Index) + +表达式:FieldDescriptors + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|FieldDescriptor|是|FieldDescriptor|字段属性| +|Index|否|string/number|Index为string时表示字段ID,number时表示字段索引,插入位置,未指定时插入到末尾| + + + + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const desc = await app.FieldDescriptor("Rating","等级字段") + desc.MaxRating = 2 + await app.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const desc = FieldDescriptor("Rating","等级字段") + desc.MaxRating = 2 + await Application.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +main() +``` + +``` + +## 25. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 监听增加字段的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate + +```markdown +# 监听增加字段的事件 +FieldDescriptors.OnCreate(方法) + + + +## 说明 + +为 FieldDescriptors 添加 Create 事件,当添加 FieldDescriptors 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnCreate(Callback) + +表达式: FieldDescriptors + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------| +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptors.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +FieldDescriptor + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).FieldDescriptors.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const desc = await app.FieldDescriptor('Rating', '等级字段'); + desc.MaxRating = 2; + await app.Sheets(1).FieldDescriptors.AddField(desc, 1); + //这里会执行OnCreate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).FieldDescriptors.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const desc = Application.FieldDescriptor('Rating', '等级字段'); + desc.MaxRating = 2; + Application.Sheets(1).FieldDescriptors.AddField(desc, 1); + //这里会执行OnCreate的回调 +} +main(); +``` + +``` + +## 26. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 复制字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Copy + +```markdown +# 复制字段 + +## 说明 +复制当前字段到指定位置 + +## 语法 +表达式.Copy(Before,After) + +表达式:Field + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|String/Number|在Before之前插入复制字段| +|After|否|String/Number|在After之后插入复制字段| + + +## 返回值 +Self + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Copy(3) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + field.Copy(3) +} +main() +``` ` +``` + +## 27. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 移动字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Move` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Move + +```markdown +# 移动字段 + +## 说明 +移动字段到指定位置 + +## 语法 +表达式.Move(Before,After) + +表达式:Field + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|String/Number|移动到Before字段之前| +|After|否|String/Number|移动到After字段之后| + + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Move(3) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + field.Move(3) +} +main() +``` ` +``` + +## 28. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 隐藏/显示字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Visible + +```markdown +# 隐藏/显示字段 +Field.Visible(属性) + + +## 说明 +可读写 + +视图的字段是否可见 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Visible = false +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const visible = field.Visible + console.log(visible) +} +main() +``` +``` + +## 29. 开发指南 / WPS多维表格开发 / API文档 / 筛选 / 设置筛选条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Criteria` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_Criteria + +```markdown +# 设置筛选条件 +Filter.Criteria(属性) + + + +## 说明 + +可读写 + +设置或获取 单条筛选记录的条件 + +![alt text](https://cloudcdn.qwps.cn/open/_img/f9906a875c.png) + +## 返回值 + +[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria) + +## 浏览器环境示例 + +``` javascript +// 获取单条筛选记录的条件 +async function example() { + await instance.ready(); + const app = instance.Application; + // 获取筛选 + const filters = await app.Sheets(1).Views(1).Filters; + // 获取第一个条件 + const criteria = await filters.Item(1).Criteria; + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Values[0]) // {type: 'Text', value: '1'} +} + +// 设置单条筛选记录的条件 +async function example() { + await instance.ready(); + const app = instance.Application; + // 构造筛选数据 + const Criteria = app.Criteria(1, "Equals", ["1"]) + // 设置筛选数据 + app.Sheets(1).Views(1).Filters.Item(1).Criteria = Criteria; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const criteria = Application.Sheets(1).Views(1).Filters.Item(1).Criteria; + criteria = Criteria(1, "Equals", ["1"]); +} +main(); +``` + +``` + +## 30. 开发指南 / WPS多维表格开发 / API文档 / 筛选 / 删除筛选条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_Delete + +```markdown +# 删除筛选条件 +Filter.Delete(方法) + + + +## 说明 + +删除单条筛选记录 + +## 语法 + +表达式.Delete() + +表达式:Filter + +## 参数 + +无参数 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Filters(1).Delete(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Filters(1).Delete(); +} +main(); +``` + +``` + +## 31. 开发指南 / WPS多维表格开发 / API文档 / 筛选 / 添加筛选条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Add + +```markdown +# 添加筛选条件 +Filters.Add(方法) + +## 说明 +添加筛选条件 + +![alt text](https://cloudcdn.qwps.cn/open/_img/f9906a875c.png) + +## 语法 +表达式.Add(Criteria) + +表达式:Filters + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Criteria|是|Object|筛选条件| + + +## 返回值 +Filter + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = app.Criteria(1, 'Equals', ['1']) + const filter = await filters.Add(criteria); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const criteria = Application.Criteria(1, 'Equals', ['1']) + const filter = filters.Add(criteria); +} +main() +``` +``` + +## 32. 开发指南 / WPS多维表格开发 / API文档 / 分组 / 删除分组 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group_Delete + +```markdown +# 删除分组 +Group.Delete(方法) + +## 说明 +删除分组条件 + +## 语法 +表达式.Delete() + +表达式:Group + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups(1).Delete(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups(1).Delete(); +} +main() +``` +``` + +## 33. 开发指南 / WPS多维表格开发 / API文档 / 分组 / 添加分组 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_Add + +```markdown +# 添加分组 +Groups.Add(方法) + + + +## 说明 + +添加分组 + +## 语法 +表达式.Add(Field, IsAscending) + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Field|是|number/string|新增分组字段索引/新增分组字段ID/新增分组字段名| +|IsAscending|否|boolean|是否是升序| + +## 返回值 +Group + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.Add(1); + // const res = await app.Sheets(1).Views(1).Groups.Add("@数量"); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.Add(1); + // const res = Application.Sheets(1).Views(1).Groups.Add("@数量"); +} +main(); +``` + +``` + +## 34. 开发指南 / WPS多维表格开发 / API文档 / 分组 / 分组折叠 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll + +```markdown +# 折叠分组 +Groups.FoldAll(方法) + +## 说明 +折叠分组 + +## 语法 +表达式.FoldAll() + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.FoldAll(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.FoldAll(); +} +main() +``` +``` + +## 35. 开发指南 / WPS多维表格开发 / API文档 / 分组 / 展开分组 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll + +```markdown +# 展开分组 +Groups.UnFoldAll(方法) + +## 说明 +展开分组 + +## 语法 +表达式.UnFoldAll() + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.UnFoldAll(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.UnFoldAll(); +} +main() +``` +``` + +## 36. 开发指南 / WPS多维表格开发 / API文档 / 其他 / 设置导航栏可见性 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Navigator_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Navigator_Visible + +```markdown +# 设置导航栏可见性 +Navigator.Visible(属性) + + +## 说明 +可读写 + +设置导航栏隐藏或显示 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function getVisible() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator + const visible = await navigator.Visible // 为true导航栏隐藏,为false导航栏显示 +} +async function setVisible() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator + navigator.Visible = false // 隐藏导航栏 + navigator.Visible = true // 显示导航栏 +} +``` +``` + +## 37. 开发指南 / WPS多维表格开发 / API文档 / 公告 / 公告-展开/收起 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible + +```markdown +# 展开/收起 +NoticeBar.Visible(属性) + + +## 说明 +可读写 + +设置公告栏可见性 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function getVisible() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar + const visible = await noticeBar.Visible // 为true公告栏隐藏,为false公告栏显示 +} +async function setVisible() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar + noticeBar.Visible = false // 隐藏公告栏 + noticeBar.Visible = true // 显示公告栏 +} +``` +``` + +## 38. 开发指南 / WPS多维表格开发 / API文档 / 评论 / 插入 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Add + +```markdown +# 插入新的评论 +RecordComment.Add(方法) + +## 说明 +插入新的评论 + +## 语法 +表达式.Add(Text, TextLinkRuns) + +表达式:RecordComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Text|是|String|评论的文本,插入到评论的最前方| +|TextLinkRuns|否|Array|文本的特殊节点属性| + +## 返回值 +DbComment + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` + +``` + +## 39. 开发指南 / WPS多维表格开发 / API文档 / 评论 / 删除 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete + +```markdown +# 删除评论 +RecordComment.Delete(方法) + +## 说明 +删除评论 + +## 语法 +表达式.Delete() + +表达式:RecordComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|Number/String|删除记录的索引| + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + await recordComment.Delete(i) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + await recordComment.Delete(i) + } +} +main() +``` + +``` + +## 40. 开发指南 / WPS多维表格开发 / API文档 / 评论 / 监听插入评论 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate + +```markdown +# 监听插入评论 +RecordComments.OnCreate(方法) + + +## 说明 + +为 RecordComments 添加 OnCreate 事件,当创建 评论 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 +这个方法只能监听视图的事件, 如果在浏览器环境需要全局监听也可以使用 + +``` javascript +jssdk.on("OnBroadcast", async (res) => { + const data = res.Data + if (data.type == "DB_COMMENT_UPDATE") { // 收到文档评论更新消息 + if (data.shouldNotLocalUpdate) { + // 本地更新评论信息 + console.log("收到广播消息:", data) + const info = data.info + const {sheetStId, commentId, recordId, action} = info + if (action == "Add") { + // 新增评论 + const addText = await jssdk.Application.Sheets.ItemById(sheetStId).ActiveView.RecordComments(recordId).Item(commentId).Text + console.log("新增评论:", addText) + } else if (action == "Delete") { + // 删除评论 + console.log("删除评论:", info) + } + } + } +}) +``` + +可以通过 action 来判断是哪个事件触发的 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: RecordComments + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordComments.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 +DbComment + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.ActiveView.RecordComments.OnCreate(async (data)=> { + const info = data.info + const {sheetStId, commentId, recordId, action} = info + if (action == "Add") { + // 新增评论 + const addText = await app.Sheets.ItemById(sheetStId).ActiveView.RecordComments(recordId).Item(commentId).Text + console.log("新增评论:", addText) + } else if (action == "Delete") { + // 删除评论 + console.log("删除评论:", info) + } + }) + + // 移除监听 + // eventContext.Destroy(); +} +``` + +``` + +## 41. 开发指南 / WPS多维表格开发 / API文档 / 评论 / 监听删除评论 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete + +```markdown +# 监听删除评论 +RecordComments.OnDelete(方法) + + +## 说明 + +为 RecordComments 添加 Delete 事件,当删除 评论 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 +这个方法只能监听视图的事件, 如果在浏览器环境需要全局监听也可以使用 + +jssdk.on("OnBroadcast", (res)=>console.error("##", res)) + +回调的消息数据包含的内容跟事件返回数据是一致的, 可以通过 action 来判断是哪个事件触发的 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: RecordComments + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordComments.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| commentId | String | 评论ID | +| recordId | String | 记录ID | +| sheetStId | Number | 表ID | + +## 事件返回数据示例 + +``` +{"recordId":"Bk","sheetStId":1,"commentId":"e66e42020baa4d5455da5d2043c631a5","action":"Delete"} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.ActiveView.RecordComments.OnDelete((data)=>console.error(JSON.stringify(data))) + await app.ActiveView.RecordComments(1).Item(1).Delete() + + // 移除监听 + // eventContext.Destroy(); +} +``` + +``` + +## 42. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 插入记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Add + +```markdown +# 插入记录 + +## 说明 +插入新的记录,在指定行记录之前或之后插入 + +## 语法 +表达式.Add(Before,After,Count) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|Number/String|在行记录之前添加,Number时指定插入时索引,String时指定插入ID| +|After|否|Number/String|在行记录之后添加,Number时指定插入时索引,String时指定插入ID| +|Count|否|Number|一次插入N条数据,未指定时插入1条| + + +## 返回值 +Self + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 在第1行,向上方添加10条记录 + const range = await app.ActiveView.RecordRange.Add(1, null, 10) + + const template = ["商品"] + const range1 = [] + // 给1-10行赋值 + for (let i = 1; i < 11; i++ ) { + range1.push([template[0]+i,i]) + } + range.Value = range1 + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const range = Application.ActiveView.RecordRange.Add(31, null, 5) + // 将插入的5条记录的名称字段 初始化为 “名称” + range.Item(undefined, "@名称").Value = "名称" +} +main() +``` + +``` + +## 43. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 筛选记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition + +```markdown +# 筛选记录 + +## 说明 +筛选符合条件的记录 + +## 语法 +表达式.Condition(Filters,FilterOp) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Filters|是|Filter[]|筛选数据的条件组, 条件组里每个Filter,可以包含多个筛选条件| +|FilterOp|否|"And"/"Or"|筛选数据条件组之间的关系,是同时满足还是只需要满足一条,默认值为And| + +Filter数据结构: +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Criterias|是|[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria)[]|筛选条件项组| +|Op|否|"And"/"Or"|筛选条件项组之间的关系,是同时满足还是只需要满足一条,默认值为And| + + + +[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria) 中筛选规则(大小写不敏感): +|枚举值|描述| +|---|---| +|Equals|等于| +|NotEqu|不等于| +|Greater|大于| +|GreaterEqu|大等于| +|Less|小于| +|LessEqu|小等于| +|GreaterEquAndLessEqu|介于(取等)| +|LessOrGreater|不介于(不取等)| +|BeginWith|开头是| +|EndWith|结尾是| +|Contains|包含| +|NotContains|不包含| +|Intersected|指定值| +|Empty|为空| +|NotEmpty|不为空| + +各筛选规则独立地限制了values数组内最多允许填写的元素数,当values内元素数超过阈值时,该筛选规则将失效。“为空、不为空”不允许填写元素;“介于”允许最多填写2个元素;“指定值”允许填写65535个元素;其他规则允许最多填写1个元素 +values[]数组内的元素为字符串时,表示文本匹配。目前还支持对日期进行动态筛选,此时values[]内的元素需以结构体的形式给出: +``` +const dateValue = {"dynamicType": "lastMonth","type": "DynamicSimple"} +Criteria("@日期", "Equals", [dateValue]) +``` +上述示例对应的筛选条件为“等于上一个月”。 +要使用日期动态筛选,values[]内的结构体需要指定"type": "DynamicSimple",当"op"为"equals"时,"dynamicType"可以为如下的值(大小写不敏感): +|枚举值|描述| +|---|---| +|today|今天| +|yesterday|昨天| +|tomorrow|明天| +|last7Days|最近7天| +|last30Days|最近30天| +|thisWeek|本周| +|lastWeek|上周| +|nextWeek|下周| +|thisMonth|本月| +|lastMonth|上月| +|nextMonth|次月| + +当"op"为"greater"或"less"时,"dynamicType"只能是昨天、今天或明天。 + +对不同字段类型,values会有不同的用法 +联系人字段: +``` +// value是一个结构体,指定type为 Contact, value 为用户id +const dateValue = {"type":"Contact", value:"user id"} +``` +单/多选项字段: +``` +// value是一个结构体,指定type为 SelectItem, value 为选项的ID +const dateValue = {"type":"SelectItem", value:"B"} +``` + +## 返回值 +RecordRange + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 创建筛选条件criteria + const Criteria = app.Criteria + const criterias = [] + criterias.push(await Criteria("@名称", "Intersected", ["1"])) + // 创建筛选列表filters + const filters = [] + const filter = {Criterias: criterias, Op: "AND"} + filters.push(filter) + // 筛选记录 + const res = await app.ActiveSheet.Views(1).RecordRange.Condition(filters, "AND") + console.log(res) + // 操作记录,返回第一个筛选结果的记录ID + await res.Item(1).Id + // 删除记录 + await res.Item(1).Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 创建筛选条件criteria + const critera1 = Criteria("@名称", "Intersected", ["1", "999", "aaaa"]) + const critera2 = Criteria("@数量", "Equals", ["1"]) + const criterias = [] + criterias.push(critera1) + criterias.push(critera2) + // 创建filters + const filters = [] + const filter = { Criterias: criterias, Op: "OR" } + filters.push(filter) + const res = Application.ActiveSheet.Views(1).RecordRange.Condition(filters, "AND") + console.log(res.Value) +} +main() +``` + +``` + +## 44. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格的字体颜色 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Font` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Font + +```markdown +# 设置单元格的字体颜色 +RecordRange.Font + + + +## 说明 +可读写 + +返回当前RecordRange首个单元格的字体属性[Font](/app-integration-dev/guide/dbsheet/Api/Font) + +## 返回值 + +[Font](/app-integration-dev/guide/dbsheet/Api/Font) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordRange = await app.Sheet(1).RecordRange(1); + const font = await recordRange.Font + font.Color = "#ff00ff" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).RecordRange(1); + const font = recordRange.Font + font.Color = "#ff00ff" +} +main() +``` + +``` + +## 45. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格的填充颜色 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior + +```markdown +# 设置单元格的填充颜色 +RecordRange.Interior + + + +## 说明 +可读 +返回当前RecordRange首个单元格的填充属性[Interior](/app-integration-dev/guide/dbsheet/Api/Interior) + +## 返回值 + +[Interior](/app-integration-dev/guide/dbsheet/Api/Interior) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordRange = await app.Sheet(1).RecordRange(1); + const Interior = await recordRange.Interior + Interior.Color = "#ff00ff" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).RecordRange(1); + const Interior = recordRange.Interior + Interior.Color = "#ff00ff" +} +main() +``` + +``` + +## 46. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 监听删除记录的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord + +```markdown +# 监听删除记录的事件 +RecordRange.OnDeleteRecord(方法) + + + +## 说明 + +为 RecordRange 添加 DeleteRecord 事件,当删除 RecordRange 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnDeleteRecord(Callback) + +表达式: RecordRange + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordRange.OnDeleteRecord(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| sheetId | Number | 表的 Id | +| recordIds | Array | 记录集合的 Ids | + +## 事件返回数据示例 + +``` +{ + recordIds: ['A','C'] + sheetId: 1 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .RecordRange(1) + .OnDeleteRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).RecordRange(1).Delete(); + //这里会执行OnDeleteRecord的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .RecordRange(1) + .OnDeleteRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).RecordRange(1).Delete(); + //这里会执行OnDeleteRecord的回调 +} +main(); +``` + +``` + +## 47. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 监听修改记录的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate + +```markdown +# 监听修改记录的事件 +RecordRange.OnUpdate(方法) + + + +## 说明 + +为 RecordRange 添加 Update 事件,当更新 RecordRange 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnUpdate(Callback) + +表达式: RecordRange + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordRange.OnUpdate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +[RecordRange] + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .RecordRange(1) + .OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).RecordRange(1).Value = ['名称111', 4, '选项1']; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .RecordRange(1) + .OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).RecordRange(1).Value = ['名称111', 4, '选项1']; +} +main(); +``` + +``` + +## 48. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 设置单元格内容 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Value + +```markdown +# 设置单元格内容 +RecordRange.Value + + +## 说明 +可读写 + +RecordRange的值,读取和设置记录数据 + +## 返回值 +DbCellValue + +### 这里返回的文本根据区域会有三种情况,RecordRange 选择器参看[RecordRange](/app-integration-dev/guide/dbsheet/Api/RecordRange)的说明 +1、指定的区域为一条记录一个字段,返回单个值(值的类型看具体字段) +``` +Application.ActiveSheet.RecordRange(1,1).Value +``` +2、指定的区域为一条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange(1,[1,2]).Value +``` +3、指定的区域为多条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange([1,2],[1,2]).Value +``` + +### 设置值的时候,也有三种设置值的方式 +1、设置为单个值,将这个值设置到整个区域的指定单元格 +``` +Application.ActiveSheet.RecordRange([1,2],[1,2]).Value = "1" +``` +2、传入一维数组,目标是一条记录,则将数组设置到目标区域,如果目标是多条记录,则会将相同的数据设置到所有记录。 +``` +Application.ActiveView.RecordRange([1,2],[1,2]).Value = ["1","2"] +``` +3、传入二维数组,如果二维数组的长度为1,目标是一条记录,则将二维数组[0]设置到目标区域,如果目标是多条记录,则会将相同的数据设置到所有记录。如果二维数组为 M x N,则按顺序传入到目标区域。 +``` +Application.ActiveView.RecordRange([1,2],[1,2]).Value = [["1","2"],["3","4"]] + +// 数组长度为1时等价于 [["1","2"],["1","2"]] +Application.ActiveView.RecordRange([1,2],[1,2]).Value = [["1","2"]] +``` +### 不同字段类型设置Value时的数据结构 +地址字段类型: 通过DBCellValue() 生成字段的数据 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@地址").Value = DBCellValue({districts:["广东省","珠海市","香洲区"],detail:"前岛环路xxxx号"}) +``` +级联字段类型:通过DBCellValue() 生成字段的数据 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@级联选项").Value = DBCellValue({districts:["广东省","珠海市","香洲区"]}) +``` +超链接字段类型: +``` +Application.RecordRange(1, "@超链接").Value = Application.DBCellValue({address:"wps.cn", display:"wps"}) +``` + +关联字段类型: 参数传入关联的记录id +``` +const DBCellValue = Application.DBCellValue +Application.Sheets(1).Views(2).RecordRange(1, "@关联:数据表").Value = DBCellValue(["b","V"]) +``` + +多选项类型: +``` +Application.Sheets(1).Views(2).RecordRange([5,6], 4).Value =[[DBCellValue(["未开始","进行中"])], DBCellValue(["进行中"])] +``` + +联系人字段类型:直接传入联系人的id,如果有多个联系人,可用","进行分割 +``` +Application.Sheets(1).Views(2).RecordRange([5,6], "@联系人").Value = "238777563" +``` + +图片与附件字段:可以传入包含 URL/base64编码的图片/云文档 的数组,支持多个附件。 +注意:由于脚本有运行时长限制,附件较大/或者较多时会导致超时,设置失败 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@图片和附件").Value = DBCellValue([{fileData: url/base64, fileName: ""}]) +``` +如果要在原来的附件上,新增其它附件可以先读出来的数组增加后再重新设置 +``` +const range = Application.Sheets(1).Views(2).RecordRange(1, "@图片和附件") +const dbCellValue = range.Value +const attments = dbCellValue.Value +attments.push({fileData: url/base64, fileName: ""}) +range.Value = oldValue +``` + +其它字段类型可以直接使用字符串,日期和时间类型必须符合日期的格式的字符串 + +### 部分不支持设置值的字段类型 + DbSheetFieldType.Formula, // 公式字段 + DbSheetFieldType.Lookup, // 引用字段 + DbSheetFieldType.CreatedBy, // 创建者字段 + DbSheetFieldType.Note, // 富文本字段 + DbSheetFieldType.SearchLookup, // 查找引用字段 + DbSheetFieldType.Button, // 按钮字段 + DbSheetFieldType.LastModifiedBy, // 最近修改者字段 + DbSheetFieldType.CreatedTime, // 创建时间字段 + DbSheetFieldType.LastModifiedTime, //最后修改时间字段 + DbSheetFieldType.AutoNumber, // 自动编号 + DbSheetFieldType.Automations, // 自动任务 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(2).RecordRange([5,6], 1).Value = "1111111" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).Views(2).RecordRange([5,6], 1).Value = "1111111" +} +main() +``` +``` + +## 49. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 选中记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Select` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Select + +```markdown +# 选中记录 + + +## 说明 +选中某个区域 + +## 语法 +表达式.Select() + +表达式:Record + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + record.Select() // 选中第10行的记录 + + const info = app.Sheets(1).Views(1).Records(10, 1) + await info.Select() // 选中第10行,第一个字段 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + record.Select() // 选中第10行的记录 + + const info = Application.Sheets(1).Views(1).Records(10, 1) + info.Select() // 选中第10行,第一个字段 +} +main() +``` +``` + +## 50. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 删除记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Delete + +```markdown +# 删除记录 + + +## 说明 +删除某行记录 + +## 语法 +表达式:Delete(Index) + +表达式:Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/记录ID| + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 删除视图上的第一条数据 + app.Sheets(1).Views(1).Records.Delete(1) + // 在第10行,向上方添加2条记录 + const records = await app.Sheets(1).Views(1).Records.Add(10, undefined, 2) + // 删除刚插入的第一条数据 + records.Delete(1) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + // 删除视图上的第一条数据 + Application.Sheets(1).Views(1).Records.Delete(1) + // 在第10行,向上方添加2条记录 + const records = Application.Sheets(1).Views(1).Records.Add(10, undefined, 2) + // 删除刚插入的第一条数据 + records.Delete(1) + } +main() +``` +``` + +## 51. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 查看记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Item + +```markdown +# 查看记录 + + +## 说明 +获取指定索引行的记录信息 + +## 语法 +表达式:Item(Index) + +表达式:Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/记录ID| + +## 返回值 +Record + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records.Item(10) + // 返回字段的文本表示 + console.log(await record.Text) + // 返回字段的值 + console.log(await record.Value) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records.Item(10) + // 返回字段的文本表示 + console.log(record.Text) + // 返回字段的值 + console.log(record.Value) + } +main() +``` +``` + +## 52. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 添加说明 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription + +```markdown +# 添加说明 + +## 说明 +为当前数据表添加说明 + +## 语法 +表达式.AddDescription(Value) + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Value|是|string|待添加的说明文案| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).AddDescription('hello'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).AddDescription('hello'); +} +main() +``` +``` + +## 53. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 创建副本 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Copy + +```markdown +# 创建副本 + +## 说明 +为当前数据表创建副本 + +## 语法 +表达式.Copy(Value) + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Value|否|boolean|创建副本的方式,默认为 false。传 true 复制全部内容;传 false 仅复制空表和视图;复制的sheet为仪表盘时,此参数不传| + + +## 返回值 +Sheet + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 复制全部内容 + await app.Sheets(1).Copy(true); + // 仅复制空表和视图 + await app.Sheets(1).Copy(false); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 复制全部内容 + Application.Sheets(1).Copy(true); + // 仅复制空表和视图 + Application.Sheets(1).Copy(false); +} +main() +``` +``` + +## 54. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 设置图标 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Icon` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Icon + +```markdown +# 设置图标 + +## 说明 +可读写 + +设置图标、返回当前数据表的图标 + +## 返回值 +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = app.Sheets(1); + // read + const sheetIcon = await sheet.Icon; + // write + sheet.Icon = '📚'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1); + // read + const sheetIcon = sheet.Icon; + // write + sheet.Icon = '📚'; +} +main() +``` +``` + +## 55. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 重命名 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Name + +```markdown +# 重命名 + +## 说明 +可读写 + +重命名、返回当前数据表的名称 + +## 返回值 +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = app.Sheets(1); + // read + const sheetName = await sheet.Name; + // write + sheet.Name = 'newSheetName'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1); + // read + const sheetName = sheet.Name; + // write + sheet.Name = 'newSheetName'; +} +main() +``` +``` + +## 56. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听删除数据表的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete + +```markdown +# 监听删除数据表的事件 + + + +## 说明 + +为当前数据表添加 Delete 事件,当删除 Sheet 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheet.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ------- | ------ | ------- | +| sheetId | Number | 表的 Id | + +## 事件返回数据示例 + +``` +{ + sheetId: 2 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + let eventContext; + eventContext = await app.Sheets(1).OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Delete(true); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + let eventContext; + eventContext = Application.Sheets(1).OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Delete(true); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 57. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听重命名数据表的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename + +```markdown +# 监听重命名数据表的事件 + + + +## 说明 + +为当前数据表添加 Rename 事件,当被修改 Name 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnRename(Callback) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheet.OnRename(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ----------- | ------ | ------- | +| Sheet | Sheet | 表| +| originValue | String | 原表名 | +| value | String | 现表名 | + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const sheetName = app.Sheets(1).Name; + //这里会执行OnRename的回调 + sheetName = 'newName'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Name = 'newName'; + //这里会执行OnRename的回调 +} +main(); +``` + +``` + +## 58. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 新建数据表 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Add + +```markdown +# 新建数据表 +JSSDK: v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +新建数据表到指定位置,Before 和 After 只需要提供一个,另一个填 null 即可 + +## 语法 +表达式.Add(Before, After,Type,Config) + +表达式:Sheets + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|number/string|插入到Before(索引从1开始/数据表名)对应sheet之前| +|After|否|number/string|插入到After(索引从1开始/数据表名)对应sheet之后| +|Type|是|string|"xlEtFlexPaperSheet"(说明页面)(暂不支持)、"xlEtDataBaseSheet"(数据表)、"xlDbDashBoardSheet"(仪表盘)| +|Config|否|object|数据表专属配置,结构:Config:{ fields : Field[] , name ?: string , views ?: View[] };| +## 参数Config属性详解 +|属性名|是否必需|类型|描述| +|---|---|---|---| +|fields|否|Field[]|字段数组,Field类型结构:{fieldType: FieldType,args: { fieldName: string, fieldWidth: number, listItems?: { value: string, color: number}[], numberFormat?: string, maxRating?: number } }| +|name |否|string|数据表名,默认为‘data1’| +|views |否|View[]|视图配置数组,View结构:{name: string,type: ViewType},ViewType的取值为:'Grid'(网格视图)、'Kanban'(看板视图)、'Gallery'(相册视图)、'Form'(表单视图)、'Gantt'(甘特视图)、'Query'(查询视图)或'Calendar'(日历视图);默认创建'Grid'。暂只支持'Grid'和'Form'。| +## 返回值 +Sheet + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add( + null,1,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + Application.Sheets.Add( + 1,null,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +main() +``` +``` + +## 59. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 删除数据表 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Delete + +```markdown +# 删除数据表 + +## 说明 +通过索引位置或数据表名来删除指定表 + +## 语法 +表达式.Delete(Index) + +表达式: Sheets + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | ---------------------- | +| Index | 是 | number/string | 索引从 1 开始/数据表名 | + +## 返回值 +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Delete(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets.Delete(1); +} +main() +``` +``` + +## 60. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 移动数据表 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Move` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Move + +```markdown +# 移动数据表 + +## 说明 +移动数据表到指定位置,Before 和 After 只需要提供一个,另一个填 null 即可 + +## 语法 +表达式.Move(From, Before, After) + +表达式: Sheets + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | ---------------------------------------------------- | +| From | 是 | number/string | 待移动 sheet 的名称或索引号,从 1 开始 | +| Before | 是 | number/string | 移动到 Before(索引从 1 开始/数据表名)对应 sheet 之前 | +| After | 是 | number/string | 移动到 After(索引从 1 开始/数据表名)对应 sheet 之后 | + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Move(111111, null, 22222); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets.Move(111111, null, 22222); +} +main() +``` +``` + +## 61. 开发指南 / WPS多维表格开发 / API文档 / 数据表 / 监听增加数据表的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet + +```markdown +# 监听增加数据表的事件 + + + +## 说明 + +为当前数据表集合添加 CreateSheet 事件(当前只支持添加数据表事件,添加说明页和仪表盘不会触发该事件,后续版本更新后支持),当新增 sheet 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnCreateSheet(Callback) + +表达式: Sheets + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheets.OnCreateSheet(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| Sheet | Sheet | 表 | + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets.OnCreateSheet(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + await app.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + //这里会执行OnCreateSheet的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets.OnCreateSheet(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + //这里会执行OnCreateSheet的回调 +} +main(); +``` + +``` + +## 62. 开发指南 / WPS多维表格开发 / API文档 / 排序 / 设置排序升序属性 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending + +```markdown +# 设置排序升序属性 +Sort.IsAscending(属性) + + +## 说明 +可读写 + +设置排序升序或者降序 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +// 获取IsAscending属性 +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const isAscending = sorts(1).IsAscending; +} + +// 设置IsAscending属性 +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(1).Sorts(1).IsAscending = false; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const isAscending = sorts(1).IsAscending; + isAscending = false; +} +main() +``` +``` + +## 63. 开发指南 / WPS多维表格开发 / API文档 / 排序 / 添加排序条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_Add + +```markdown +# 添加排序条件 +Sorts.Add(方法) + +## 说明 +添加排序 + +## 语法 +表达式.Add(Field,IsAscending) + +表达式: Sorts + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ----------- | -------- | ------------- | ------------------------------------ | +| Field | 是 | number/string | 新增排序字段索引/新增排序字段 ID/新增排序字段名(名称要以@字符作为开始) | +| IsAscending | 否 | boolean | 是否为升序 | + +## 返回值 +Sort + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const res = sorts.Add(1); + //const res = sorts.Add('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const res = sorts.Add(1); + //const res = sorts.Add('B'); +} +main() +``` +``` + +## 64. 开发指南 / WPS多维表格开发 / API文档 / 排序 / 移动排序条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder + +```markdown +# 移动排序条件 + +Sorts.ChangeOrder(方法) + +## 说明 +移动排序条件(设置排序优先级) + +## 语法 +表达式.ChangeOrder(FromField, BeforeField, AfterField) + +表达式: Sorts + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ----------------- | --------------------------------- | +| FromField | 是 | [string] | 要移动的排序字段的字段ID/要移动的排序字段的字段名称(名称要以@字符作为开始) | +| BeforeField | 否 | [string] | 目标位置前的排序字段ID/目标位置前的排序字段名称(名称要以@字符作为开始) | +| AfterField | 否 | [string] | 目标位置后的排序字段ID/目标位置后的排序字段名称(名称要以@字符作为开始) | + +FromField、BeforeField和AfterField必须都是已设置的排序条件字段,BeforeField和AfterField至少需要传入一个,如果BeforeField和AfterField同时存在以BeforeField作为应用参数 + +比如表格视图中已设置的排序条件在排序面板中从上到下依次为【公式,日期,名称,数量】 +现在想将名称这条排序条件移动到日期的前面,结果变为【公式,名称,日期,数量】,就可以用以下方式实现 +``` +await WPSOpenApi.Application.Sheets(1).Views(1).Sorts.ChangeOrder('@名称', '@日期') +``` +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + // 将公式排序条件移动到日期排序条件的后面 + const res = await sorts.ChangeOrder('@公式', undefined, '@日期'); + if (res.Code === 0) { + console.log("设置排序优先级成功") + } else { + console.error("设置排序优先级失败" + res.Message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + // 将公式排序条件移动到日期排序条件的后面 + const res = sorts.ChangeOrder('@公式', undefined, '@日期'); + if (res.Code === 0) { + console.log("设置排序优先级成功") + } else { + console.error("设置排序优先级失败" + res.Message) + } +} +main() +``` +``` + +## 65. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 合并表-添加数据源 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add + +```markdown +# 添加数据源 +SummarySourceConfigs.Add(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +合并表配置对象中添加数据源(只是编辑的本地对象,需要调Apply方法才能更新到云上) + +## 语法 +表达式.Add(File,Sheets) + +表达式:SummarySourceConfigs + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|File|是|String|文件id/文件url| +|Sheets|是|Number/String[]|数据表数组,支持两种形式,表名和索引(从1开始)| + + +## 返回值 +SummarySourceConfig + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Add("100136699885", [1, 2]) + // 返回配置文件的id + console.log(await config.FileId) + // 返回文件下选中的数据表id数组 + console.log(await config.SheetIds) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Add("100136699885", [1, 2]) + // 返回配置文件的id + console.log(config.FileId) + // 返回文件下选中的数据表id数组 + console.log(config.SheetIds) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 66. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 合并表-删除数据源 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete + +```markdown +# 删除数据源 +SummarySourceConfigs.Delete(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +合并表配置对象中删除数据源(只是编辑的本地对象,需要调Apply方法才能更新到云上) + +## 语法 +表达式.Delete(Index) + +表达式:SummarySourceConfigs + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|Number/String|支持索引、文件id和文件url| + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + await configs.Delete(1) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + configs.Delete(1) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 67. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 刷新数据 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet + +```markdown +# 刷新数据 +SyncDBSheet.RefreshSyncSheet(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +刷新数据 + +## 语法 +表达式.RefreshSyncSheet() + +表达式:SyncDBSheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = await app.ActiveSheet + await syncSheet.RefreshSyncSheet() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = Application.ActiveSheet + syncSheet.RefreshSyncSheet() +} +main() +``` +``` + +## 68. 开发指南 / WPS多维表格开发 / API文档 / 同步数据 / 解除同步关系 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink + +```markdown +# 解除同步关系 +SyncDBSheet.RemoveSheetSyncLink(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +解除同步关系 + +## 语法 +表达式.RemoveSheetSyncLink() + +表达式:SyncDBSheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = await app.ActiveSheet + await syncSheet.RemoveSheetSyncLink() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = Application.ActiveSheet + syncSheet.RemoveSheetSyncLink() +} +main() +``` +``` + +## 69. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 复制视图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Copy + +```markdown +# 复制视图 + +## 说明 +复制视图 + +## 语法 +表达式.Copy() + +表达式:View + +## 参数 + + +## 返回值 +View + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const result = await view.Copy(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const result = view.Copy(); +} +main() +``` +``` + +## 70. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 删除视图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Delete + +```markdown +# 删除视图 + +## 说明 +删除指定视图 + +## 语法 +表达式.Delete() + +表达式:View + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + await view.Delete(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + view.Delete(); +} +main() +``` +``` + +## 71. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 设置快速访问视图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_IsFavView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_IsFavView + +```markdown +# 设置快速访问视图 + +View.IsFavView + +## 说明 +可读写 +设置视图是否为快速访问视图 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function getFavView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const isFavView = await view.IsFavView; // 若为快速访问视图返回true,若不为快速访问视图返回false +} + +async function setFavView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.IsFavView = false; // 取消设置为快速访问视图 + view.IsFavView = true; // 设置为快速访问视图 +} +``` + +## 脚本编辑器 示例 +``` javascript +function getFavView() { + const view = Application.Sheets(1).Views(1); + const isFavView = view.IsFavView; // 若为快速访问视图返回true,若不为快速访问视图返回false +} +function setFavView() { + const view = Application.Sheets(1).Views(1); + view.IsFavView = false; // 取消设置为快速访问视图 + view.IsFavView = true; // 设置为快速访问视图 +} +main(); +``` +``` + +## 72. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 设置个人/公共视图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_IsPersonal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_IsPersonal + +```markdown +# 设置个人/公共视图 + +View.IsPersonal + +## 说明 +可读写 +设置视图为个人视图或公共视图 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function getPublicView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const isPersonal = await view.IsPersonal; // 若为个人视图返回true,若不为公共视图返回false + return !isPersonal; +} + +async function setPublicView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.IsPersonal = false; // 设置为公共视图 + view.IsPersonal = true; // 设置为个人视图 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const isPublicView = !view.IsPersonal; + view.IsPersonal = false; // 设置为公共视图 + view.IsPersonal = true; // 设置为个人视图 +} +main() +``` +``` + +## 73. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 重命名 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Name + +```markdown +# 重命名 + + +## 说明 +重命名、 获取视图名称 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +// 获取视图名称 +async function getName() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const name = await view.Name; +} +// 设置视图名称 +async function setName() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.Name = '新视图名称'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const name = view.Name; + view.Name = '新视图名称'; +} +main() +``` +``` + +## 74. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听删除视图的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_OnDelete + +```markdown +# 监听删除视图的事件 +View.OnDelete(方法) + + + +## 说明 + +为当前视图添加 Delete 事件,当删除 View 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: View + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await View.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ------- | ------ | --------- | +| sheetId | Number | 表的 Id | +| viewId | String | 视图的 Id | + +## 事件返回数据示例 + +``` +{ + sheetId: 1 + viewId: 'B' +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).Delete(); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).Delete(); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 75. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听重命名视图的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_OnRename` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_OnRename + +```markdown +# 监听重命名视图的事件 +View.OnRename(方法) + + + +## 说明 + +为当前视图添加 Rename 事件,当被修改 Name 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnRename(Callback) + +表达式: View + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await View.OnRename(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ----------- | ------ | --------- | +| View | View | 视图 | +| originValue | String | 原始值 | +| value | String | 修改后的值 | + +## 事件返回数据示例 + +View, originValue, value + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const sheetName = app.Sheets(1).Views(1).Name; + sheetName = 'newName'; + //这里会执行OnRename的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).Name = 'newName'; + //这里会执行OnRename的回调 +} +main(); +``` + +``` + +## 76. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 新建视图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_Add + +```markdown +# 新建视图 + +## 说明 +添加视图 + +## 语法 +表达式.Add(Type,Name) + +表达式:Views + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ----------------------------------------------------- | -------- | +| Type | 是 | 'Grid'或'Kanban'或'Gallery'或'Form'或’Query‘或‘Gantt’ | 视图类别。| +| Name | 是 | string | 视图名称 | + +## 返回值 +[View](/app-integration-dev/guide/dbsheet/Api/View), [GridView](/app-integration-dev/guide/dbsheet/Api/GridView), [GanttView](/app-integration-dev/guide/dbsheet/Api/GanttView) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; + + const gridView = await views.Add('Grid', '表格视图'); + console.log(await gridView.RowHeight); + await views.Add('Kanban', '看板视图'); + await views.Add('Gallery', '画册视图'); + await views.Add('Form', '表单视图'); + await views.Add('Query', '查询视图'); + const ganttView = await views.Add('Gantt', '甘特视图'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const views = Application.Sheets(1).Views; + const gridView = views.Add('Grid', '表格视图'); + console.log(gridView.RowHeight); + views.Add('Kanban', '看板视图'); + views.Add('Gallery', '画册视图'); + views.Add('Form', '表单视图'); + views.Add('Query', '查询视图'); + const ganttView = views.Add('Gantt', '甘特视图'); +} +main() +``` +``` + +## 77. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 监听增加视图的事件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_OnCreate + +```markdown +# 监听增加视图的事件 +Views.OnCreate(方法) + + + +## 说明 + +为 Views 添加 Create 事件,当添加 View 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnCreate(Callback) + +表达式: Views + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Views.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +View + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).Views.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + + await app.Sheets(1).Views.Add('Grid', '表格视图'); + //这里会执行OnCreate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).Views.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views.Add('Grid', '表格视图'); + //这里会执行OnCreate的回调 +} +main(); +``` + +``` + +## 78. 开发指南 / WPS多维表格开发 / API文档 / 其他 / 代理界面元素 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_BailHook` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_BailHook + +```markdown +# 代理界面元素 +Window.BailHook(方法) + + + +## 说明 + +对特定的界面元素进行代理,代理方法返回true时,则不显示原界面 + +## 语法 + +表达式.BailHook(CmbId) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| CmbId | 是 | string | 界面元素ID,目前支持 `RecordInfo`(记录详情卡片) | + + + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + + const hook = await app.Window.BailHook("RecordInfo") + hook.InvokeSingle((params)=>{ + console.log(params) // 移动端返回参数 {recordId: 'Jp', activeFieldId: 'E'} + // pc端返回参数 {recordId: 'Jp', isShowComment: false} + // 移动端和PC端 用到的参数都是 recordId,其它参数是界面区别 + // 可以通过 await WPSOpenApi.Application.ActiveView.RecordRange(params.recordId).Value 读取记录的数据 + const count = await Application.ActiveView.RecordRange.Count + const record = Application.ActiveView.RecordRange(params.recordId) + const values = await record.Value + const index = await record.Index // 注意 Index base 1, 可能有多条记录,返回 [index] + const prevRecord = Application.ActiveView.RecordRange(index.map(_=> _ - 1)) + const nextRecord = Application.ActiveView.RecordRange(index.map(_=> _ + 1)) + // 在这里实现自定义的界面逻辑,替换掉原来的界面 + record.Select() + return true // return true 会不弹出原界面 + }) +} +``` +``` + +## 79. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 展开记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord + +```markdown +# 展开记录 + + + +## 说明 + +当前窗口下展开记录,显示详情信息 + +## 语法 + +表达式.DisplayRecord(RecodId) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| RecodId | 否 | String | 展开的记录ID | + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.DisplayRecord("B"); +} +``` +``` + +## 80. 开发指南 / WPS多维表格开发 / API文档 / 记录 / 关闭记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord + +```markdown +# 关闭当前展开的记录 + + + +## 说明 + +关闭当前展开的记录 + +## 语法 + +表达式.HiddenAllRecord() + +表达式: Window + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.HiddenAllRecord(); +} +``` +``` + +## 81. 开发指南 / WPS多维表格开发 / API文档 / 其他 / 窗口导航栏 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_Navigator` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_Navigator + +```markdown +# 窗口导航栏 +Window.Navigator(属性) + + +## 说明 +返回窗口导航栏对象信息 + +## 返回值 +Navigator + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator +} +``` +``` + +## 82. 开发指南 / WPS多维表格开发 / API文档 / 公告 / 窗口公告栏 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar + +```markdown +# 窗口公告栏 +Window.NoticeBar(属性) + + +## 说明 +返回窗口公告栏对象信息 + +## 返回值 +NoticeBar + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar +} +``` +``` + +## 83. 开发指南 / WPS多维表格开发 / API文档 / 其他 / 设置经典布局 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_SetLayout` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_SetLayout + +```markdown +# 设置经典布局 +Window.SetLayout(方法) + + + +## 说明 + +设置该视图是否为经典布局 + +## 语法 + +表达式.SetLayout(isClassic) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| isClassic | 是 | Boolean | 是否为经典布局 | + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.SetLayout(true); + await app.Window.SetLayout(false); +} +``` +``` + +## 84. 开发指南 / WPS多维表格开发 / API文档 / API / AddressField / AddressField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField + +```markdown +# AddressField (对象) + + +## 说明 +AddressField 地址字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非地址字段,无法设置相关属性 + +## 属性 +- [IsDetailedAddress](/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress) +- [IsUsePresetAddress](/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress) +- [Level](/app-integration-dev/guide/dbsheet/Api/AddressField_Level) +- [PresetAddress](/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldDescriptor = await app.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.Text = "Get it" + fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.Text = "Get it" + fieldDescriptor.Apply() + } +main() +``` +``` + +## 85. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 填写详细地址 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress + +```markdown +# 填写详细地址 +AddressField.IsDetailedAddress(属性) + + +## 说明 +可读写 + +地址字段是否需要填写详细地址 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsDetailedAddress = false + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsDetailedAddress = false + fieldDescriptor.Apply() +} +main() +``` +``` + +## 86. 开发指南 / WPS多维表格开发 / API文档 / API / AddressField / IsDetailedAddress + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_IsDetailedAddress + +```markdown +# 填写详细地址 +AddressField.IsDetailedAddress(属性) + + +## 说明 +可读写 + +地址字段是否需要填写详细地址 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsDetailedAddress = false + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsDetailedAddress = false + fieldDescriptor.Apply() +} +main() +``` +``` + +## 87. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 预设指定地址 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress + +```markdown +# 预设指定地址 +AddressField.IsUsePresetAddress(属性) + + +## 说明 +可读写 + +地址字段 是否预设指定地址,当设置了IsUsePresetAddress为false后,PresetAddress不生效 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsUsePresetAddress = false + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsUsePresetAddress = false + fieldDescriptor.Apply() +} +main() +``` +``` + +## 88. 开发指南 / WPS多维表格开发 / API文档 / API / AddressField / IsUsePresetAddress + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_IsUsePresetAddress + +```markdown +# 预设指定地址 +AddressField.IsUsePresetAddress(属性) + + +## 说明 +可读写 + +地址字段 是否预设指定地址,当设置了IsUsePresetAddress为false后,PresetAddress不生效 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsUsePresetAddress = false + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsUsePresetAddress = false + fieldDescriptor.Apply() +} +main() +``` +``` + +## 89. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 地址级别数 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_Level` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_Level + +```markdown +# 地址级别数 +AddressField.Level(属性) + + +## 说明 +可读写 + +地址字段格式包含几级地址,1-5级 +|级数|示例| +|----|----| +|1 | 省 - 详细地址 | +|2 | 省/市 - 详细地址| +|3 | 省/市/区 - 详细地址| +|4 | 省/市/区/街道 - 详细地址| +|5 | 省/市/区/街道/社区 - 详细地址| + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.Level = 5 + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.Level = 5 + fieldDescriptor.Apply() +} +main() +``` +``` + +## 90. 开发指南 / WPS多维表格开发 / API文档 / API / AddressField / Level + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_Level` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_Level + +```markdown +# 地址级别数 +AddressField.Level(属性) + + +## 说明 +可读写 + +地址字段格式包含几级地址,1-5级 +|级数|示例| +|----|----| +|1 | 省 - 详细地址 | +|2 | 省/市 - 详细地址| +|3 | 省/市/区 - 详细地址| +|4 | 省/市/区/街道 - 详细地址| +|5 | 省/市/区/街道/社区 - 详细地址| + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.Level = 5 + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.Level = 5 + fieldDescriptor.Apply() +} +main() +``` +``` + +## 91. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 默认值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress + +```markdown +# 默认值 +AddressField.PresetAddress(属性) + + +## 说明 +可读写 + +地址字段的默认值,当设置了IsUsePresetAddress为false后,PresetAddress不生效 + +## 返回值 +Object + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsUsePresetAddress = true + prop.PresetAddress = {detail:"", districts:["广东省","江门市"]} + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsUsePresetAddress = true + prop.PresetAddress = {detail:"", districts:["广东省","江门市"]} + fieldDescriptor.Apply() +} +main() +``` +``` + +## 92. 开发指南 / WPS多维表格开发 / API文档 / API / AddressField / PresetAddress + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_PresetAddress + +```markdown +# 默认值 +AddressField.PresetAddress(属性) + + +## 说明 +可读写 + +地址字段的默认值,当设置了IsUsePresetAddress为false后,PresetAddress不生效 + +## 返回值 +Object + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = await fieldDescriptor.Address + prop.IsUsePresetAddress = true + prop.PresetAddress = {detail:"", districts:["广东省","江门市"]} + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@地址") + const prop = fieldDescriptor.Address + prop.IsUsePresetAddress = true + prop.PresetAddress = {detail:"", districts:["广东省","江门市"]} + fieldDescriptor.Apply() +} +main() +``` +``` + +## 93. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_getValue + +```markdown +# 获取地址字段类型值 + +## 说明 +获取 地址字段 类型值 + +## 返回 +`object` 结构,结构如下: + +### object结构 +|key|值类型|说明| +|---|---|---| +|districts|string[]|省市区| +|detail|string|详细地址| + + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@地址").Value + console.log(value) + /** + * 输出值: + * { + * districts: ["广东省","珠海市","香洲区"], + * detail: "前岛环路xxxx号" + * } + */ +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@地址").Value + console.log(value) +} +main() +``` +``` + +## 94. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 地址字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AddressField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AddressField_setValue + +```markdown +# 设置地址字段类型值 + +## 说明 +设置 地址字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置地址字段值 + app.Sheets(1).Views(1).RecordRange(1, "@关联").Value = await Application.DBCellValue({ + districts:["广东省","珠海市","香洲区"], + detail:"前岛环路xxxx号" + }) + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置关联字段值,参数为传入关联的记录id + Application.Sheets(1).Views(1).RecordRange(1, "@联系人").Value = Application.DBCellValue({ + districts:["广东省","珠海市","香洲区"], + detail:"前岛环路xxxx号" + }) +} +main() +``` +``` + +## 95. 开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / ApiResult对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ApiResult + +```markdown +# ApiResult (对象) + + +## 说明 +API调用后的返回值 + +## 方法 + + +## 属性 +* [Code](/app-integration-dev/guide/dbsheet/Api/ApiResult_Code) +* [Message](/app-integration-dev/guide/dbsheet/Api/ApiResult_Message) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const result = await field.Move(3) + console.log(result.Code) + console.log(result.Message) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const result = field.Move(3) + console.log(result.Code) + console.log(result.Message) + } +main() +``` + +``` + +## 96. 开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / Code + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult_Code` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ApiResult_Code + +```markdown +# API调用返回执行结果Code +ApiResult.Code(属性) + + +## 说明 +只读 +API调用返回执行结果 + +## 返回值 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const result = await field.Move(3) + if(result.Code !== 0) { + console.log(result.Message) + } +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const result = field.Move(3) + if(result.Code !== 0) { + console.log(result.Message) + } +} +main() +``` +``` + +## 97. 开发指南 / WPS多维表格开发 / API文档 / API / ApiResult / Message + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ApiResult_Message` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ApiResult_Message + +```markdown +# API调用返回执行结果Message +ApiResult.Message(属性) + + +## 说明 +只读 +API调用返回执行结果 + +## 返回值 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const result = await field.Move(3) + if(result.Code !== 0) { + console.log(result.Message) + } +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const result = field.Move(3) + if(result.Code !== 0) { + console.log(result.Message) + } +} +main() +``` +``` +``` + +## 98. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / Attachment对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment + +```markdown +# Attachment (对象) + + +## 说明 +图片和附件字段返回的数据结构,可以通过里面的属性读取文件的信息和地址 + +## 方法 + + +## 属性 +* [FileId](/app-integration-dev/guide/dbsheet/Api/Attachment_FileId) +* [FileName](/app-integration-dev/guide/dbsheet/Api/Attachment_FileName) +* [FileSize](/app-integration-dev/guide/dbsheet/Api/Attachment_FileSize) +* [FileType](/app-integration-dev/guide/dbsheet/Api/Attachment_FileType) +* [ImgSize](/app-integration-dev/guide/dbsheet/Api/Attachment_ImgSize) +* [LinkUrl](/app-integration-dev/guide/dbsheet/Api/Attachment_LinkUrl) +* [Source](/app-integration-dev/guide/dbsheet/Api/Attachment_Source) +* [ThumbnailsUrl](/app-integration-dev/guide/dbsheet/Api/Attachment_ThumbnailsUrl) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbCellValue = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await dbCellValue.Value + console.log(await attments[0].FileName) + } +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const dbCellValue = Application.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = dbCellValue.Value + console.log(attments[0].FileName) + } +main() +``` + +``` + +## 99. 开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / AttachmentField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField + +```markdown +# AttachmentField (对象) + + +## 说明 +AttachmentField 图片和附件字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非图片和附件字段,无法设置相关属性 + +## 属性 +* [DisplayStyle](/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle) +* [IsOnlyCameraUpload](/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@图片和附件") + const prop = await field.Attachment + prop.DisplayStyle = "Pic" + prop.IsOnlyCameraUpload = false + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main(){ + const field = Application.Sheets(1).FieldDescriptors("@图片和附件") + const prop = field.Attachment + prop.DisplayStyle = "Pic" + prop.IsOnlyCameraUpload = true + field.Apply() +} +main() +``` +``` + +## 100. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 设置显示样式 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle + +```markdown +# 设置显示样式 +AttachmentField.DisplayStyle(属性) + + +## 说明 +可读写 + +图片和附件字段的显示样式,是以缩略图样式显示还是以列表的样式显示 + +## 返回值 +Enum.DbAttachmentDisplayStyle + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@图片和附件") + const prop = await field.Attachment + prop.DisplayStyle = "Pic" + field.Apply() + console.log(await prop.DisplayStyle) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@图片和附件") + const prop = field.Attachment + prop.DisplayStyle = "List" + field.Apply() +} +main() +``` +``` + +## 101. 开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / DisplayStyle + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_DisplayStyle + +```markdown +# 设置显示样式 +AttachmentField.DisplayStyle(属性) + + +## 说明 +可读写 + +图片和附件字段的显示样式,是以缩略图样式显示还是以列表的样式显示 + +## 返回值 +Enum.DbAttachmentDisplayStyle + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@图片和附件") + const prop = await field.Attachment + prop.DisplayStyle = "Pic" + field.Apply() + console.log(await prop.DisplayStyle) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@图片和附件") + const prop = field.Attachment + prop.DisplayStyle = "List" + field.Apply() +} +main() +``` +``` + +## 102. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 仅可通过移动端拍摄上传 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload + +```markdown +# 仅可通过移动端拍摄上传 +AttachmentField.IsOnlyCameraUpload(属性) + + +## 说明 +可读写 + +图片和附件字段是否仅可通过移动端拍摄上传 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@图片和附件") + const prop = await field.Attachment + prop.IsOnlyCameraUpload = true + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@图片和附件") + const prop = field.Attachment + prop.IsOnlyCameraUpload = true + field.Apply() +} +main() +``` +``` + +## 103. 开发指南 / WPS多维表格开发 / API文档 / API / AttachmentField / IsOnlyCameraUpload + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_IsOnlyCameraUpload + +```markdown +# 仅可通过移动端拍摄上传 +AttachmentField.IsOnlyCameraUpload(属性) + + +## 说明 +可读写 + +图片和附件字段是否仅可通过移动端拍摄上传 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@图片和附件") + const prop = await field.Attachment + prop.IsOnlyCameraUpload = true + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@图片和附件") + const prop = field.Attachment + prop.IsOnlyCameraUpload = true + field.Apply() +} +main() +``` +``` + +## 104. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_getValue + +```markdown +# 获取图片与附件字段类型值 + +## 说明 +获取 图片与附件字段 类型值 + +## 返回 + +[Attachment](/app-integration-dev/guide/dbsheet/Api/Attachment) 数据结构,结构如下: + +### Attachment结构 +|key|值类型|说明| +|---|---|---| +|FileId|string|附件字段的Id| +|fileName|string|附件名称| +|FileSize|number|附件大小| +|FileType|string|附件类型| +|ImgSize|string|图片的尺寸| +|LinkUrl|string|附件的链接地址,如果是云文档则返回云文档的地址,如果是图片则返回图片的下载地址| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@图片与附件").Value + console.log(value) + /** + * 输出值: + * { + * FileId: "GCN3WSY5ADQAI", + * FileName: "11.png" + * FileSize: 10052 + * FileType: "image/png" + * ImgSize: "120*120" + * } + */ +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@图片与附件").Value + console.log(value) +} +main() +``` +``` + +## 105. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 图片和附件字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AttachmentField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AttachmentField_setValue + +```markdown +# 设置图片与附件类型值 + +## 说明 +设置 图片与附件字段 类型值 + +## 语法 +``` +DBCellValue([{ + fileData: "", + fileName: "", +}]) +``` + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|fileData|是|string|支持2种类型:`base64` 或 `云文档链接`| +|fileName|是|string|附件名称| + + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置云文档类型 + app.Sheets(1).Views(1).RecordRange(2, "@图片和附件").Value = await Application.DBCellValue([{ + fileData: "https://kdocs.cn/l/csGRGIzv9PvF", + fileName: "11.png", + }]) + // 设置base64 + app.Sheets(1).Views(1).RecordRange(2, "@图片和附件").Value = await Application.DBCellValue([{ + fileData: url/base64, + fileName: "11.png", + }]) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置云文档类型 + Application.Sheets(1).Views(1).RecordRange(2, "@图片和附件").Value = Application.DBCellValue([{ + fileData: "https://kdocs.cn/l/csGRGIzv9PvF", + fileName: "11.png", + }]) + // 设置base64 + Application.Sheets(1).Views(1).RecordRange(2, "@图片和附件").Value = Application.DBCellValue([{ + fileData: url/base64, + fileName: "11.png", + }]) +} +main() +``` +``` + +## 106. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_FileId + +```markdown +# Attachment.FileId(属性) + + +## 说明 +只读 +返回附件字段的Id + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].FileId) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].FileId) +} +main() +``` +``` + +## 107. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileName + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileName` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_FileName + +```markdown +# Attachment.FileName(属性) + + +## 说明 +只读 +返回附件名称 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].FileName) +} +``` +## 脚本编辑器 示例 +``` javascript +function main(){ + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].FileName) +} +main() +``` +``` + +## 108. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileSize + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileSize` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_FileSize + +```markdown +# Attachment.FileSize(属性) + + +## 说明 +只读 +返回附件大小 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].FileSize) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].FileSize) +} +main() +``` +``` + +## 109. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / FileType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_FileType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_FileType + +```markdown +# Attachment.FileType(属性) + + +## 说明 +只读 +返回附件类型 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].FileType) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].FileType) +} +main() +``` +``` + +## 110. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / ImgSize + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_ImgSize` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_ImgSize + +```markdown +# Attachment.ImgSize(属性) + + +## 说明 +只读 +返回图片的尺寸 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].ImgSize) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].ImgSize) +} +main() +``` +``` + +## 111. 开发指南 / WPS多维表格开发 / API文档 / API / Attachment / LinkUrl + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Attachment_LinkUrl` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Attachment_LinkUrl + +```markdown +# Attachment.LinkUrl(属性) + + +## 说明 +只读 +返回附件的链接地址,如果是云文档则返回云文档的地址,如果是图片则返回图片的下载地址 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await value.Value + console.log(await attments[0].LinkUrl) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = ActiveView.RecordRange(1, "@图片和附件").Value + const attments = value.Value + console.log(attments[0].LinkUrl) +} +main() +``` +``` + +## 112. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / AutoLinkCondition对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition + +```markdown +# AutoLinkCondition (对象) + + +## 说明 +单向关联和双向关联字段的自动匹配条件 + +## 方法 + + +## 属性 +* [LinkSheetFieldId](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_LinkSheetFieldId) +* [SheetCondContents](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondContents) +* [SheetCondType](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondType) +* [OpType](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_OpType) +* [IntersectedConds](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_IntersectedConds) +* [DateIntersectedValues](/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_DateIntersectedValues) + + +## 浏览器环境示例 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.LinkSheetFieldId) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.LinkSheetFieldId) + } +main() +``` +``` + +## 113. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / DateIntersectedValues + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_DateIntersectedValues` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_DateIntersectedValues + +```markdown +# AutoLinkCondition.DateIntersectedValues(属性) + + +## 说明 +可读写 + +自动匹配条件日期指定值的特殊参数 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.DateIntersectedValues) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.DateIntersectedValues) + } +main() +``` +``` + +## 114. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / IntersectedConds + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_IntersectedConds` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_IntersectedConds + +```markdown +# AutoLinkCondition.IntersectedConds(属性) + + +## 说明 +可读写 + +自动匹配条件,供“指定值”用的显示文本 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.IntersectedConds) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.IntersectedConds) + } +main() +``` +``` + +## 115. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / LinkSheetFieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_LinkSheetFieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_LinkSheetFieldId + +```markdown +# AutoLinkCondition.LinkSheetFieldId(属性) + + +## 说明 +可读写 + +单向关联和双向关联字段的自动匹配条件,关联的数据表字段Id + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.LinkSheetFieldId) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.LinkSheetFieldId) + } +main() +``` +``` + +## 116. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / OpType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_OpType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_OpType + +```markdown +# AutoLinkCondition.OpType(属性) + + +## 说明 +可读写 + +自动匹配条件的操作符 + +## 返回值 +DbFilterCriteriaOpType + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.OpType) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.OpType) + } +main() +``` +``` + +## 117. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / SheetCondContents + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondContents` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondContents + +```markdown +# AutoLinkCondition.SheetCondContents(属性) + + +## 说明 +可读写 + +单向关联和双向关联字段的自动匹配条件 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.SheetCondContents) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.SheetCondContents) + } +main() +``` +``` + +## 118. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkCondition / SheetCondType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkCondition_SheetCondType + +```markdown +# AutoLinkCondition.SheetCondType(属性) + + +## 说明 +可读写 + +单向关联和双向关联字段的自动匹配条件 + +## 返回值 +DbAutolinkCondType + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.SheetCondType) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions(1) + console.log(condition.SheetCondType) + } +main() +``` +``` + +## 119. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / AutoLinkConditions对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions + +```markdown +# AutoLinkConditions (对象) + + +## 说明 +单向关联和双向关联字段的匹配条件集合 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Add) +* [Delete](/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Delete) + + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = await group.Conditions + console.log(await Conditions.Count) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = group.Conditions + console.log(Conditions.Count) + } +main() +``` +``` + +## 120. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Add + +```markdown +# AutoLinkConditions.Add(方法) + +## 说明 +添加单向关联和双向关联字段的自动匹配条件 + +## 语法 +表达式.Add(LinkSheetFieldId,SheetCondContents,SheetCondType,OpType,IntersectedConds,DateIntersectedValues) + +表达式:AutoLinkConditions + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|LinkSheetFieldId|是|string|引用表的字段ID| +|SheetCondContents|否|string|| +|SheetCondType|否|DbAutolinkCondType|关联类型| +|OpType|否|DbFilterCriteriaOpType|自动匹配条件的关系| +|IntersectedConds|否|{type: string,value: string,content: string,year: number,mon: number,mday: number,hour: number,min: number,sec: number}|供“指定值”用的显示文本| +|DateIntersectedValues|否|{type: string,value: string,content: string,year: number,mon: number,mday: number,hour: number,min: number,sec: number}|日期指定值的特殊参数| + + +## 返回值 +AutoLinkCondition + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const linkField = await sheet.FieldDescriptors(3) + const linkGroups = await Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + const fieldId = sheet.FieldId("状态") + conditions.Add(fieldId, [fieldId], "Field", "Equals") + linkField.AutoLinkGroups = linkGroups + linkField.IsAutoLink = true + linkField.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main(){ + const sheet = Application.Sheets(1) + const linkField = sheet.FieldDescriptors(3) + const linkGroups = Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + const fieldId = sheet.FieldId("状态") + const condition = conditions.Add(fieldId, [fieldId], "Field", "Equals") + linkField.AutoLinkGroups = linkGroups + linkField.IsAutoLink = true + const result = linkField.Apply() + console.log("####", result) +} +main() +``` +``` + +## 121. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Count + +```markdown +# AutoLinkConditions.Count(属性) + + +## 说明 +可读 +单向关联和双向关联字段的匹配条件集合数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = await group.Conditions + console.log(await Conditions.Count) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = group.Conditions + console.log(Conditions.Count) +} +main() +``` +``` + +## 122. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Delete + +```markdown +# AutoLinkConditions.Delete(方法) + +## 说明 +删除单向关联和双向关联字段自动匹配条件 + +## 语法 +表达式.Delete(Index) + +表达式:AutoLinkConditions + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|Number|索引| + + +## 返回值 +无 + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const conditions = await groups.Conditions + await conditions.Delete(1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const conditions = groups.Conditions + conditions.Delete(1) + } +main() +``` +``` + +## 123. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkConditions / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkConditions_Item + +```markdown +# AutoLinkConditions.Item(方法) + +## 说明 +单向关联和双向关联字段自动匹配条件 + +## 语法 +表达式.Item(Index) + +表达式:AutoLinkConditions + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|Number|索引| + + +## 返回值 +AutoLinkCondition + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = await group.Conditions.Item(1) + console.log(condition) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const condition = group.Conditions.Item(1) + console.log(condition) + } +main() +``` + +``` + +## 124. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroup / AutoLinkGroup对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup + +```markdown +# AutoLinkGroup (对象) + + +## 说明 +关联字段条件集合 + +## 方法 + + +## 属性 +* [Conditions](/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup_Conditions) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = await group.Conditions + console.log(await Conditions.Count) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = group.Conditions + console.log(Conditions.Count) + } +main() +``` +``` + +## 125. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroup / Conditions + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup_Conditions` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroup_Conditions + +```markdown +# AutoLinkGroup.Conditions(属性) + + +## 说明 +可读写 + +关联字段自动匹配条件集合 + +## 返回值 +AutoLinkConditions + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const group = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = await group.Conditions + console.log(await Conditions.Count) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const group = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups(1) + const Conditions = groups.Conditions + console.log(Conditions.Count) +} +main() +``` +``` + +## 126. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / AutoLinkGroups对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups + +```markdown +# AutoLinkGroups (对象) + + +## 说明 +关联字段的关系组集合,如果有多个关系组,则这些关系组是或的关系 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Add) +* [Delete](/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Delete) + + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const linkField = await sheet.FieldDescriptors(3) + const linkGroups = await Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + const fieldId = sheet.FieldId("状态") + conditions.Add(fieldId, [fieldId], "Field", "Equals") + linkField.AutoLinkGroups = linkGroups + linkField.IsAutoLink = true + linkField.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main(){ + const sheet = Application.Sheets(1) + const linkField = sheet.FieldDescriptors(3) + const linkGroups = Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + const fieldId = sheet.FieldId("状态") + const condition = conditions.Add(fieldId, [fieldId], "Field", "Equals") + linkField.AutoLinkGroups = linkGroups + linkField.IsAutoLink = true + const result = linkField.Apply() + console.log("####", result) +} +main() +``` +``` + +## 127. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Add + +```markdown +# AutoLinkGroups.Add(方法) + +## 说明 +增加关联字段匹配条件组 + +## 语法 +表达式.Add() + +表达式:AutoLinkGroups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +AutoLinkGroup + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const autoLinkGroups = await app.AutoLinkGroups() + const count = await autoLinkGroups.Count + if (count === 0) { + const group = autoLinkGroups.Add() + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const autoLinkGroups = Application.AutoLinkGroups() + const count = autoLinkGroups.Count + if (count === 0) { + const group = autoLinkGroups.Add() + } + } +main()``` + +``` + +## 128. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Count + +```markdown +# AutoLinkGroups.Count(属性) + + +## 说明 +可读 +关联字段自动匹配条件组的数量 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const autoLinkGroups = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups + const count = await autoLinkGroups.Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const autoLinkGroups = Applicaiton.Sheets(1).FieldDescriptors(2).AutoLinkGroups + const count = autoLinkGroups.Count + } +main() +``` +``` + +## 129. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Delete + +```markdown +# AutoLinkGroups.Delete(方法) + +## 说明 +删除关系字段自动匹配条件组 + +## 语法 +表达式.Delete(Index) + +表达式:AutoLinkGroups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|[object Object]|索引值| + + +## 返回值 + + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const groups = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups + groups.Delete(1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const groups = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups + groups.Delete(1) +} +main()``` + +``` + +## 130. 开发指南 / WPS多维表格开发 / API文档 / API / AutoLinkGroups / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutoLinkGroups_Item + +```markdown +# AutoLinkGroups.Item(方法) + +## 说明 +返回关联字段自动匹配条件组 + +## 语法 +表达式.Item(Index) + +表达式:AutoLinkGroups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|[object Object]|索引值| + + +## 返回值 +AutoLinkGroup + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const autoLinkGroups = await app.Sheets(1).FieldDescriptors(2).AutoLinkGroups + const count = await autoLinkGroups.Count + if (count > 0) { + const group = await autoLinkGroups.Item(1) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const autoLinkGroups = Application.Sheets(1).FieldDescriptors(2).AutoLinkGroups + const count = autoLinkGroups.Count + if (count > 1) { + const group = autoLinkGroups.Item(1) + } + } +main()``` + +``` + +## 131. 开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / AutomationField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField + +```markdown +# AutomationField (对象) + + +## 说明 +AutomationField 自动任务字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非自动任务字段,无法设置相关属性 + +## 属性 +* [Type](/app-integration-dev/guide/dbsheet/Api/AutomationField_Type) +* [TriggerField](/app-integration-dev/guide/dbsheet/Api/AutomationField_TriggerField) +* [ContactField](/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField) +* [ExecuteTime](/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const sheet = Application.Sheets(1) + const field = sheet.FieldDescriptors(11) + const automation = field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +main() +``` +``` + +## 132. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 通知联系人 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField + +```markdown +# 通知联系人 +AutomationField.ContactField(属性) + + + +## 说明 + +可读写 + +自动任务字段的通知联系人字段 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ContactField = await sheet.FieldId("联系人") + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ContactField = sheet.FieldId("联系人") + // 更新字段 + field.Apply() +} +main(); +``` + +``` + +## 133. 开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / ContactField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_ContactField + +```markdown +# 通知联系人 +AutomationField.ContactField(属性) + + + +## 说明 + +可读写 + +自动任务字段的通知联系人字段 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ContactField = await sheet.FieldId("联系人") + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ContactField = sheet.FieldId("联系人") + // 更新字段 + field.Apply() +} +main(); +``` + +``` + +## 134. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 触发时间 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime + +```markdown +# 触发时间 +AutomationField.ExecuteTime(属性) + + + +## 说明 + +可读写 + +当自动任务字段的类型为 DueDateNotifyContact,可设置指定触发时间通知联系人 +格式为当前日期 + 执行时间, 时间为当天经过的秒数 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +main(); +``` + +``` + +## 135. 开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / ExecuteTime + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_ExecuteTime + +```markdown +# 触发时间 +AutomationField.ExecuteTime(属性) + + + +## 说明 + +可读写 + +当自动任务字段的类型为 DueDateNotifyContact,可设置指定触发时间通知联系人 +格式为当前日期 + 执行时间, 时间为当天经过的秒数 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.ExecuteTime = 3600 + // 更新字段 + field.Apply() +} +main(); +``` + +``` + +## 136. 开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / TriggerField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_TriggerField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_TriggerField + +```markdown +# AutomationField.TriggerField(属性) + + + +## 说明 + +可读写 + +自动任务字段的触发字段,当Type为CheckedNotifyContact时,触发字段是复选框字段,当Type为DueDateNotifyContact时,触发字段为日期字段 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors("@自动任务") + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.TriggerField = await sheet.FieldId("日期") + // 更新字段 + field.Apply() +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets(1) + const field = await sheet.FieldDescriptors(11) + const automation = await field.Automation + // 设置 自动化任务的属性 + automation.Type = "DueDateNotifyContact" + automation.TriggerField = sheet.FieldId("日期") + // 更新字段 + field.Apply() +} +main(); +``` + +``` + +## 137. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 自动任务字段 / 类型 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_Type + +```markdown +# 类型 +AutomationField.Type(属性) + + + +## 说明 + +可读写 + +自动任务字段的类型,有三种类型,参考枚举值 DbAutomationPresetType ,分别为CheckedNotifyContact,UpdatedNotifyContact,DueDateNotifyContact + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const contactField = await Application.FieldDescriptor("Contact","联系人字段") + await Application.Sheets(1).FieldDescriptors.AddField(contactField) + const dateField = await Application.FieldDescriptor("Date","日期字段") + await Application.Sheets(1).FieldDescriptors.AddField(dateField) + const newField = await Application.FieldDescriptor("Automations","自动任务字段") + const automation = await newField.Automation + automation.Type = "DueDateNotifyContact" + automation.TriggerField = await dateField.Id + automation.ContactField = await contactField.Id + automation.ExecuteTime = 3600 + await Application.Sheets(1).FieldDescriptors.AddField(newField) +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const contactField = FieldDescriptor("Contact","联系人字段") + Sheets(1).FieldDescriptors.AddField(contactField) + const dateField = FieldDescriptor("Date","日期字段") + Sheets(1).FieldDescriptors.AddField(dateField) + const newField = FieldDescriptor("Automations","自动任务字段") + const automation = newField.Automation + automation.Type = "DueDateNotifyContact" + automation.TriggerField = dateField.Id + automation.ContactField = contactField.Id + automation.ExecuteTime = 3600 + Sheets(1).FieldDescriptors.AddField(newField) +} +main(); +``` + +``` + +## 138. 开发指南 / WPS多维表格开发 / API文档 / API / AutomationField / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/AutomationField_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/AutomationField_Type + +```markdown +# 类型 +AutomationField.Type(属性) + + + +## 说明 + +可读写 + +自动任务字段的类型,有三种类型,参考枚举值 DbAutomationPresetType ,分别为CheckedNotifyContact,UpdatedNotifyContact,DueDateNotifyContact + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const contactField = await Application.FieldDescriptor("Contact","联系人字段") + await Application.Sheets(1).FieldDescriptors.AddField(contactField) + const dateField = await Application.FieldDescriptor("Date","日期字段") + await Application.Sheets(1).FieldDescriptors.AddField(dateField) + const newField = await Application.FieldDescriptor("Automations","自动任务字段") + const automation = await newField.Automation + automation.Type = "DueDateNotifyContact" + automation.TriggerField = await dateField.Id + automation.ContactField = await contactField.Id + automation.ExecuteTime = 3600 + await Application.Sheets(1).FieldDescriptors.AddField(newField) +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const contactField = FieldDescriptor("Contact","联系人字段") + Sheets(1).FieldDescriptors.AddField(contactField) + const dateField = FieldDescriptor("Date","日期字段") + Sheets(1).FieldDescriptors.AddField(dateField) + const newField = FieldDescriptor("Automations","自动任务字段") + const automation = newField.Automation + automation.Type = "DueDateNotifyContact" + automation.TriggerField = dateField.Id + automation.ContactField = contactField.Id + automation.ExecuteTime = 3600 + Sheets(1).FieldDescriptors.AddField(newField) +} +main(); +``` + +``` + +## 139. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / ButtonField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField + +```markdown +# ButtonField (对象) + + +## 说明 +ButtonField 按钮字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非按钮字段,无法设置相关属性 + +## 属性 +- [BackgroundColor](/app-integration-dev/guide/dbsheet/Api/ButtonField_BackgroundColor) +- [Icon](/app-integration-dev/guide/dbsheet/Api/ButtonField_Icon) +- [Text](/app-integration-dev/guide/dbsheet/Api/ButtonField_Text) +- [SuccessText](/app-integration-dev/guide/dbsheet/Api/ButtonField_SuccessText) +- [TextColor](/app-integration-dev/guide/dbsheet/Api/ButtonField_TextColor) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = await fieldDescriptor.Button + prop.Text = "Get it" + prop.SuccessText = "SucccessText" + prop.TextColor = "#ff00ff" + prop.BackgroundColor = "#000000" + prop.Icon = "calendar_check_in" + fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = field.Button + prop.Text = "Get it" + prop.SuccessText = "SucccessText" + prop.TextColor = "#ff00ff" + prop.BackgroundColor = "#000000" + prop.Icon = "calendar_check_in" + fieldDescriptor.Apply() + } +main() +``` +``` + +## 140. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / BackgroundColor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_BackgroundColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField_BackgroundColor + +```markdown +# ButtonField.BackgroundColor (属性) + + +## 说明 +可读写 + +按钮字段的填充颜色 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const field = await Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = await field.Button + prop.BackgroundColor = "#1f00ff" + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = field.Button + prop.BackgroundColor = "#1f00ff" + field.Apply() +} +main() +``` +``` + +## 141. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / Icon + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_Icon` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField_Icon + +```markdown +# FieldDescriptor.Icon(属性) + + +## 说明 +可读写 + +按钮字段的图标,可使用枚举值[DbButtonIcon](/app-integration-dev/guide/dbsheet/Api/Enum_DbButtonIcon) + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const field = await Application.Sheets("数据表").FieldDescriptors("@按钮") + field.Button.Icon = "calendar_check_in" + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets("数据表").FieldDescriptors("@按钮") + field.Button.Icon = Enum.DbButtonIcon.CalendarCheckIn + field.Apply() +} +main() +``` +``` + +## 142. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / SuccessText + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_SuccessText` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField_SuccessText + +```markdown +# ButtonField.SuccessText(属性) + + +## 说明 +可读写 + +点击按钮字段后的提示文本 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const field = await Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = await field.Button + prop.SuccessText = "点击按钮成功" + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = field.Button + prop.SuccessText = "点击按钮成功" + field.Apply() +} +main() +``` +``` + +## 143. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / Text + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_Text` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField_Text + +```markdown +# ButtonField.Text(属性) + + +## 说明 +可读写 + +按钮字段 按钮显示的文本 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const field = await Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = await field.Button + prop.Text = "Click" + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = field.Button + prop.Text = "Click" + field.Apply() +} +main() +``` +``` + +## 144. 开发指南 / WPS多维表格开发 / API文档 / API / ButtonField / TextColor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ButtonField_TextColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ButtonField_TextColor + +```markdown +# ButtonField.TextColor(属性) + + +## 说明 +可读写 + +按钮字段 按钮显示的文本颜色 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const field = await Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = await field.Button + prop.TextColor = "#ff00ff" + field.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets("数据表").FieldDescriptors("@按钮") + const prop = field.Button + prop.TextColor = "#ff00ff" + field.Apply() +} +main() +``` +``` + +## 145. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / CalendarView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView + +```markdown +# CalendarView (对象) + + + +## 说明 + +日历视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[BeginField](/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField)|开始日期字段|可读写| +|[EndField](/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField)|结束日期字段|可读写| +|[TimelineColor](/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor)|事件线颜色|可读写| +|[TimelineColorFollowField](/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorFollowField)|事件线颜色跟随字段|可读写| +|[TimelineColorType](/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorType)|事件线颜色类型|可读写| +|[TitleField](/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField)|日历视图设置标题字段|可读写| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.BeginField); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.BeginField); +} +main(); +``` + +``` + +## 146. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 开始日期字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField + +```markdown +# 开始日期字段 +CalendarView.BeginField(属性) + + + +## 说明 + +可读写 + +开始日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.BeginField); + view.BeginField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.BeginField); + view.BeginField = 's'; +} +main(); +``` + +``` + +## 147. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / BeginField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_BeginField + +```markdown +# 开始日期字段 +CalendarView.BeginField(属性) + + + +## 说明 + +可读写 + +开始日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.BeginField); + view.BeginField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.BeginField); + view.BeginField = 's'; +} +main(); +``` + +``` + +## 148. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 结束日期字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField + +```markdown +# 结束日期字段 +CalendarView.EndField(属性) + + + +## 说明 + +可读写 + +结束日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.EndField); + view.EndField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.EndField); + view.EndField = 's'; +} +main(); +``` + +``` + +## 149. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / EndField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_EndField + +```markdown +# 结束日期字段 +CalendarView.EndField(属性) + + + +## 说明 + +可读写 + +结束日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.EndField); + view.EndField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.EndField); + view.EndField = 's'; +} +main(); +``` + +``` + +## 150. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 时间线颜色 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor + +```markdown +# 时间线颜色 +CalendarView.TimelineColor(属性) + + + +## 说明 + +可读写 + +事件线颜色,值为Hex格式的RGB颜色值,如:#FF0000。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.TimelineColor); + view.TimelineColor = '#97E4E4'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.TimelineColor); + view.TimelineColor = '#97E4E4'; +} +main(); +``` + +``` + +## 151. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColor + +```markdown +# 时间线颜色 +CalendarView.TimelineColor(属性) + + + +## 说明 + +可读写 + +事件线颜色,值为Hex格式的RGB颜色值,如:#FF0000。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.TimelineColor); + view.TimelineColor = '#97E4E4'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.TimelineColor); + view.TimelineColor = '#97E4E4'; +} +main(); +``` + +``` + +## 152. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColorFollowField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorFollowField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorFollowField + +```markdown +# 事件线颜色跟随字段 +CalendarView.TimelineColorFollowField(属性) + + + +## 说明 + +可读写 + +事件线颜色跟随字段,值为字段Id。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.TimelineColorFollowField); + view.TimelineColorFollowField = 'E'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.TimelineColorFollowField); + view.TimelineColorFollowField = 'E'; +} +main(); +``` + +``` + +## 153. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TimelineColorType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TimelineColorType + +```markdown +# 事件线颜色类型 +CalendarView.TimelineColorType(属性) + + + +## 说明 + +可读写 + +事件线颜色类型,值为'Custom'(自定义颜色)或'Follow'(跟随单选项字段) + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.TimelineColorType); + view.TimelineColor = 'Custom'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.TimelineColorType); + view.TimelineColor = 'Follow'; +} +main(); +``` + +``` + +## 154. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 日历视图 / 标题设置 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField + +```markdown +# 标题设置 +CalendarView.TitleField(属性) + + + +## 说明 + +可读写 + +日历视图设置标题字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const CalendarView = await app.Sheets(1).Views(1); + console.log(CalendarView.TitleField); + CalendarView.TitleField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const CalendarView = Application.Sheets(1).Views(1); + console.log(CalendarView.TitleField); + CalendarView.TitleField = 's'; +} +main(); +``` + +``` + +## 155. 开发指南 / WPS多维表格开发 / API文档 / API / CalendarView / TitleField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CalendarView_TitleField + +```markdown +# 标题设置 +CalendarView.TitleField(属性) + + + +## 说明 + +可读写 + +日历视图设置标题字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const CalendarView = await app.Sheets(1).Views(1); + console.log(CalendarView.TitleField); + CalendarView.TitleField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const CalendarView = Application.Sheets(1).Views(1); + console.log(CalendarView.TitleField); + CalendarView.TitleField = 's'; +} +main(); +``` + +``` + +## 156. 开发指南 / WPS多维表格开发 / API文档 / API / CardViewUI / CardViewUI对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CardViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CardViewUI + +```markdown +# CardViewUI (对象) + + +## 说明 +移动端卡片视图的界面属性,只有移动端的表格视图才存在这个对象 + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[ViewMode](/app-integration-dev/guide/dbsheet/Api/CardViewUI_ViewMode)|卡片视图的模式|可读| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.CardViewUI + } +``` +``` + +## 157. 开发指南 / WPS多维表格开发 / API文档 / API / CardViewUI / ViewMode + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CardViewUI_ViewMode` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CardViewUI_ViewMode + +```markdown +# 模式 +CardViewUI.ViewMode(属性) + + +## 说明 +可读写 +卡片视图的模式,注意:设置值时为以下之一:'Grid','Card' + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const ViewUI = await app.Window.CardViewUI + console.log(await ViewUI.ViewMode) +} +``` +``` + +## 158. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / CascadeField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField + +```markdown +# CascadeField (对象) + + +## 说明 +CascadeField 级联字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非级联字段,无法设置相关属性 +级联字段最多设置为4级 + +## 属性 +- [IsDisplayAllLevel](/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel) +- [AllCascadeOption](/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption) +- [Title](/app-integration-dev/guide/dbsheet/Api/CascadeField_Title) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() + } +main() +``` +``` + +## 159. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 设置选项 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption + +```markdown +# 设置选项 +CascadeField.AllCascadeOption(属性) + + +## 说明 +可读写 + +级联字段的选项,最多可以设置4级 + +## 返回值 +[CascadeOptions](/app-integration-dev/guide/dbsheet/Api/CascadeOptions) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + const allCascade = await Application.CascadeOptions(); + const o1 = await allCascade.Add("级联1") + o1.Children.Add("级联1_1") + o1.Children.Add("级联1_2") + const o2 = await allCascade.Add("级联2") + o2.Children.Add("级联2_1") + o2.Children.Add("级联2_2") + const o3 = await allCascade.Add("级联3") + o3.Children.Add("级联3_1") + o3.Children.Add("级联3_2") + const o4 = await allCascade.Add("级联4") + o4.Children.Add("级联4_1") + const o4_2 = o4.Children.Add("级联4_2") + o4_2.Children.Add("级联4_2_1") + o4_2.Children.Add("级联4_2_2") + + prop.AllCascadeOption = allCascade + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = fieldDescriptor.Cascade + const allCascade = CascadeOptions(); + const o1 = allCascade.Add("级联1") + o1.Children.Add("级联1_1") + o1.Children.Add("级联1_2") + const o2 = allCascade.Add("级联2") + o2.Children.Add("级联2_1") + o2.Children.Add("级联2_2") + const o3 = allCascade.Add("级联3") + o3.Children.Add("级联3_1") + o3.Children.Add("级联3_2") + const o4 = allCascade.Add("级联4") + o4.Children.Add("级联4_1") + const o4_2 = o4.Children.Add("级联4_2") + o4_2.Children.Add("级联4_2_1") + o4_2.Children.Add("级联4_2_2") + + prop.AllCascadeOption = allCascade + fieldDescriptor.Apply() +} +main() +``` +``` + +## 160. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / AllCascadeOption + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_AllCascadeOption + +```markdown +# 设置选项 +CascadeField.AllCascadeOption(属性) + + +## 说明 +可读写 + +级联字段的选项,最多可以设置4级 + +## 返回值 +[CascadeOptions](/app-integration-dev/guide/dbsheet/Api/CascadeOptions) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + const allCascade = await Application.CascadeOptions(); + const o1 = await allCascade.Add("级联1") + o1.Children.Add("级联1_1") + o1.Children.Add("级联1_2") + const o2 = await allCascade.Add("级联2") + o2.Children.Add("级联2_1") + o2.Children.Add("级联2_2") + const o3 = await allCascade.Add("级联3") + o3.Children.Add("级联3_1") + o3.Children.Add("级联3_2") + const o4 = await allCascade.Add("级联4") + o4.Children.Add("级联4_1") + const o4_2 = o4.Children.Add("级联4_2") + o4_2.Children.Add("级联4_2_1") + o4_2.Children.Add("级联4_2_2") + + prop.AllCascadeOption = allCascade + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = fieldDescriptor.Cascade + const allCascade = CascadeOptions(); + const o1 = allCascade.Add("级联1") + o1.Children.Add("级联1_1") + o1.Children.Add("级联1_2") + const o2 = allCascade.Add("级联2") + o2.Children.Add("级联2_1") + o2.Children.Add("级联2_2") + const o3 = allCascade.Add("级联3") + o3.Children.Add("级联3_1") + o3.Children.Add("级联3_2") + const o4 = allCascade.Add("级联4") + o4.Children.Add("级联4_1") + const o4_2 = o4.Children.Add("级联4_2") + o4_2.Children.Add("级联4_2_1") + o4_2.Children.Add("级联4_2_2") + + prop.AllCascadeOption = allCascade + fieldDescriptor.Apply() +} +main() +``` +``` + +## 161. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 显示完整的选择路径 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel + +```markdown +# 显示完整的选择路径 +CascadeField.IsDisplayAllLevel(属性) + + +## 说明 +可读写 + +级联字段是否显示完整的选择路径 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 162. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / IsDisplayAllLevel + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_IsDisplayAllLevel + +```markdown +# 显示完整的选择路径 +CascadeField.IsDisplayAllLevel(属性) + + +## 说明 +可读写 + +级联字段是否显示完整的选择路径 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = fieldDescriptor.Cascade + prop.IsDisplayAllLevel = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 163. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 选项标题 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_Title` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_Title + +```markdown +# 选项标题 +FieldDescriptor.Title(属性) + + +## 说明 +可读写 + +级联选项各级选项的标题,最多可以设置四级标题 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + prop.Title = ["第一级标题","第二级标题","第三级标题"] + fieldDescriptor.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets(1).FieldDescriptors(2) + const prop = await fieldDescriptor.Cascade + prop.Title = ["第一级标题","第二级标题","第三级标题"] + fieldDescriptor.Apply() +} +main() +``` +``` + +## 164. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeField / Title + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_Title` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_Title + +```markdown +# 选项标题 +FieldDescriptor.Title(属性) + + +## 说明 +可读写 + +级联选项各级选项的标题,最多可以设置四级标题 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@级联选项") + const prop = await fieldDescriptor.Cascade + prop.Title = ["第一级标题","第二级标题","第三级标题"] + fieldDescriptor.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets(1).FieldDescriptors(2) + const prop = await fieldDescriptor.Cascade + prop.Title = ["第一级标题","第二级标题","第三级标题"] + fieldDescriptor.Apply() +} +main() +``` +``` + +## 165. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_getValue + +```markdown +# 获取级联字段类型值 + +## 说明 +获取 级联字段 类型值 + +## 返回 +`object` 结构,结构如下 + +### object结构 +|key|值类型|说明| +|---|---|---| +|districts|string[]|选项数组| + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@级联").Value + console.log(value) + /** + * 输出值: + * { + * districts: ["选项1", "选项1-1"], + * } + */ + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@级联").Value + console.log(value) +} +main() +``` +``` + +## 166. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 级联字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeField_setValue + +```markdown +# 设置级联字段类型值 + +## 说明 +设置 级联字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置级联字段值 + app.Sheets(1).Views(1).RecordRange(2, "@级联").Value = await Application.DBCellValue({ + districts: ['选项1', '选项1-1'] + }) + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置级联字段值 + Application.Sheets(1).Views(1).RecordRange(2, "@级联").Value = Application.DBCellValue({ + districts: ['选项1', '选项1-1'] + }) +} +main() +``` +``` + +## 167. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / CascadeOption对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOption + +```markdown +# CascadeOption (对象) + + +## 说明 +级联字段选项 + +## 方法 + + +## 属性 +* [Id](/app-integration-dev/guide/dbsheet/Api/CascadeOption_Id) +* [Value](/app-integration-dev/guide/dbsheet/Api/CascadeOption_Value) +* [Children](/app-integration-dev/guide/dbsheet/Api/CascadeOption_Children) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const options = await app.CascadeOptions(); + const o1 = await options.Add("test1") + o1.Children.Add("child1") + options.Add("test2") + const desc = await app.FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + app.Sheets(1).FieldDescriptors.AddField(desc, 1) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const options = CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + Application.Sheets(1).FieldDescriptors.AddField(desc, 1) + } +main() +``` +``` + +## 168. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Children + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Children` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOption_Children + +```markdown +# CascadeOption.Children(属性) + + +## 说明 +可读写 + +级联字段选项的子选项集合 + +## 返回值 +CascadeOptions + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const options = await app.CascadeOptions(); + const o1 = await options.Add("test1") + o1.Children.Add("child1") + options.Add("test2") + const desc = await app.FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + app.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const options = CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + Application.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +main() +``` +``` + +## 169. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOption_Id + +```markdown +# CascadeOption.Id(属性) + + +## 说明 +可读写 + +返回级联字段选项的Id + +## 返回值 +string + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const cascadeOptions = await app.Sheets(1).FieldDescriptors(2).AllCascadeOption + console.log(await cascadeOptions.Item(1).Id) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const cascadeOptions = Application.Sheets(1).FieldDescriptors(2).AllCascadeOption + console.log(cascadeOptions.Item(1).Id) +} +main() +``` +``` + +## 170. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOption / Value + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOption_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOption_Value + +```markdown +# CascadeOption.Value(属性) + + +## 说明 +可读写 + +返回级联字段选项的值 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + await instance.ready(); + const app = instance.Application; + const cascadeOptions = await app.Sheets(1).FieldDescriptors(2).AllCascadeOption + console.log(await cascadeOptions.Item(1).Value) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const cascadeOptions = Application.Sheets(1).FieldDescriptors(2).AllCascadeOption + console.log(cascadeOptions.Item(1).Value) +} +main() +``` +``` + +## 171. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / CascadeOptions对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOptions + +```markdown +# CascadeOptions (对象) + + +## 说明 +级联字段的选项集合 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Add) + + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const options = await app.CascadeOptions(); + const o1 = await options.Add("test1") + o1.Children.Add("child1") + options.Add("test2") + const desc = await app.FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + app.Sheets(1).FieldDescriptors.AddField(desc, 1) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const options = CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + Application.Sheets(1).FieldDescriptors.AddField(desc, 1) + } +main() +``` +``` + +## 172. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Add + +```markdown +# CascadeOptions.Add(方法) + +## 说明 +增加级联字段选项 + +## 语法 +表达式.Add(Value) + +表达式:CascadeOptions + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Value|否|string|选项值| + + +## 返回值 +CascadeOption + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const options = await app.CascadeOptions(); + const o1 = await options.Add("test1") + o1.Children.Add("child1") + options.Add("test2") + const desc = await app.FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + app.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const options = CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + Application.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +main()``` + +``` + +## 173. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Count + +```markdown +# CascadeOptions.Count(属性) + + +## 说明 +可读写 + +级联字段的选项数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const descript = await app.Sheets(1).FieldDescriptors(2) + const CascadeOption = await descript.AllCascadeOption + const count = await CascadeOption.Count + if (count === 0) { + CascadeOption.Add("ADD 1") + descript.Apply() + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const descript = Application.Sheets(1).FieldDescriptors(2) + const CascadeOption = descript.AllCascadeOption + const count = CascadeOption.Count + if (count === 0) { + CascadeOption.Add("ADD 1") + descript.Apply() + } +} +main() +``` +``` + +## 174. 开发指南 / WPS多维表格开发 / API文档 / API / CascadeOptions / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/CascadeOptions_Item + +```markdown +# CascadeOptions.Item(方法) + +## 说明 +返回级联字段的选项 + +## 语法 +表达式.Item(Index) + +表达式:CascadeOptions + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|Number|选项索引从1开始| + + +## 返回值 +CascadeOption + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const options = app.CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = app.FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + await Application.Sheets(1).FieldDescriptors.AddField(desc, 1) + console.log(options.Item(1).Value) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const options = CascadeOptions(); + options.Add("test1") + options.Add("test2") + const desc = FieldDescriptor("Cascade","级联字段") + desc.AllCascadeOption = options + Application.Sheets(1).FieldDescriptors.AddField(desc, 1) + console.log(options.Item(1).Value) +} +main()``` + +``` + +## 175. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Chart对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart + +```markdown +# Chart (对象) + + + +## 说明 + +- 图表 + +## 方法 +|方法|说明| +|-|-| +|[Copy](/app-integration-dev/guide/dbsheet/Api/Chart_Copy)|复制图表| +|[Delete](/app-integration-dev/guide/dbsheet/Api/Chart_Delete)|删除图表| + +|属性|说明|读写说明| +|-|-|-| +|[Id](/app-integration-dev/guide/dbsheet/Api/Chart_Id)|Id|可读| +|[Name](/app-integration-dev/guide/dbsheet/Api/Chart_Name)|名称|可读写| +|[Type](/app-integration-dev/guide/dbsheet/Api/Chart_Type)|图表类型|可读写| + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1) + console.log(await chart.Id) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + // 返回Id + console.log(chart.Id) +} +main() +``` + +``` + +## 176. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Copy + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart_Copy + +```markdown +# 复制图表 + + +## 说明 +复制图表 + +## 语法 +表达式.Copy() + +表达式:Chart + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1); + await chart.Copy(); +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + chart.Copy() + } +main() +``` +``` + +## 177. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart_Delete + +```markdown +# 删除图表 + + +## 说明 +删除图表 + +## 语法 +表达式.Delete() + +表达式:Chart + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1); + await chart.Delete(); +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + chart.Delete() + } +main() +``` +``` + +## 178. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart_Id + +```markdown +# Chart.Id(属性) + + + +## 说明 + +可读 +返回图表的Id + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1) + console.log(await chart.Id) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + // 返回Id + console.log(chart.Id) +} +main() +``` +``` + +## 179. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart_Name + +```markdown +# Chart.Name(属性) + + + +## 说明 + +可读写 +返回图表的名称 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1) + console.log(await chart.Name) + chart.Name = '图1' +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + // 返回Id + console.log(chart.Name) + chart.Name = '图1' +} +main() +``` +``` + +## 180. 开发指南 / WPS多维表格开发 / API文档 / API / Chart / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Chart_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Chart_Type + +```markdown +# Chart.Type(属性) + + + +## 说明 + +可读写 +返回图表的类型,切换图表类型 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1) + console.log(await chart.Type) + chart.Type = 'Value' +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + // 返回Id + console.log(chart.Type) + chart.Type = 'Value' +} +main() +``` +``` + +## 181. 开发指南 / WPS多维表格开发 / API文档 / API / Charts / Charts对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Charts` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Charts + +```markdown +# Charts (对象) + +## 说明 + +- 获取图表列表 + +## 方法 + +|方法|说明| +|-|-| +|[Item](/app-integration-dev/guide/dbsheet/Api/Charts_Item)|通过索引位置获取图表| +|[Add](/app-integration-dev/guide/dbsheet/Api/Charts_Add)|添加图表| + +|属性|说明|读写说明| +|-|-|-| +|[Count](/app-integration-dev/guide/dbsheet/Api/Charts_Count)|图表数量|可读| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const chart = await sheet.Charts.Item(1) + console.log(await chart.Id) +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const chart = Application.Sheets(1).Charts.Item(1) + // 返回Id + console.log(chart.Id) +} +main() +``` + +``` + +## 182. 开发指南 / WPS多维表格开发 / API文档 / API / Charts / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Charts_Add + +```markdown +# 添加 Chart + +## 说明 + +新建图表 Chart + +## 语法 + +表达式.Add(Type, Name) + +表达式:Charts + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Type | 是 | string | 图表类型:BasicBar、BasicLine、HorizBar、BasicPie、Value、BarLine| +| Name | 否 | string | 图表名称| + +## 返回值 + +Chart + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets.Item(1) + const chart = await sheet.Charts.Add('BasicBar','图表1') +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets.Item(1) + const chart = sheet.Charts.Add('BasicBar','图表1') +} +main() +``` +``` + +## 183. 开发指南 / WPS多维表格开发 / API文档 / API / Charts / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Charts_Count + +```markdown +# Charts.Count(属性) + +## 说明 + +可读 +返回图表的数量 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); + const charts = await sheet.Charts + console.log(await charts.Count) +} + +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const count = Application.Sheets(1).Charts.Count + // 图表个数 + console.log(count) +} +main() +``` +``` + +## 184. 开发指南 / WPS多维表格开发 / API文档 / API / Charts / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Charts_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Charts_Item + +```markdown +# 通过索引位置获取 Chart + +## 说明 + +通过索引位置获取 Chart + +## 语法 + +表达式.Item(Index) + +表达式:Charts + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始| + +## 返回值 + +Chart + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets.Item(1) + const chart = await sheet.Charts.Item(1) +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const sheet = Application.Sheets.Item(1) + const chart = await sheet.Charts.Item(1) +} +main() +``` +``` + +## 185. 开发指南 / WPS多维表格开发 / API文档 / API / ContactField / ContactField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField + +```markdown +# ContactField (对象) + + +## 说明 +ContactField 联系人字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非联系人字段,无法设置相关属性 + +## 属性 +- [IsSupportNotice](/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice) +- [IsSupportMulti](/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = await fieldDescriptor.Contact + prop.IsSupportNotice = true + prop.IsSupportMulti = false + await fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = fieldDescriptor.Contact + prop.IsSupportNotice = true + prop.IsSupportMulti = false + fieldDescriptor.Apply() + } +main() +``` +``` + +## 186. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 插入多个联系人 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti + +```markdown +# 插入多个联系人 +ContactField.IsSupportMulti(属性) + + +## 说明 +可读写 + +字段类型为联系人时,通过此属性可以设置是否允许向单元格插入多个联系人 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = await fieldDescriptor.Contact + prop.IsSupportMulti = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = fieldDescriptor.Contact + prop.IsSupportMulti = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 187. 开发指南 / WPS多维表格开发 / API文档 / API / ContactField / IsSupportMulti + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportMulti + +```markdown +# 插入多个联系人 +ContactField.IsSupportMulti(属性) + + +## 说明 +可读写 + +字段类型为联系人时,通过此属性可以设置是否允许向单元格插入多个联系人 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = await fieldDescriptor.Contact + prop.IsSupportMulti = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = fieldDescriptor.Contact + prop.IsSupportMulti = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 188. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 发送通知 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice + +```markdown +# 发送通知 +ContactField.IsSupportNotice(属性) + + +## 说明 +可读写 + +字段类型为联系人时,通过此属性可以设置是否允许向新插入的联系人发送通知 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = await fieldDescriptor.Contact + prop.IsSupportNotice = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = fieldDescriptor.Contact + prop.IsSupportNotice = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 189. 开发指南 / WPS多维表格开发 / API文档 / API / ContactField / IsSupportNotice + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_IsSupportNotice + +```markdown +# 发送通知 +ContactField.IsSupportNotice(属性) + + +## 说明 +可读写 + +字段类型为联系人时,通过此属性可以设置是否允许向新插入的联系人发送通知 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = await fieldDescriptor.Contact + prop.IsSupportNotice = true + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@联系人") + const prop = fieldDescriptor.Contact + prop.IsSupportNotice = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 190. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_getValue + +```markdown +# 获取联系人类型值 + +## 说明 +获取 联系人字段 类型值 + +## 返回 +`string`类型,返回多个联系人id时用","进行分割 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@联系人").Value + console.log(value) + // 输出 "1557445524,238777563" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@联系人").Value + console.log(value) +} +main() +``` +``` + +## 191. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 联系人字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ContactField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ContactField_setValue + +```markdown +# 设置联系人类型值 + +## 说明 +设置 联系人字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置联系人字段,值为用户id + app.Sheets(1).Views(1).RecordRange(2, "@联系人").Value = "1557445524" + // 设置多个联系人字段,用户id用","进行分割 + app.Sheets(1).Views(1).RecordRange(2, "@联系人").Value = "1557445524,238777563" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置联系人字段 + Application.Sheets(1).Views(1).RecordRange(2, "@联系人").Value = "1557445524,238777563" +} +main() +``` +``` + +## 192. 开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Criteria对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Criteria` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Criteria + +```markdown +# Criteria (对象) + +## 说明 +筛选条件项 + +## 属性 +* [Field](/app-integration-dev/guide/dbsheet/Api/Criteria_Field) +* [Op](/app-integration-dev/guide/dbsheet/Api/Criteria_Op) +* [Values](/app-integration-dev/guide/dbsheet/Api/Criteria_Value) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = filters(1).Criteria; + console.log(criteria.Field) + console.log(criteria.Op) + console.log(criteria.Values) + } +``` + +## 脚本编辑器示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters + const result = filters(1).Criteria + console.log(result.Field) + console.log(result.Op) + console.log(result.Values) + } +main() +``` + +``` + +## 193. 开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Field + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Field` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Criteria_Field + +```markdown +# Criteria.Field(属性) +## 说明 + +筛选项字段值: +|值选项|描述| +|---|---| +|columnNumber|列号,从1开始| +|fieldId|字段id| + + +## 浏览器环境示例 +``` javascript +async function example() { + // 添加一个筛选条件 + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = app.Criteria(1, 'Equals', ['1']) + const filter = await filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = await app.Sheets(1).Views(1).Filters(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Value) // [{type: 'Text', value: '1'}] +} +``` + +## 脚本编辑器示例 +``` javascript +function main() { + // 添加一个筛选条件 + const filters = Application.Sheets(1).Views(1).Filters; + const criteria = Application.Criteria(1, 'Equals', ['1']) + const filter = filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = Application.Sheets(1).Views(1).Filters(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Value) // [{type: 'Text', value: '1'}] +} +main() +``` +``` + +## 194. 开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Op + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Op` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Criteria_Op + +```markdown +# Criteria.Op(属性) +## 说明 + +筛选项规则(大小写不敏感): +|枚举值|描述| +|---|---| +|Equals|等于| +|NotEqu|不等于| +|Greater|大于| +|GreaterEqu|大等于| +|Less|小于| +|LessEqu|小等于| +|GreaterEquAndLessEqu|介于(取等)| +|LessOrGreater|介于(不取等)| +|BeginWith|开头是| +|EndWith|结尾是| +|Contains|包含| +|NotContains|不包含| +|Intersected|指定值| +|Empty|为空| +|NotEmpty|不为空| + + +## 浏览器环境示例 +``` javascript +async function example() { + // 添加一个筛选条件 + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = app.Criteria(1, 'Equals', ['1']) + const filter = await filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = await app.Sheets(1).Views(1).Filters(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Value) // [{type: 'Text', value: '1'}] +} +``` + +## 脚本编辑器示例 +``` javascript +function main() { + // 添加一个筛选条件 + const filters = Application.Sheets(1).Views(1).Filters; + const criteria = Application.Criteria(1, 'Equals', ['1']) + const filter = filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = Application.Sheets(1).Views(1).Filters(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Value) // [{type: 'Text', value: '1'}] +} +main() +``` +``` + +## 195. 开发指南 / WPS多维表格开发 / API文档 / API / Criteria / Value + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Criteria_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Criteria_Value + +```markdown +# Criteria.Values (属性) + +## 说明 +筛选条件项值 + + +各筛选规则独立地限制了values数组内最多允许填写的元素数,当values内元素数超过阈值时,该筛选规则将失效。“为空、不为空”只允许在op为“Intersected”时填写。“介于”允许最多填写2个元素;“指定值”允许填写65535个元素;其他规则允许最多填写1个元素 +values[]数组内的元素为字符串时,表示文本匹配。目前还支持对日期进行动态筛选,此时values[]内的元素需以结构体的形式给出: +``` +const dateValue = {"dynamicType": "lastMonth","type": "DynamicSimple"} +Criteria("@日期", "Equals", [dateValue]) +``` +上述示例对应的筛选条件为“等于上一个月”。 +要使用日期动态筛选,values[]内的结构体需要指定"type": "DynamicSimple",当"op"为"equals"时,"dynamicType"可以为如下的值(大小写不敏感): +|枚举值|描述| +|---|---| +|today|今天| +|yesterday|昨天| +|tomorrow|明天| +|last7Days|最近7天| +|last30Days|最近30天| +|thisWeek|本周| +|lastWeek|上周| +|nextWeek|下周| +|thisMonth|本月| +|lastMonth|上月| +|nextMonth|次月| + +当"op"为"greater"或"less"时,"dynamicType"只能是昨天、今天或明天。 + +当"op"为"Intersected"时,value=[{type: 'Any'}]表示全选,value=[{type: '', value: ''}]表示空白 + +对不同字段类型,values会有不同的用法 +联系人字段: +``` +// value是一个结构体,指定type为 Contact, value 为用户id +const dateValue = {"type":"Contact", value:"user id"} +``` +单/多选项字段: +``` +// value是一个结构体,指定type为 SelectItem, value 为选项的ID +const dateValue = {"type":"SelectItem", value:"B"} +``` + + +## 浏览器环境示例 +``` javascript +async function example() { + // 添加一个筛选条件 + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = app.Criteria(1, 'Equals', ['1']) + const filter = await filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = await app.Sheets(1).Views(1).Filters.item(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Values) // [{type: 'Text', value: '1'}] + } +``` + +## 脚本编辑器示例 +``` javascript +function main() { + // 添加一个筛选条件 + const filters = Application.Sheets(1).Views(1).Filters; + const criteria = Application.Criteria(1, 'Equals', ['1']) + const filter = filters.Add(criteria); + + // 读取添加的筛选条件规则 + const criteria = Application.Sheets(1).Views(1).Filters.item(1).Criteria + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Values) // [{type: 'Text', value: '1'}] + } +main() +``` + +``` + +## 196. 开发指南 / WPS多维表格开发 / API文档 / API / DBCellValue / DBCellValue对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DBCellValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DBCellValue + +```markdown +# DBCellValue (对象) + + +## 说明 +单元格数据,读取单元格值时, 如果是复杂的字段数据,则会返回DBCellValue, 比如:多选项/超链接/联系人/级联字段/关联字段/地址字段/图片与附件。 +当通过RecordRange.Value 设置复杂的字段数据时,需要构造DBCellValue作为参数设置到单元格 +``` +ActiveView.RecordRange([5,6], "@地址").Value = DBCellValue({districts:["广东省","珠海市","香洲区"],detail:"云海路"}) +``` + +## 方法 + +## 属性 + +* [Value](/app-integration-dev/guide/dbsheet/Api/DBCellValue_Value) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbCellValue = await app.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = await dbCellValue.Value + console.log(await attments[0].FileName) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const dbCellValue = Application.Sheets(1).Views(1).RecordRange(1,"@图片和附件").Value + const attments = dbCellValue.Value + console.log(attments[0].FileName) + } +main() +``` + +``` + +## 197. 开发指南 / WPS多维表格开发 / API文档 / API / DBCellValue / Value + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DBCellValue_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DBCellValue_Value + +```markdown +# DBCellValue.Value(属性) + + +## 说明 +返回单元格的值 +地址字段类型: 通过DBCellValue() 生成字段的数据 +``` +DBCellValue({districts:["广东省","珠海市","香洲区"],detail:"前岛环路xxxx号"}) +``` +级联字段类型:通过DBCellValue() 生成字段的数据 +``` +DBCellValue({districts:["广东省","珠海市","香洲区"]}) +``` +超链接字段类型: +``` +DBCellValue({address:"wps.cn", display:"wps"}) +``` + +关联字段类型: 参数传入关联的记录id +``` +DBCellValue(["b","V"]) +``` + +多选项类型: +``` +DBCellValue(["未,开始","进行中"]) +``` + +图片与附件字段:可以传入包含 URL/base64编码的图片/云文档 的数组,支持多个附件。 +注意:由于脚本有运行时长限制,附件较大/或者较多时会导致超时,设置失败 +``` +DBCellValue([{fileData: url/base64, fileName: ""}]) +``` +``` + +## 198. 开发指南 / WPS多维表格开发 / API文档 / API / DataSource / DataSource对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource + +```markdown +# DataSource (对象) + + +## 说明 +DataSource 对象 + +## 方法 +* [CreateSyncDBSheets](/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets) +* [ImportFromCloud](/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromCloud) +* [ImportFromLocal](/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromLocal) +* [CreateSummarySheet](/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dataSource = await app.DataSource; + const sheets = await dataSource.ImportFromCloud('100127684526') + console.log(sheets) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const dataSource = Application.DataSource + const sheets = await dataSource.ImportFromCloud('100127684526') + console.log(sheets) +} +main() +``` +``` + +## 199. 开发指南 / WPS多维表格开发 / API文档 / API / DataSource / CreateSummarySheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSummarySheet + +```markdown +# 创建合并表 +DataSource.CreateSummarySheet(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +将数据源表合并成一个合并表。 + +## 语法 +表达式.CreateSummarySheet(SummarySourceConfigs) + +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| SummarySourceConfigs | 是 | SummarySourceConfigs | 数据源配置对象 | + +## 返回值 +SummarySheet + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 通过SummarySourceConfigs对象构造符合规范的数据源配置对象,来创建合并表 + const configs = await app.SummarySourceConfigs; + await configs.Add('100138603654', [1]) + const sheet = await app.DataSource.CreateSummarySheet(configs) + console.log(sheet) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 通过SummarySourceConfigs对象构造符合规范的数据源配置对象,来创建合并表 + const configs = Application.SummarySourceConfigs; + configs.Add('100138603654', [1]) + const sheet = Application.DataSource.CreateSummarySheet(configs) + console.log(sheet) +} +main() +``` +``` + +## 200. 开发指南 / WPS多维表格开发 / API文档 / API / DataSource / CreateSyncDBSheets + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_CreateSyncDBSheets + +```markdown +# 创建同步表 +DataSource.CreateSyncDBSheets(方法) + + +## 说明 +创建同步表 + +## 语法 +表达式.CreateSyncDBSheets(FileId, OfficeType, SheetIds) +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| FileId | 是 | string | 在线表格文件的 fileId | +| OfficeType | 是 | 'd' \| 'k' | 在线表格文件的类型:d 代表多维表格,k 代表智能表格 | +| SheetIds | 是 | number[] | 在线表格文件的 stId 数组 | + +## 返回值 +SyncDBSheet[] + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const syncSheets = await app.DataSource.CreateSyncDBSheets('100127684526', 'd', [1]) + console.log(syncSheets) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const syncSheets = Application.DataSource.CreateSyncDBSheets('100127684526', 'd', [1]) + console.log(syncSheets) +} +main() +``` +``` + +## 201. 开发指南 / WPS多维表格开发 / API文档 / API / DataSource / ImportFromCloud + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromCloud` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromCloud + +```markdown +# DataSource.ImportFromCloud(方法) + + +## 说明 +将在线表格文件导入为新的数据表 + +## 语法 +表达式.ImportFromCloud(FileId) + +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| FileId | 是 | string | 在线表格文件的 fileId | + + +## 返回值 +DbSheet[] + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + try { + const sheets = await app.DataSource.ImportFromCloud('100127684526') + console.log(sheets) + } catch (error) { + console.log('导入数据表失败', error.message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + try { + const sheets = Application.DataSource.ImportFromCloud('100127684526') + console.log(sheets) + } catch (error) { + console.log('导入数据表失败', error.message) + } +} +main() +``` +``` + +## 202. 开发指南 / WPS多维表格开发 / API文档 / API / DataSource / ImportFromLocal + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromLocal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DataSource_ImportFromLocal + +```markdown +# DataSource.ImportFromLocal(方法) + + +## 说明 +将本地表格文件导入为新的数据表 + +## 语法 +表达式.ImportFromLocal(File) + +表达式:DataSource + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| File | 是 | File | 本地表格文件对象 | + +## 返回值 +DbSheet[] + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + + const fileInput = document.getElementById('fileInput'); + const file = fileInput.files[0]; + if (!file) { + console.error('没有选择文件'); + return; + } + + try { + const sheets = await app.DataSource.ImportFromLocal(file) + console.log(sheets) + } catch (error) { + console.log('导入数据表失败', error.message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + try { + const sheets = Application.DataSource.ImportFromLocal(file) + console.log(sheets) + } catch (error) { + console.log('导入数据表失败', error.message) + } +} +main() +``` +``` + +## 203. 开发指南 / WPS多维表格开发 / API文档 / API / DateField / DateField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField + +```markdown +# DateField (对象) + + +## 说明 +DateField 日期字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非日期字段,无法设置相关属性 + +## 属性 +- [IsShowWeek](/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek) +- [IsShowTime](/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime) +- [IsShowHoliday](/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowWeek = true + prop.IsShowTime = true + prop.IsShowHoliday = false + fieldDescriptor.Apply() + console.log(await prop.IsShowWeek) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowWeek = true + prop.IsShowTime = true + prop.IsShowHoliday = false + fieldDescriptor.Apply() + } +main() +``` +``` + +## 204. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 面板标记休息日 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday + +```markdown +# 面板标记休息日 +DateField.IsShowHoliday(属性) + + +## 说明 +可读写 + +只对日期字段有效,是否在选择日期的面板上标识节假日 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowHoliday = true + fieldDescriptor.Apply() + console.log(await prop.IsShowHoliday) +} + +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowHoliday = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 205. 开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowHoliday + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowHoliday + +```markdown +# 面板标记休息日 +DateField.IsShowHoliday(属性) + + +## 说明 +可读写 + +只对日期字段有效,是否在选择日期的面板上标识节假日 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowHoliday = true + fieldDescriptor.Apply() + console.log(await prop.IsShowHoliday) +} + +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowHoliday = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 206. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 显示时间 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime + +```markdown +# 显示时间 +DateField.IsShowTime(属性) + + +## 说明 +可读写 + +字段类型为 日期 时,通过此属性可以设置是否显示时间 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowTime = true + fieldDescriptor.Apply() + console.log(await prop.IsShowTime) +} + +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowTime = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 207. 开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowTime + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowTime + +```markdown +# 显示时间 +DateField.IsShowTime(属性) + + +## 说明 +可读写 + +字段类型为 日期 时,通过此属性可以设置是否显示时间 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowTime = true + fieldDescriptor.Apply() + console.log(await prop.IsShowTime) +} + +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowTime = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 208. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 显示星期 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek + +```markdown +# 是否显示星期 +DateField.IsShowWeek(属性) + + +## 说明 +可读写 + +字段类型为 日期 时,通过此属性设置是否显示星期 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowWeek = true + fieldDescriptor.Apply() + console.log(await prop.IsShowWeek) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowWeek = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 209. 开发指南 / WPS多维表格开发 / API文档 / API / DateField / IsShowWeek + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_IsShowWeek + +```markdown +# 是否显示星期 +DateField.IsShowWeek(属性) + + +## 说明 +可读写 + +字段类型为 日期 时,通过此属性设置是否显示星期 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = await fieldDescriptor.Date + prop.IsShowWeek = true + fieldDescriptor.Apply() + console.log(await prop.IsShowWeek) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@日期") + const prop = fieldDescriptor.Date + prop.IsShowWeek = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 210. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_getValue + +```markdown +# 获取日期类型值 + +## 说明 +获取 日期字段 类型值 + +## 返回 + +`string` 类型,如 '2024/12/30 星期一 00:00' + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 输出日期值 '2024/12/30 星期一 00:00' + const value = await app.Sheets(1).Views(1).RecordRange(1, "@日期").Value + console.log(value) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@日期").Value + console.log(value) +} +main() +``` +``` + +## 211. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 日期字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DateField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DateField_setValue + +```markdown +# 设置日期类型值 + +## 说明 +设置 日期字段 类型值,如,"2024/12/25" + +设置时,暂不支持带有星期的信息,如 "2024/12/25 星期三" 会报错 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const data = getNowDate() + // 设置日期 "2024/12/30" + app.Sheets(1).Views(1).RecordRange(2, "@日期").Value = data +} +// 获取当前日期,格式为 "yyyy:MM:dd" +function getNowDate() { + const date = new Date() + return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置云文档类型 + Application.Sheets(1).Views(1).RecordRange(2, "@日期").Value = '2024/12/30' +} +main() +``` +``` + +## 212. 开发指南 / WPS多维表格开发 / API文档 / API / DbComment / DbComment对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DbComment` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DbComment + +```markdown +# DbComment (对象) + +## 说明 +DbComment对象的属性和方法可以用来操作该条评论。 + +## 方法 +- [Delete](/app-integration-dev/guide/dbsheet/Api/DbComment_Delete) + +## 属性 +- [TextLinkRuns](/app-integration-dev/guide/dbsheet/Api/TextLinkRuns) +- [Id](/app-integration-dev/guide/dbsheet/Api/DbComment_Id) +- [Text](/app-integration-dev/guide/dbsheet/Api/DbComment_Text) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Id) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` +``` + +## 213. 开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DbComment_Delete + +```markdown +# DbComment.Delete(方法) + +## 说明 +删除记录 + +## 语法 +表达式.Delete() + +表达式:DbComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +boolean + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + await comment.Delete() + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + comment.Delete() + } +} +main() +``` + +``` + +## 214. 开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DbComment_Id + +```markdown +# RecordComment.Id(属性) + + +## 说明 +只读 + +返回评论的Id + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Id) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Id) + } +} +main() +``` +``` + +## 215. 开发指南 / WPS多维表格开发 / API文档 / API / DbComment / Text + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/DbComment_Text` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/DbComment_Text + +```markdown +# RecordComment.Text(属性) + + +## 说明 +只读 + +返回评论的文本 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` +``` + +## 216. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbAutomationPresetType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbAutomationPresetType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbAutomationPresetType.md + +```markdown +## DbAutomationPresetType +|枚举值|字符串值|描述| +|---|---|---| +|DbAutomationPresetType.CheckedNotifyContact|"CheckedNotifyContact"|状态打勾时通知联系人| +|DbAutomationPresetType.UpdatedNotifyContact|"UpdatedNotifyContact"|内容变更时通知联系人| +|DbAutomationPresetType.DueDateNotifyContact|"DueDateNotifyContact"|到期时通知联系人| +``` + +## 217. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbButtonIcon + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbButtonIcon.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbButtonIcon.md + +```markdown +## DbButtonIcon +按钮字段的图标枚举值 +|枚举值|字符串值|描述| +|---|---|---| +|DbButtonIcon.GestureThumb|'gesture_thumb'|| +|DbButtonIcon.PaperPlane|'paper_plane'|| +|DbButtonIcon.Insert|'insert'|| +|DbButtonIcon.Star|'star'|| +|DbButtonIcon.Stamp|'stamp'|| +|DbButtonIcon.Camera|'camera'|| +|DbButtonIcon.Bubble|'bubble'|| +|DbButtonIcon.BubbleTwo|'bubble_two'|| +|DbButtonIcon.Bell|'bell'|| +|DbButtonIcon.Bulb|'bulb'|| +|DbButtonIcon.Heart|'heart'|| +|DbButtonIcon.Gift|'gift'|| +|DbButtonIcon.PeopleDouble|'people_double'|| +|DbButtonIcon.Info|'info'|| +|DbButtonIcon.Successful|'successful'|| +|DbButtonIcon.Stick|'stick'|| +|DbButtonIcon.Cell|'cell'|| +|DbButtonIcon.CalendarCheckIn|'calendar_check_in'|| +|DbButtonIcon.Print|'print'|| +|DbButtonIcon.None|'none'|| +``` + +## 218. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbFieldValueType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbFieldValueType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbFieldValueType.md + +```markdown +## DbFieldValueType +公式字段的数字格式 + +|枚举值|字符串值|描述| +|---|---|---| +|DbFieldValueType.Fvt_Text| 'Fvt_Text'| 文本 | +|DbFieldValueType.Fvt_Number| 'Fvt_Number'| 数字| +|DbFieldValueType.Fvt_Contact| "Fvt_Contact"|联系人| +|DbFieldValueType.Fvt_Date| "Fvt_Date"|日期| +|DbFieldValueType.Fvt_Time| "Fvt_Time"|时间| +|DbFieldValueType.Fvt_Logic| "Fvt_Logic"|逻辑| +``` + +## 219. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbFilterCriteriaOpType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbFilterCriteriaOpType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbFilterCriteriaOpType.md + +```markdown +## DbFilterCriteriaOpType +筛选操作的枚举值 +|枚举值|字符串值|描述|适用字段| +|-----|----|----|------------------| +|DbFilterCriteriaOpType.Null|"Null"|无|所有| +|DbFilterCriteriaOpType.Equals|"Equals"|等于|数字,日期,文本,集合| +|DbFilterCriteriaOpType.NotEqu|"NotEqu"|不等于|数字,日期,文本,集合| +|DbFilterCriteriaOpType.Greater|"Greater"|大于|数字,日期| +|DbFilterCriteriaOpType.GreaterEqu|"GreaterEqu"|大于等于|数字,日期| +|DbFilterCriteriaOpType.Less|"Less"|小于|数字,日期| +|DbFilterCriteriaOpType.LessEqu|"LessEqu"|小于等于|数字,日期| +|DbFilterCriteriaOpType.GreaterEquAndLessEqu|"GreaterEquAndLessEqu"|介于|数字,日期| +|DbFilterCriteriaOpType.LessOrGreater|"LessOrGreater"|不介于|数字,日期| +|DbFilterCriteriaOpType.BeginWith|"BeginWith"|开始是|文本| +|DbFilterCriteriaOpType.NotBeginWith|"NotBeginWith"|开始不是|文本| +|DbFilterCriteriaOpType.EndWith|"EndWith"|结束是|文本| +|DbFilterCriteriaOpType.NotEndWith|"NotEndWith"|结束不是|文本| +|DbFilterCriteriaOpType.Contains|"Contains"|包含|文本| +|DbFilterCriteriaOpType.NotContains|"NotContains"|不包含|文本| +|DbFilterCriteriaOpType.Intersected|"Intersected"|有交集|集合| +|DbFilterCriteriaOpType.NotIntersected|"NotIntersected"|没有交集|集合| +|DbFilterCriteriaOpType.SubsetOf|"SubsetOf"|子集|集合| +|DbFilterCriteriaOpType.SupersetOf|"SupersetOf"|超集|集合| +|DbFilterCriteriaOpType.Empty|"Empty"|空|数字,日期,文本,集合| +|DbFilterCriteriaOpType.NotEmpty|"NotEmpty"|非空|数字,日期,文本,集合| +``` + +## 220. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbGroupUnit + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbGroupUnit.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbGroupUnit.md + +```markdown +## DbGroupUnit + +|枚举值|字符串值|描述| +|---|---|---| +|DbGroupUnit.Text|'Text'|文本| +|DbGroupUnit.Year|'Year'|年| +|DbGroupUnit.Month|'Month'|月| +|DbGroupUnit.Week|'Week'|周| +|DbGroupUnit.Day|'Day'|天| +|DbGroupUnit.Hour|'Hour'|小时| +|DbGroupUnit.Minute|'Minute'|分钟| +|DbGroupUnit.Second|'Second'|秒| +``` + +## 221. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbLookupFunction + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbLookupFunction.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbLookupFunction.md + +```markdown +## DbLookupFunction +统计引用的方法 +|枚举值|字符串值|描述| +|----|---|----| +|DbLookupFunction.Origin|'Origin'|-| +|DbLookupFunction.Sum|'Sum'|求和| +|DbLookupFunction.Counta|'Counta'|计数| +|DbLookupFunction.Average|'Average'|平均值| +|DbLookupFunction.Max|'Max'|最大值| +|DbLookupFunction.Min|'Min'|最小值| +|DbLookupFunction.Unique|'Unique'|去重| +|DbLookupFunction.CountaUnique|'CountaUnique'|去重计数| +|DbLookupFunction.ToString|'ToString'|连接字符串| +``` + +## 222. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbPermissionType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType.md + +```markdown +## DbPermissionType + +|枚举值|字符串值|描述| +|---|---|---| +|DbPermissionType.Permission_Edit|"Permission_Edit"|可编辑| +|DbPermissionType.Permission_View|"Permission_View"|可查看| +|DbPermissionType.Permission_Manage|"Permission_Manage"|可管理| +|DbPermissionType.Permission_NoPermission|"Permission_NoPermission"|无权限| +|DbPermissionType.Permission_Custom|"Permission_Custom"|未进行配置自定义权限,或者当前用户不在任何自定义权限组内| + +``` + +## 223. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / DbSharedCriteriaType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_DbSharedCriteriaType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_DbSharedCriteriaType.md + +```markdown +## DbSharedCriteriaType + +|枚举值|字符串值|描述| +|---|---|---| +|DbSharedCriteriaType.Custom|"Custom"|自定义| +|DbSharedCriteriaType.All|"All"|所有| +|DbSharedCriteriaType.None|"None"|无| +|DbSharedCriteriaType.Self|"Self"|仅自己| + +``` + +## 224. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / EditableAndViewableRecordsConfigType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_EditableAndViewableRecordsConfigType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_EditableAndViewableRecordsConfigType.md + +```markdown +## EditableAndViewableRecordsConfigType + +|枚举值|字符串值|描述| +|---|---|---| +|EditableAndViewableRecordsConfigType.All|"All"|可查看和编辑所有记录| +|EditableAndViewableRecordsConfigType.Self|"Self"|可查看和编辑自己创建的记录| +|EditableAndViewableRecordsConfigType.Custom|"Custom"|对记录进行筛选| + +``` + +## 225. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / FilterOpType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_FilterOpType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_FilterOpType.md + +```markdown + +## FilterOpType + +|枚举值|字符串值|描述| +|---|---|---| +|FilterOpType.Or|"Or"|满足任一条件| +|FilterOpType.And|"And"|满足所有条件| + +``` + +## 226. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / RoleBuildInType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_RoleBuildInType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_RoleBuildInType.md + +```markdown +## RoleBuiltInType + +|枚举值|字符串值|描述| +|---|---|---| +|RoleBuiltInType.Custom|"Custom"|自定义角色| +|RoleBuiltInType.Manage|"Manage"|系统角色-可管理| +|RoleBuiltInType.View|"View"|系统角色-可查看| +|RoleBuiltInType.Edit|"Edit"|系统角色-可编辑| +|RoleBuiltInType.NoPermission|"NoPermission"|无权限| + +``` + +## 227. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / SharedLinkPermissionType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkPermissionType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkPermissionType.md + +```markdown +## SharedLinkPermissionType + +|枚举值|字符串值||描述| +|---|---|---|---| +|SharedLinkPermissionType.edit|"edit"|可编辑| +|SharedLinkPermissionType.read|"read"|可查看| +|SharedLinkPermissionType.addAndDel|"addAndDel"|可添加,删除| + +``` + +## 228. 开发指南 / WPS多维表格开发 / API文档 / API / 枚举值 / SharedLinkToType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkToType.md` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkToType.md + +```markdown +## SharedLinkToType + +|枚举值|字符串值||描述| +|---|---|---|---| +|SharedLinkToType.assigned|"assigned"|指定人| +|SharedLinkToType.anyone|"anyone"|所有人| +|SharedLinkToType.company|"company"|企业内成员| +|SharedLinkToType.onlylinkcreator|"onlylinkcreator"|链接创建者| +``` + +## 229. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Field对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field + +```markdown +# Field (对象) + + +## 说明 +网格视图的列属性,提供修改列宽和隐藏/显示列的方法 + +## 方法 +* [Copy](/app-integration-dev/guide/dbsheet/Api/Field_Copy) +* [Move](/app-integration-dev/guide/dbsheet/Api/Field_Move) + + +## 属性 +* [Id](/app-integration-dev/guide/dbsheet/Api/Field_Id) +* [Visible](/app-integration-dev/guide/dbsheet/Api/Field_Visible) +* [Name](/app-integration-dev/guide/dbsheet/Api/Field_Name) +* [Type](/app-integration-dev/guide/dbsheet/Api/Field_Type) +* [Width](/app-integration-dev/guide/dbsheet/Api/Field_Width) +* [FieldDescriptor](/app-integration-dev/guide/dbsheet/Api/Field_FieldDescriptor) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fields = await app.Sheets(1).Views(1).Fields + console.log(await fields.Item(1).Id) + } +``` + +## 脚本编辑器示例 +``` javascript +function main() { + const fields = Application.Sheets(1).Views(1).Fields + console.log(fields.Item(1).Id) +} +main() +``` +``` + +## 230. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / FieldDescriptor对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor + +```markdown +# FieldDescriptor (对象) + + +## 说明 +FieldDescriptor 描述了字段的属性,可以通过SetType修改字段的类型,修改属性之后需要主动调用Apply()方法使得修改生效。 +每次读取FieldDescriptor都会重新生成数据,所以修改前需要记录下当前的FieldDescriptor,才能正确调用Apply() +``` +const fieldDescriptor = Sheets(1).FieldDescriptors(1) +// 设置属性 +// .... +fieldDescriptor.Apply() +``` + +不同的字段类型有不同的属性设置,不是对应的字段类型,获取相关的属性时会返回null,无法正常设置 +|字段类型|特有的字段属性| +|----|----| +|按钮字段|[Button](/app-integration-dev/guide/dbsheet/Api/ButtonField)| +|地址字段|[Address](/app-integration-dev/guide/dbsheet/Api/AddressField)| +|级联字段|[Cascade](/app-integration-dev/guide/dbsheet/Api/CascadeField)| +|联系人字段|[Contact](/app-integration-dev/guide/dbsheet/Api/ContactField)| +|日期字段|[Date](/app-integration-dev/guide/dbsheet/Api/DateField)| +|最后修改人/最后修改时间|[Watch](/app-integration-dev/guide/dbsheet/Api/WatchedField)| +|公式字段|[Formula](/app-integration-dev/guide/dbsheet/Api/FormulaField)| +|引用/查找引用/统计|[Lookup](/app-integration-dev/guide/dbsheet/Api/LookupField)| +|单向关联/双向关联|[Link](/app-integration-dev/guide/dbsheet/Api/LinkField)| +|自动任务|[Automation](/app-integration-dev/guide/dbsheet/Api/AutomationField)| +|图片和附件|[Attachment](/app-integration-dev/guide/dbsheet/Api/AttachmentField)| +|超链接|[Url](/app-integration-dev/guide/dbsheet/Api/UrlField)| +|数字|[Number](/app-integration-dev/guide/dbsheet/Api/NumberField)| +|单选项/多选项|[Select](/app-integration-dev/guide/dbsheet/Api/SelectField)| +|等级|[Rating](/app-integration-dev/guide/dbsheet/Api/RatingField)| + +## 方法 +- [Apply](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Apply) +- [Delete](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete) + +## 属性 +- [Id](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Id) +- [Type](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type) +- [Name](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name) +- [Description](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Description) +- [IsSyncField](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsSyncField) +- [DefaultVal](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal) +- [DefaultValType](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultValType) +- [NumberFormat](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_NumberFormat) +- [IsValueUnique](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique) +- [Button](/app-integration-dev/guide/dbsheet/Api/ButtonField) +- [Address](/app-integration-dev/guide/dbsheet/Api/AddressField) +- [Cascade](/app-integration-dev/guide/dbsheet/Api/CascadeField) +- [Contact](/app-integration-dev/guide/dbsheet/Api/ContactField) +- [Date](/app-integration-dev/guide/dbsheet/Api/DateField) +- [Watch](/app-integration-dev/guide/dbsheet/Api/WatchedField) +- [Formula](/app-integration-dev/guide/dbsheet/Api/FormulaField) +- [Lookup](/app-integration-dev/guide/dbsheet/Api/LookupField) +- [Link](/app-integration-dev/guide/dbsheet/Api/LinkField) +- [Automation](/app-integration-dev/guide/dbsheet/Api/AutomationField) +- [Attachment](/app-integration-dev/guide/dbsheet/Api/AttachmentField) +- [Url](/app-integration-dev/guide/dbsheet/Api/UrlField) +- [Number](/app-integration-dev/guide/dbsheet/Api/NumberField) +- [Select](/app-integration-dev/guide/dbsheet/Api/SelectField) +- [Rating](/app-integration-dev/guide/dbsheet/Api/RatingField) + +## 事件 +- [OnUpdate](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate) +- [OnDelete](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldDescriptor = await app.Sheets(1).FieldDescriptors(1) + fieldDescriptor.Name = "修改字段名" + fieldDescriptor.Apply() + console.log(await fieldDescriptor.Name) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets(1).FieldDescriptors(1) + fieldDescriptor.Name = "修改字段名" + fieldDescriptor.Apply() + console.log(fieldDescriptor.Name) + } +main() +``` +``` + +## 231. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Apply + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Apply` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Apply + +```markdown +# FieldDescriptor.Apply(方法) + +## 说明 +修改属性后调用Apply()方法使修改生效 + +## 语法 +表达式.Apply() + +表达式:FieldDescriptor + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldId = app.Sheets(1).FieldId("修改前字段名") + const fieldDescriptor = app.Sheets(1).FieldDescriptors(fieldId) + fieldDescriptor.Name = "修改字段名" + fieldDescriptor.Apply() + console.log(fieldDescriptor.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const app = Application; + const fieldId = app.Sheets(1).FieldId("修改前字段名") + const fieldDescriptor = app.Sheets(1).FieldDescriptors(fieldId) + fieldDescriptor.Name = "修改字段名" + fieldDescriptor.Apply() + console.log(fieldDescriptor.Name) +} +main() +``` + +``` + +## 232. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / DefaultVal + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultVal + +```markdown +# 设置默认值 +FieldDescriptor.DefaultVal(属性) + + +## 说明 +可读写 + +设置默认值 + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + field.DefaultVal = "1" + field.Apply() + console.log(await field.DefaultVal) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + field.DefaultVal = "1" + field.Apply() + console.log(field.DefaultVal) +} +main() +``` +``` + +## 233. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / DefaultValType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultValType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_DefaultValType + +```markdown +# FieldDescriptor.DefaultValType(属性) + + +## 说明 +可读写 + +设置默认值类型 + +## 返回值 +Enum.DbFieldDefaultValueType + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + field.DefaultValType = app.Enum.DbFieldDefaultValueType.Normal + field.Apply() + console.log(await field.DefaultValType) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + field.DefaultValType = Enum.DbFieldDefaultValueType.Normal + field.Apply() + console.log(field.DefaultValType) +} +main() +``` +``` + +## 234. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Delete + +```markdown +# 删除字段 + +## 说明 +删除字段 + +## 语法 +表达式.Delete(RemoveReversedLink) + +表达式:FieldDescriptor + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|RemoveReversedLink|否|Boolean|| + + +## 返回值 +Boolean + + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + field.Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const app = Application; + const field = Application.Sheets(1).FieldDescriptors(2) + field.Delete() +} +main() +``` + +``` + +## 235. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Description + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Description` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Description + +```markdown +# FieldDescriptor.Description(属性) + + +## 说明 +可读写 + +字段的描述信息 + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const description = await app.Sheets(1).FieldDescriptors(2).Description; + console.log(description) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const description = Application.Sheets(1).FieldDescriptors(2).Description + console.log(description) +} +main() +``` +``` + +## 236. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Id + +```markdown +# FieldDescriptor.Id(属性) + + +## 说明 +只读 +返回字段的ID,用于标识字段 + +## 返回值 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const field = await WPSOpenApi.Application.Sheets(1).FieldDescriptors(2) + console.log(await field.Id) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.Id) +} +main() +``` +``` + +## 237. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / IsSyncField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsSyncField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsSyncField + +```markdown +# FieldDescriptor.SyncField(属性) + + +## 说明 +只读 +标记字段是否同步字段 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.SyncField) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.SyncField) +} +main() +``` +``` + +## 238. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / IsValueUnique + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_IsValueUnique + +```markdown +# 禁止录入重复值 +FieldDescriptor.ValueUnique(属性) + + +## 说明 +可读写 + +是否唯一值,禁止重复录入 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.ValueUnique) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.ValueUnique) +} +main() +``` +``` + +## 239. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Name + +```markdown +# 设置字段名称 +FieldDescriptor.Name(属性) + + +## 说明 +可读写 + +字段名称 + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + field.Name = "字段名" + field.Apply() + + console.log(await field.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + field.Name = "字段名" + field.Apply() + + console.log(await field.Name) +} +main() +``` +``` + +## 240. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / NumberFormat + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_NumberFormat` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_NumberFormat + +```markdown +# FieldDescriptor.NumberFormat(属性) + + + +## 说明 + +可读写 + +数字格式,可以设置日期/时间/数值等字段的显示数字格式 +可以设置内置的格式 +|字段类型|内建格式| +|---|---| +|货币|'¥','$','\"€\"','£'| + +### 货币 + +| 显示结果 | 内建格式 | +| -------- | --------- | +| '¥' | '¥' | +| '$' | '$' | +| '€' | '\\"€\\"' | +| '£' | '£' | + +### 数值 + +| 显示结果 | 内建格式 | +| ------------ | --------------- | +| '1234' | '0\_ ' | +| '1234.1' | '0.0\_ ' | +| '1234.10 ' | '0.00\_ ' | +| '1234.100' | '0.000\_ ' | +| '1234.1000' | '0.0000\_ ' | +| '1,234' | '#,##0\_ ' | +| '1,234.1' | '#,##0.0\_ ' | +| '1,234.10' | '#,##0.00\_ ' | +| '1,234.100' | '#,##0.000\_ ' | +| '1,234.1000' | '#,##0.0000\_ ' | + +### 百分比 + +| 显示结果 | 内建格式 | +| ---------- | --------- | +| '12%' | '0%' | +| '12.0%' | '0.0%' | +| '12.00% ' | '0.00%' | +| '12.000%' | '0.000%' | +| '12.0000%' | '0.0000%' | + +### 日期时间 + +| 显示结果 | 内建格式 | +| ----------------- | ----------------- | +| 2023/04/18 10:09 | 'yyyy/mm/dd h:mm' | + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2); + await field.NumberFormat; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2); + field.NumberFormat = '0.0000%'; + field.Apply(); +} +main(); +``` + +``` + +## 241. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / OnDelete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnDelete + +```markdown +# 监听删除字段的事件 +FieldDescriptor.OnDelete(方法) + + + +## 说明 + +为 FieldDescriptor 添加 Delete 事件,当删除 FieldDescriptor 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: FieldDescriptor + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptor.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| -------- | ------ | -------------- | +| sheetId | Number | 表的 Id | +| fieldId | String | 字段的 Id | +| fieldIds | Array | 字段集合的 Ids | + +## 事件返回数据示例 + +``` +{ + fieldId: "C" + fieldIds: ['C'] + sheetId: 1 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2); + let eventContext; + eventContext = await field.OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + await field.Delete(); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2); + let eventContext; + eventContext = field.OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + field.Delete(); + field.Delete(); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 242. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / OnUpdate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_OnUpdate + +```markdown +# 监听修改字段的事件 +FieldDescriptor.OnUpdate(方法) + + + +## 说明 + +为 FieldDescriptor 添加 Update 事件,当更新 FieldDescriptor 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnUpdate(Callback) + +表达式: FieldDescriptor + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ------ | ------------------| +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptor.OnUpdate(()=>{ ... }) | + +## 返回值 +EventContext + +## 事件返回数据 + +FieldDescriptor + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldId = app.Sheets(1).FieldId('修改前字段名'); + const fieldDescriptor = app.Sheets(1).FieldDescriptors(fieldId); + let eventContext + eventContext = await fieldDescriptor.OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy() + }); + + fieldDescriptor.Name = '修改字段名'; + fieldDescriptor.Apply(); + //这里会执行OnUpdate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const fieldDescriptor = Application.Sheets(1).FieldDescriptors(1); + let eventContext + eventContext = fieldDescriptor.OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy() + }); + fieldDescriptor.Name = '修改字段名'; + fieldDescriptor.Apply(); + //这里会执行OnUpdate的回调 +} +main(); +``` + +``` + +## 243. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptor / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor_Type + +```markdown +# 设置字段类型 +FieldDescriptor.Type + + +## 说明 +可读写 + +返回当前字段类型 + + +## 返回值 +|字段类型|描述| +|---|---| +|ID|身份证| +|Phone|电话| +|Email|电子邮箱| +|Url|超链接| +|Checkbox|复选框| +|SingleSelect|单选项| +|MultipleSelect|多选项| +|Rating|等级| +|Complete|进度条| +|CellPicture|单元格图片| +|Contact|联系人| +|Attachment|附件| +|Note|富文本字段,备注| +|Link|关联| +|OneWayLink|单向关联| +|Lookup|引用| +|Address|地址,特殊级联字段| +|Cascade|级联| +|Automations|触发器| +|AutoNumber|编号| +|CreatedBy|创建者| +|CreatedTime|创建时间| +|LastModifiedBy|最后修改者| +|LastModifiedTime|最后修改时间| +|Formula|公式| + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.Type) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(field.Type) +} +main() +``` +``` + +## 244. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / FieldDescriptors对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors + +```markdown +# FieldDescriptors (对象) + + +## 说明 +字段描述的集合,保存了文档所有的字段的信息 + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item) +- [FieldDescriptor](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_FieldDescriptor) +- [AddField](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField) +- [Delete](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Delete) + + + +## 属性 +- [Count](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Count) + +## 事件 +- [OnCreate](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldDescriptors = await app.Sheets(1).FieldDescriptors + } +``` +## 脚本编辑器 示例 +``` javascript +function main(){ +const sheet = Application.Sheets(1) +const sheet2 = Application.Sheets(2) +const lookupFieldId = sheet2.FieldId("文本") +// 创建关联字段到sheet2 +const linkField = Application.FieldDescriptor(Enum.DbSheetFieldType.OneWayLink, "关联字段到sheet2") +linkField.LinkSheet = sheet2.StId +linkField.IsAutoLink = false +/* +const linkGroups = Application.AutoLinkGroups() +const group = linkGroups.Add() +const conditions = group.Conditions +conditions.Add(lookupFieldId, [lookupFieldId], Enum.DbAutolinkCondType.Field, Enum.DbAutolinkCondType.DbFilterCriteriaOpType.Equals, ) +linkField.AutoLinkGroups = linkGroups +*/ +sheet.FieldDescriptors.AddField(linkField) + +// 创建引用字段 +const descriptor = Application.FieldDescriptor(Enum.DbSheetFieldType.Lookup, "引用关联字段到sheet2") +descriptor.LinkFieldId = sheet.FieldId("关联") +descriptor.LookupFieldId = lookupFieldId +sheet.FieldDescriptors.AddField(descriptor, 6) +} +main() +``` +``` + +## 245. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / AddField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_AddField + +```markdown +# 新增字段 + +## 说明 +往表中新增新的字段 + +## 语法 +表达式.AddField(FieldDescriptor, Index) + +表达式:FieldDescriptors + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|FieldDescriptor|是|FieldDescriptor|字段属性| +|Index|否|string/number|Index为string时表示字段ID,number时表示字段索引,插入位置,未指定时插入到末尾| + + + + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const desc = await app.FieldDescriptor("Rating","等级字段") + desc.MaxRating = 2 + await app.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const desc = FieldDescriptor("Rating","等级字段") + desc.MaxRating = 2 + await Application.Sheets(1).FieldDescriptors.AddField(desc, 1) +} +main() +``` + +``` + +## 246. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Count + +```markdown +# FieldDescriptors.Count(属性) + + +## 说明 +可读写 + +字段描述的个数 + +## 返回值 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.Sheets(1).FieldDescriptors.Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const count = Application.Sheets(1).FieldDescriptors.Count +} +main() +``` +``` + +## 247. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Delete + +```markdown +# FieldDescriptors.Delete(方法) + +## 说明 +删除字段 + +## 语法 +表达式.Delete(FieldId, RemoveReversedLink) + +表达式:FieldDescriptors + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|FieldId|是|string|字段Id,可以通过字段名获取Sheet.FieldId(fieldName)| +|RemoveReversedLink|否|boolean|是否同时删除引用| + +## 返回值 +Boolean + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldId = await app.Sheets(1).FieldId("数字") + app.Sheets(1).FieldDescriptors.Delete(fieldId) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldId = Application.Sheets(1).FieldId("数字") + app.Sheets(1).FieldDescriptors.Delete(fieldId) +} +main() +``` + +``` + +## 248. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / FieldDescriptor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_FieldDescriptor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_FieldDescriptor + +```markdown +# FieldDescriptors.FieldDescriptor(方法) + +## 说明 +FieldDescriptor对象 + +## 语法 +表达式.FieldDescriptor(Type,Name) + +表达式:FieldDescriptors + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Type|是||FieldDescriptor的类型| +|Name|是|string|FieldDescriptor的名称| + + +## 返回值 +FieldDescriptor + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldDescs = await app.Sheets(1).FieldDescriptors + const fieldDesc = fieldDescs.FieldDescriptor('Phone','电话') +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescs = Application.Sheets(1).FieldDescriptors + const fieldDesc = fieldDescs.FieldDescriptor('Phone','电话') +} +main() +``` + +``` + +## 249. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item + +```markdown +# FieldDescriptors.Item(方法) + +## 说明 +返回字段的信息,可以通过 FieldDescriptors.Item() 返回某个字段的信息,也可以简化使用FieldDescriptors(Index) 来返回字段信息。 + +## 语法 +表达式.Item(Index) + +表达式:FieldDescriptors + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|string/number|Index为number类型时表示当前字段的索引,Index为字段串类型的时候表示字段的Id或@字段名称| + + +## 返回值 +FieldDescriptor + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + console.log(await field.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + console.log(await field.Name) +} +main() +``` + +``` + +## 250. 开发指南 / WPS多维表格开发 / API文档 / API / FieldDescriptors / OnCreate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_OnCreate + +```markdown +# 监听增加字段的事件 +FieldDescriptors.OnCreate(方法) + + + +## 说明 + +为 FieldDescriptors 添加 Create 事件,当添加 FieldDescriptors 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnCreate(Callback) + +表达式: FieldDescriptors + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------| +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await FieldDescriptors.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +FieldDescriptor + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).FieldDescriptors.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const desc = await app.FieldDescriptor('Rating', '等级字段'); + desc.MaxRating = 2; + await app.Sheets(1).FieldDescriptors.AddField(desc, 1); + //这里会执行OnCreate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).FieldDescriptors.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const desc = Application.FieldDescriptor('Rating', '等级字段'); + desc.MaxRating = 2; + Application.Sheets(1).FieldDescriptors.AddField(desc, 1); + //这里会执行OnCreate的回调 +} +main(); +``` + +``` + +## 251. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Copy + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Copy + +```markdown +# 复制字段 + +## 说明 +复制当前字段到指定位置 + +## 语法 +表达式.Copy(Before,After) + +表达式:Field + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|String/Number|在Before之前插入复制字段| +|After|否|String/Number|在After之后插入复制字段| + + +## 返回值 +Self + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Copy(3) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + field.Copy(3) +} +main() +``` ` +``` + +## 252. 开发指南 / WPS多维表格开发 / API文档 / API / Field / FieldDescriptor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_FieldDescriptor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_FieldDescriptor + +```markdown +# Field.FieldDescriptor(属性) + + +## 说明 +只读 +字段的数据定义 + +## 返回值 +[FieldDescriptor](/app-integration-dev/guide/dbsheet/Api/FieldDescriptor) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1); + const desc = await field.FieldDescriptor; + console.log(await desc.Name); +} +``` +## 脚本编辑器示例 + +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1); + const desc = field.FieldDescriptor; + console.log(desc.Name); +} +main(); +``` +``` + +## 253. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Id + +```markdown +# Field.Id(属性) + + +## 说明 +只读 +视图字段的Id + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fields = await app.Sheets(1).Views(1).Fields + console.log(await fields.Item(1).Id) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + const fields = Application.Sheets(1).Views(1).Fields + console.log(fields.Item(1).Id) +} +main() +``` +``` + +## 254. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Move + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Move` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Move + +```markdown +# 移动字段 + +## 说明 +移动字段到指定位置 + +## 语法 +表达式.Move(Before,After) + +表达式:Field + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|String/Number|移动到Before字段之前| +|After|否|String/Number|移动到After字段之后| + + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Move(3) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + field.Move(3) +} +main() +``` ` +``` + +## 255. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Name + +```markdown +# Field.Name(属性) + + +## 说明 +只读 +视图字段的Name + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const name = await field.Name +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const name = field.Name + console.log(name) +} +main() +``` +``` + +## 256. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Type + +```markdown +# Field.Type(属性) + + +## 说明 +只读 +视图字段的Type + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const type = await field.Type +} +``` + +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const type = field.Type + console.log(type) +} +main() +``` +``` + +## 257. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Visible + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Visible + +```markdown +# 隐藏/显示字段 +Field.Visible(属性) + + +## 说明 +可读写 + +视图的字段是否可见 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + field.Visible = false +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const visible = field.Visible + console.log(visible) +} +main() +``` +``` + +## 258. 开发指南 / WPS多维表格开发 / API文档 / API / Field / Width + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Field_Width` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field_Width + +```markdown +# Field.Width(属性) + + +## 说明 +只读 +视图字段的Width + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields(1) + const Width = await field.Width +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields(1) + const width = field.Width + console.log(width) +} +main() +``` +``` + +## 259. 开发指南 / WPS多维表格开发 / API文档 / API / Fields / Fields对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Fields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Fields + +```markdown +# Fields (对象) + + +## 说明 +网格视图列的集合,可以访问视图的列属性,通过Item方法访问列时,注意列如果是隐藏了就无法通过索引获取,只能通过名称或者字段ID来获取 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/Fields_Item) + + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/Fields_Count) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fields = await app.Sheets(1).Views(1).Fields + console.log(await fields.Item(1).Name) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fields = Application.Sheets(1).Views(1).Fields + console.log(fields.Item(1).Name) +} +main() +``` +``` + +## 260. 开发指南 / WPS多维表格开发 / API文档 / API / Fields / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Fields_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Fields_Count + +```markdown +# FieldDescriptors.Count(属性) + + +## 说明 +可读写 + +字段描述的数量 + +## 返回值 + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.Sheets(1).FieldDescriptors.Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const count = Application.Sheets(1).FieldDescriptors.Count +} +main() +``` +``` + +## 261. 开发指南 / WPS多维表格开发 / API文档 / API / Fields / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Fields_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Fields_Item + +```markdown +# Fields.Item(方法) + +## 说明 +返回视图字段的信息,可以通过 Fields.Item() 返回某个字段的信息,也可以简化使用Fields(Index) 来返回字段信息。通过Item方法访问列时,注意列如果是隐藏了就无法通过索引获取,只能通过名称或者字段ID来获取。 + +## 语法 +表达式.Item(Index) + +表达式:Fields + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|string/number|Index为number类型时表示当前字段的索引,Index为字段串类型的时候, 如果是以@开头则表示是字段名,否则表示字段的Id| + + +## 返回值 +[Field](/app-integration-dev/guide/dbsheet/Api/Field) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Fields.Item(1) + console.log(await field.Id) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Fields.Item(1) + console.log(field) +} +main() +``` +``` + +## 262. 开发指南 / WPS多维表格开发 / API文档 / API / Filter / Filter对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter + +```markdown +# Filter (对象) + + + +## 说明 + +单条筛选记录 + +## 方法 + +- [Delete](/app-integration-dev/guide/dbsheet/Api/Filter_Delete) + +## 属性 + +- [FieldId](/app-integration-dev/guide/dbsheet/Api/Filter_FieldId) +- [FilterId](/app-integration-dev/guide/dbsheet/Api/Filter_FilterId) +- [Criteria](/app-integration-dev/guide/dbsheet/Api/Filter_Criteria) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const filter = filters.Item(1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const filter = filters.Item(1); +} +main(); +``` + +``` + +## 263. 开发指南 / WPS多维表格开发 / API文档 / API / Filter / Criteria + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Criteria` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_Criteria + +```markdown +# 设置筛选条件 +Filter.Criteria(属性) + + + +## 说明 + +可读写 + +设置或获取 单条筛选记录的条件 + +![alt text](https://cloudcdn.qwps.cn/open/_img/f9906a875c.png) + +## 返回值 + +[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria) + +## 浏览器环境示例 + +``` javascript +// 获取单条筛选记录的条件 +async function example() { + await instance.ready(); + const app = instance.Application; + // 获取筛选 + const filters = await app.Sheets(1).Views(1).Filters; + // 获取第一个条件 + const criteria = await filters.Item(1).Criteria; + console.log(criteria.Op) // "Equals" + console.log(criteria.Field) // 1 + console.log(criteria.Values[0]) // {type: 'Text', value: '1'} +} + +// 设置单条筛选记录的条件 +async function example() { + await instance.ready(); + const app = instance.Application; + // 构造筛选数据 + const Criteria = app.Criteria(1, "Equals", ["1"]) + // 设置筛选数据 + app.Sheets(1).Views(1).Filters.Item(1).Criteria = Criteria; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const criteria = Application.Sheets(1).Views(1).Filters.Item(1).Criteria; + criteria = Criteria(1, "Equals", ["1"]); +} +main(); +``` + +``` + +## 264. 开发指南 / WPS多维表格开发 / API文档 / API / Filter / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_Delete + +```markdown +# 删除筛选条件 +Filter.Delete(方法) + + + +## 说明 + +删除单条筛选记录 + +## 语法 + +表达式.Delete() + +表达式:Filter + +## 参数 + +无参数 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Filters(1).Delete(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Filters(1).Delete(); +} +main(); +``` + +``` + +## 265. 开发指南 / WPS多维表格开发 / API文档 / API / Filter / FieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_FieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_FieldId + +```markdown +# Filter.FieldId(属性) + + + +## 说明 + +可读 +获取单条筛选记录的字段 ID + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const fieldId = filters.Item(1).FieldId; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const fieldId = filters.Item(1).FieldId; +} +main(); +``` + +``` + +## 266. 开发指南 / WPS多维表格开发 / API文档 / API / Filter / FilterId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filter_FilterId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filter_FilterId + +```markdown +# Filter.FilterId(属性) + + +## 说明 +可读 +获取单条筛选记录的ID + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const filterId = filters.Item(1).FilterId; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const filterId = filters.Item(1).FilterId; +} +main() +``` +``` + +## 267. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Filters对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters + +```markdown +# Filters (对象) + + +## 说明 +获取指定视图下面的筛选列表 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/Filters_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/Filters_Add) +* [Clear](/app-integration-dev/guide/dbsheet/Api/Filters_Clear) + + +## 属性 +* [Operator](/app-integration-dev/guide/dbsheet/Api/Filters_Operator) +* [Count](/app-integration-dev/guide/dbsheet/Api/Filters_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + } +``` ` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; +} +main() +``` +``` + +## 268. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Add + +```markdown +# 添加筛选条件 +Filters.Add(方法) + +## 说明 +添加筛选条件 + +![alt text](https://cloudcdn.qwps.cn/open/_img/f9906a875c.png) + +## 语法 +表达式.Add(Criteria) + +表达式:Filters + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Criteria|是|Object|筛选条件| + + +## 返回值 +Filter + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const criteria = app.Criteria(1, 'Equals', ['1']) + const filter = await filters.Add(criteria); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const criteria = Application.Criteria(1, 'Equals', ['1']) + const filter = filters.Add(criteria); +} +main() +``` +``` + +## 269. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Clear + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Clear` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Clear + +```markdown +# Filters.Clear(方法) + +## 说明 +删除视图下面的所有筛选条件或者删除视图下面指定字段类型的所有筛选条件 + +## 语法 +表达式.Clear(FieldId) + +表达式:Filters + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|FieldId|否|string|字段ID| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +// 删除视图下面的所有筛选条件 +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const result = filters.Clear(); +} + +// 同一字段支持多条件筛选时,Clear(fieldId)可以删除该字段下面的所有条件筛选 +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const result = filters.Clear('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const result = filters.Clear(); +// const result = filters.Clear('B'); +} +main() +``` +``` + +## 270. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Count + +```markdown +# Filters.Count(属性) + + +## 说明 +可读 +返回筛选列表的个数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const count = filters.Count; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const count = filters.Count; +} +main() +``` + +``` + +## 271. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Item + +```markdown +# Filters.Item(方法) + + + +## 说明 + +获取指定索引位置的单条筛选条件 + +## 语法 + +表达式.Item(Index) + +表达式:Filters + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始 | + +## 返回值 + +Filter + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const filter = filters.Item(1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const filter = filters.Item(1); +} +main(); +``` + +``` + +## 272. 开发指南 / WPS多维表格开发 / API文档 / API / Filters / Operator + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Filters_Operator` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Filters_Operator + +```markdown +# Filters.Operator(属性) + + + +## 说明 + +可读写 + +设置或返回头部筛选条件 + +## 返回值 + +[FilterOpType](/app-integration-dev/guide/dbsheet/Api/Enum_FilterOpType) + +## 浏览器环境示例 + +``` javascript +// 获取筛选的头部筛选条件 +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; + const operator = filters.Operator; +} + +// 设置筛选的头部筛选条件 +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(1).Filters.Operator = FilterOpType.Or; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; + const operator = filters.Operator; + operator = FilterOpType.Or; +} +main(); +``` + +``` + +## 273. 开发指南 / WPS多维表格开发 / API文档 / API / Font / Font对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Font` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Font + +```markdown +# Font (对象) + + +## 说明 +字体对象 + +## 属性 +- [Color](/app-integration-dev/guide/dbsheet/Api/Font_Color) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const font = await app.Sheets(1).Views(1).RecordRange(10).Font + console.log(await font.Color) + font.Color = "#00ff00" +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const font = Application.Sheets(1).Views(1).RecordRange(10).Font + console.log(font.Color) + font.Color = "#00ff00" + } +main() +``` +``` + +## 274. 开发指南 / WPS多维表格开发 / API文档 / API / Font / Color + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Font_Color` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Font_Color + +```markdown +# 字体颜色属性 +Font.Color(属性) + + + +## 说明 + +可读写 + +设置或者获取字体颜色属性 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const font = await app.Sheets(1).Views(1).RecordRange(10).Font + console.log(await font.Color) + font.Color = "#00ff00" +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const font = Application.Sheets(1).Views(1).RecordRange(10).Font + console.log(font.Color) + font.Color = "#00ff00" +} +main(); +``` + +``` + +## 275. 开发指南 / WPS多维表格开发 / API文档 / API / FormView / FormView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormView + +```markdown +# FormView (对象) + + + +## 说明 + +表单视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +## 属性 + +- [RequiredFields](/app-integration-dev/guide/dbsheet/Api/FormView_RequiredFields) + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const formView = await app.Sheets(1).Views(2); + console.log(formView.Name); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const formView = Application.Sheets(1).Views(2); + console.log(formView.Name); +} +main(); +``` + +``` + +## 276. 开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / FormViewUI对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormViewUI + +```markdown +# FormViewUI (对象) + + +## 说明 +表单界面对象 + +## 方法 +* [FillInForm](/app-integration-dev/guide/dbsheet/Api/FormViewUI_FillInForm) +* [DesignForm](/app-integration-dev/guide/dbsheet/Api/FormViewUI_DesignForm) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const formViewUI = await app.Window.FormViewUI + } +``` +``` + +## 277. 开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / DesignForm + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI_DesignForm` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormViewUI_DesignForm + +```markdown +# FormViewUI.DesignForm(方法) + + +## 说明 +表单视图【编辑表单】模式 + +## 返回值 +[ApiResult](/app-integration-dev/guide/dbsheet/Api/ApiResult) + +## 浏览器环境示例 +``` javascript +async function main() { + await instance.ready(); + const app = instance.Application; + const formViewUI = await app.Window.FormViewUI; + formViewUI.DesignForm(); +} +``` +``` + +## 278. 开发指南 / WPS多维表格开发 / API文档 / API / FormViewUI / FillInForm + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormViewUI_FillInForm` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormViewUI_FillInForm + +```markdown +# FormViewUI.FillInForm(方法) + + +## 说明 +表单视图【填写表单】模式 + + +## 返回值 +[ApiResult](/app-integration-dev/guide/dbsheet/Api/ApiResult) + +## 浏览器环境示例 +``` javascript +async function main() { + await instance.ready(); + const app = instance.Application; + const formViewUI = await app.Window.FormViewUI; + formViewUI.FillInForm(); +} +``` +``` + +## 279. 开发指南 / WPS多维表格开发 / API文档 / API / FormView / RequiredFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormView_RequiredFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormView_RequiredFields + +```markdown +# FormViewUI.RequiredFields(属性) + + +## 说明 +可读写 + +表单视图下字段必填属性 + + +## 返回值 +Array 表单视图下所有必填字段的字段ID组成的数组 +``` javascript +[ + 'B', + 'C', +] +``` + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const currentRequiredFields = app.Sheets(1).Views(2).RequiredFields + // 设置文本字段和数字字段为必填 + app.Sheets(1).Views(2).RequiredFields = ['@文本', '@数字'] +} +``` +``` + +## 280. 开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / FormulaField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormulaField + +```markdown +# FormulaField (对象) + + +## 说明 +FormulaField 公式字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非公式字段,无法设置相关属性 + +## 属性 +- [Formula](/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula) +- [ValueType](/app-integration-dev/guide/dbsheet/Api/FormulaField_ValueType) +- [IsShowPercentAsProgress](/app-integration-dev/guide/dbsheet/Api/FormulaField_IsShowPercentAsProgress) + +## 浏览器环境示例 +``` javascript +async function example() { + // 新建一个公式字段 + await instance.ready(); + const app = instance.Application; + const fieldDescriptors = await app.Sheets("数据表").FieldDescriptors + const desc = await app.FieldDescriptor("Formula","公式字段") + const prop = await desc.Formula + prop.Formula = '=[@日期]+[@日期]' + prop.IsShowPercentAsProgress = true + const result = await fieldDescriptors.AddField(desc) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 新建一个公式字段 + const fieldDescriptors = Application.Sheets("数据表").FieldDescriptors + const desc = FieldDescriptor("Formula","公式字段") + const prop = desc.Formula + prop.Formula = '=[@日期]+[@日期]' + prop.IsShowPercentAsProgress = true + const result = fieldDescriptors.AddField(desc) + } +main() +``` +``` + +## 281. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 公式字段 / 公式的文本表达式 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula + +```markdown +# 设置公式的文本表达式 +FieldDescriptor.Formula(属性) + + +## 说明 +可读写 + +公式字段 返回公式的文本表达式 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = await fieldDescriptor.Formula + prop.Formula = '=[@日期]+[@日期]' + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = fieldDescriptor.Formula + prop.Formula = '=[@日期]+[@日期]' + fieldDescriptor.Apply() +} +main() +``` +``` + +## 282. 开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / Formula + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormulaField_Formula + +```markdown +# 设置公式的文本表达式 +FieldDescriptor.Formula(属性) + + +## 说明 +可读写 + +公式字段 返回公式的文本表达式 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = await fieldDescriptor.Formula + prop.Formula = '=[@日期]+[@日期]' + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = fieldDescriptor.Formula + prop.Formula = '=[@日期]+[@日期]' + fieldDescriptor.Apply() +} +main() +``` +``` + +## 283. 开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / IsShowPercentAsProgress + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_IsShowPercentAsProgress` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormulaField_IsShowPercentAsProgress + +```markdown +# FormulaField.IsShowPercentAsProgress(属性) + + +## 说明 +可读写 + +公式字段 “将百分比显示为进度” 属性, 只有当字段属性ValueType 设置为 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = await fieldDescriptor.Formula + prop.IsShowPercentAsProgress = true + fieldDescriptor.Apply() + console.log(await prop.IsShowPercentAsProgress) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = fieldDescriptor.Formula + prop.IsShowPercentAsProgress = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 284. 开发指南 / WPS多维表格开发 / API文档 / API / FormulaField / ValueType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/FormulaField_ValueType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FormulaField_ValueType + +```markdown +# FormulaField.ValueType(属性) + + +## 说明 +只读 +公式字段返回的格式,根据公式的结果返回相关的类型 + +## 返回值 +[DbFieldValueType](/app-integration-dev/guide/dbsheet/Api/Enum_DbFieldValueType) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = await fieldDescriptor.Formula + console.log(await prop.ValueType) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@公式") + const prop = fieldDescriptor.Formula + console.log(prop.ValueType) +} +main() +``` +``` + +## 285. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / GanttView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView + +```markdown +# GanttView (对象) + + + +## 说明 + +甘特视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[BeginField](/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField)|开始日期字段|可读写| +|[EndField](/app-integration-dev/guide/dbsheet/Api/GanttView_EndField)|结束日期字段|可读写| +|[IsOnlyWorkDay](/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay)|是否忽略节假日|可读写| +|[TimelineColor](/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor)|事件线颜色|可读写| +|[TimelineColorFollowField](/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorFollowField)|事件线颜色跟随字段|可读写| +|[TimelineColorType](/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorType)|事件线颜色类型|可读写| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); +} +main(); +``` + +``` + +## 286. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / GanttViewUI对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI + +```markdown +# GanttViewUI (对象) + + +## 说明 +甘特图界面对象 + +## 方法 +|方法|说明| +|-|-| +|[Today](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today)|跳转到今天| +|[NextPage](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_NextPage)|跳转到下一页| +|[PrevPage](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage)|跳转到前一页| +|[FoldAll](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_FoldAll)|折叠分组| +|[UnFoldAll](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_UnFoldAll)|展开分组| + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[GanttGridFold](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold)|甘特图字段显示是否折叠|可读写| +|[ViewMode](/app-integration-dev/guide/dbsheet/Api/GanttViewUI_ViewMode)|甘特视图的模式|可读写| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.GanttViewUI + } +``` +``` + +## 287. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 设置折叠 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold + +```markdown +# 设置折叠 +GanttViewUI.GanttGridFold + + +## 说明 +可读写 +设置甘特图字段显示是否折叠 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + // 设置折叠 + GanttViewUI.GanttGridFold = true +} +``` +``` + +## 288. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / GanttGridFold + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_GanttGridFold + +```markdown +# 设置折叠 +GanttViewUI.GanttGridFold + + +## 说明 +可读写 +设置甘特图字段显示是否折叠 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + // 设置折叠 + GanttViewUI.GanttGridFold = true +} +``` +``` + +## 289. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / NextPage + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_NextPage` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_NextPage + +```markdown +# 时间线操作-定位下一页 +GanttViewUI.NextPage(方法) + + +## 说明 +跳转到下一页 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.NextPage() +} +``` +``` + +## 290. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 定位上一页 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage + +```markdown +# 时间线操作-定位上一页 +GanttViewUI.PrevPage + + +## 说明 +跳转到上一页 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.PrevPage() +} +``` +``` + +## 291. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / PrevPage + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_PrevPage + +```markdown +# 时间线操作-定位上一页 +GanttViewUI.PrevPage + + +## 说明 +跳转到上一页 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.PrevPage() +} +``` +``` + +## 292. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 定位至今天 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today + +```markdown +# 时间线操作-定位至今天 +GanttViewUI.Today(方法) + + +## 说明 +跳转到今天 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.Today() +} +``` +``` + +## 293. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / Today + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_Today + +```markdown +# 时间线操作-定位至今天 +GanttViewUI.Today(方法) + + +## 说明 +跳转到今天 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.Today() +} +``` +``` + +## 294. 开发指南 / WPS多维表格开发 / API文档 / API / GanttViewUI / ViewMode + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttViewUI_ViewMode` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttViewUI_ViewMode + +```markdown +# 模式 +GanttViewUI.ViewMode + + +## 说明 +可读写 +甘特视图的模式,注意:设置值时为以下之一:'Week','Month','Quarter','Year' . + +## 返回值 +String + + +## 浏览器环境示例 +``` javascript +async function today() { + await instance.ready(); + const app = instance.Application; + const GanttViewUI = await app.Window.GanttViewUI + GanttViewUI.ViewMode = "week" +} +``` +``` + +## 295. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 开始日期字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField + +```markdown +# 开始日期字段 + + + +## 说明 + +可读写 + +开始日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.BeginField); + ganttView.BeginField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.BeginField); + ganttView.BeginField = 's'; +} +main(); +``` + +``` + +## 296. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / BeginField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_BeginField + +```markdown +# 开始日期字段 + + + +## 说明 + +可读写 + +开始日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.BeginField); + ganttView.BeginField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.BeginField); + ganttView.BeginField = 's'; +} +main(); +``` + +``` + +## 297. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / Calendars + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_Calendars` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_Calendars + +```markdown +# 自定义日历 +GanttView.Calendars + + + +## 说明 + +可读写 + +自定义日历。 + +## 返回值 + +``` javascript +{ + isDefault?: boolean, // 是否为默认日历 + name?: string, // 日历名称(暂不支持指定) + locality?: number, // 地区编码 + weekend?: number[], // 值为0-6其中之一 (6,0代表周六、周日) + customWorkday?: number[], // 同上 + customHoliday?: number[], // 同上 + ignoreLawHoliday?: boolean, // 是否忽略法定节假日 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.Calendars); + ganttView.Calendars = + { + isDefault: true, + name: '自定义日历', + locality: 156, + weekend: [6, 0], + customWorkday: [1, 2, 3, 4, 5], + customHoliday: [], + ignoreLawHoliday: true, + } +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.Calendars); + ganttView.Calendars = + { + isDefault: true, + name: '自定义日历', + locality: 156, + weekend: [6, 0], + customWorkday: [1, 2, 3, 4, 5], + customHoliday: [], + ignoreLawHoliday: true, + } +} +main(); +``` + +``` + +## 298. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 结束日期字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_EndField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_EndField + +```markdown +# 结束日期字段 + + + +## 说明 + +可读写 + +结束日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.EndField); + ganttView.EndField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.EndField); + ganttView.EndField = 's'; +} +main(); +``` + +``` + +## 299. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / EndField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_EndField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_EndField + +```markdown +# 结束日期字段 + + + +## 说明 + +可读写 + +结束日期字段,值为字段 ID. + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.EndField); + ganttView.EndField = 's'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.EndField); + ganttView.EndField = 's'; +} +main(); +``` + +``` + +## 300. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 工时统计 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay + +```markdown +# 工时统计-忽略节假日 + +GanttView.IsOnlyWorkDay + + + +## 说明 + +可读写 + +是否忽略节假日。 + +## 返回值 + +boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); + ganttView.IsOnlyWorkDay = false; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); + ganttView.IsOnlyWorkDay = true; +} +main(); +``` + +``` + +## 301. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / IsOnlyWorkDay + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_IsOnlyWorkDay + +```markdown +# 工时统计-忽略节假日 + +GanttView.IsOnlyWorkDay + + + +## 说明 + +可读写 + +是否忽略节假日。 + +## 返回值 + +boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); + ganttView.IsOnlyWorkDay = false; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.IsOnlyWorkDay); + ganttView.IsOnlyWorkDay = true; +} +main(); +``` + +``` + +## 302. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 甘特视图 / 时间线颜色 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor + +```markdown +# 时间线颜色 + +GanttView.TimelineColor + + + +## 说明 + +可读写 + +时间线颜色,值为Hex格式的RGB颜色值,如:#FF0000。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.TimelineColor); + ganttView.TimelineColor = '#97E4E4'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.TimelineColor); + ganttView.TimelineColor = '#97E4E4'; +} +main(); +``` + +``` + +## 303. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColor + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColor + +```markdown +# 时间线颜色 + +GanttView.TimelineColor + + + +## 说明 + +可读写 + +时间线颜色,值为Hex格式的RGB颜色值,如:#FF0000。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.TimelineColor); + ganttView.TimelineColor = '#97E4E4'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.TimelineColor); + ganttView.TimelineColor = '#97E4E4'; +} +main(); +``` + +``` + +## 304. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColorFollowField + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorFollowField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorFollowField + +```markdown +# 事件线颜色跟随字段 + + + +## 说明 + +可读写 + +事件线颜色跟随字段,值为字段Id。 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.TimelineColorFollowField); + ganttView.TimelineColorFollowField = 'E'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.TimelineColorFollowField); + ganttView.TimelineColorFollowField = 'E'; +} +main(); +``` + +``` + +## 305. 开发指南 / WPS多维表格开发 / API文档 / API / GanttView / TimelineColorType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GanttView_TimelineColorType + +```markdown +# 事件线颜色类型 + + + +## 说明 + +可读写 + +事件线颜色类型,值为'Custom'(自定义颜色)或'Follow'(跟随单选项字段) + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttView = await app.Sheets(1).Views(1); + console.log(ganttView.TimelineColorType); + ganttView.TimelineColor = 'Custom'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const ganttView = Application.Sheets(1).Views(1); + console.log(ganttView.TimelineColorType); + ganttView.TimelineColor = 'Follow'; +} +main(); +``` + +``` + +## 306. 开发指南 / WPS多维表格开发 / API文档 / API / GridView / GridView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GridView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GridView + +```markdown +# GridView (对象) + + + +## 说明 + +表格视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[RowHeight](/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight)|表格视图的行高|可读写| +|[FrozenCols](/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols)|表格视图的冻结列数|可读写| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridView = await app.Sheets(1).Views(1); + console.log(gridView.RowHeight); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const gridView = Application.Sheets(1).Views(1); + console.log(gridView.RowHeight); +} +main(); +``` + +``` + +## 307. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 表格视图 / 冻结列数 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols + +```markdown +# 冻结列数 +GridView.FrozenCols + + + +## 说明 + +可读写 + +表格视图的冻结列数 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridView = await app.Sheets(1).Views(1); + console.log(gridView.FrozenCols); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const gridView = Application.Sheets(1).Views(1); + console.log(gridView.FrozenCols); +} +main(); +``` + +``` + +## 308. 开发指南 / WPS多维表格开发 / API文档 / API / GridView / FrozenCols + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GridView_FrozenCols + +```markdown +# 冻结列数 +GridView.FrozenCols + + + +## 说明 + +可读写 + +表格视图的冻结列数 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridView = await app.Sheets(1).Views(1); + console.log(gridView.FrozenCols); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const gridView = Application.Sheets(1).Views(1); + console.log(gridView.FrozenCols); +} +main(); +``` + +``` + +## 309. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 表格视图 / 行高 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight + +```markdown +# 行高 +GridView.RowHeight + + +## 说明 + +可读写 + +表格视图的行高,注意:设置值时为以下之一:'Short','Medium','Tall','ExtraTall' . + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridView = await app.Sheets(1).Views(1); + console.log(gridView.RowHeight); + gridView.RowHeight = 'Tall'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const gridView = Application.Sheets(1).Views(1); + console.log(gridView.RowHeight); + gridView.RowHeight = 'Tall'; +} +main(); +``` + +``` + +## 310. 开发指南 / WPS多维表格开发 / API文档 / API / GridView / RowHeight + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/GridView_RowHeight + +```markdown +# 行高 +GridView.RowHeight + + +## 说明 + +可读写 + +表格视图的行高,注意:设置值时为以下之一:'Short','Medium','Tall','ExtraTall' . + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridView = await app.Sheets(1).Views(1); + console.log(gridView.RowHeight); + gridView.RowHeight = 'Tall'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const gridView = Application.Sheets(1).Views(1); + console.log(gridView.RowHeight); + gridView.RowHeight = 'Tall'; +} +main(); +``` + +``` + +## 311. 开发指南 / WPS多维表格开发 / API文档 / API / Group / Group对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group + +```markdown +# Group (对象) + + +## 说明 +单条分组记录 + +## 方法 +* [Delete](/app-integration-dev/guide/dbsheet/Api/Group_Delete) + + +## 属性 +* [IsAscending](/app-integration-dev/guide/dbsheet/Api/Group_IsAscending) +* [Unit](/app-integration-dev/guide/dbsheet/Api/Group_Unit) +* [Field](/app-integration-dev/guide/dbsheet/Api/Group_Field) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups(1); + } +``` ` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups(1); +} +main() +``` +``` + +## 312. 开发指南 / WPS多维表格开发 / API文档 / API / Group / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group_Delete + +```markdown +# 删除分组 +Group.Delete(方法) + +## 说明 +删除分组条件 + +## 语法 +表达式.Delete() + +表达式:Group + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups(1).Delete(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups(1).Delete(); +} +main() +``` +``` + +## 313. 开发指南 / WPS多维表格开发 / API文档 / API / Group / Field + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group_Field` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group_Field + +```markdown +# Group.Field(属性) + + +## 说明 +可读写 + +分组字段 + +## 返回值 +Field + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).Views(1).Groups(1).Field; + + // 设置分组条件字段 + const group = await app.Sheets(1).Views(1).Groups(1); + group.Field = '@数字'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).Views(1).Groups(1).Field; + + // 设置分组条件字段 + const group = Application.Sheets(1).Views(1).Groups(1); + group.Field = '@数字'; +} +main() +``` +``` + +## 314. 开发指南 / WPS多维表格开发 / API文档 / API / Group / IsAscending + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group_IsAscending` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group_IsAscending + +```markdown +# Group.IsAscending(属性) + + +## 说明 +可读写 + +是否为升序 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const isAscending = await app.Sheets(1).Views(1).Groups(1).IsAscending; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const isAscending = Application.Sheets(1).Views(1).Groups(1).IsAscending; +} +main() +``` +``` + +## 315. 开发指南 / WPS多维表格开发 / API文档 / API / Group / Unit + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Group_Unit` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Group_Unit + +```markdown +# Group.Unit(属性) + + + +## 说明 + +可读写 + +返回单个分组条件单位 + +只支持设置字段类型为日期/创建时间/最后修改时间的分组单位和值类型为日期类型的公式字段 + +## 返回值 + +[DbGroupUnit](/app-integration-dev/guide/dbsheet/Api/Enum_DbGroupUnit) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const unit = await app.Sheets(1).Views(1).Groups(1).Unit; + + // 设置分组单位 + const dateGroup = await app.Sheets(1).Views(1).Groups(3); + dateGroup.Unit = 'Week'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const unit = Application.Sheets(1).Views(1).Groups(1).Unit; + + // 设置分组单位 + const dateGroup = Application.Sheets(1).Views(1).Groups(3); + dateGroup.Unit = 'Week'; +} +main(); +``` + +``` + +## 316. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / Groups对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups + +```markdown +# Groups (对象) + + +## 说明 +获取指定视图下面的分组列表 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/Groups_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/Groups_Add) +* [FoldAll](/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll) +* [UnFoldAll](/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll) + + +## 属性 +* [IsTempUnFold](/app-integration-dev/guide/dbsheet/Api/Groups_IsTempUnFold) +* [Count](/app-integration-dev/guide/dbsheet/Api/Groups_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const groups = await app.Sheets(1).Views(1).Groups; + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const groups = Application.Sheets(1).Views(1).Groups; +} +main() +``` +``` + +## 317. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_Add + +```markdown +# 添加分组 +Groups.Add(方法) + + + +## 说明 + +添加分组 + +## 语法 +表达式.Add(Field, IsAscending) + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Field|是|number/string|新增分组字段索引/新增分组字段ID/新增分组字段名| +|IsAscending|否|boolean|是否是升序| + +## 返回值 +Group + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.Add(1); + // const res = await app.Sheets(1).Views(1).Groups.Add("@数量"); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.Add(1); + // const res = Application.Sheets(1).Views(1).Groups.Add("@数量"); +} +main(); +``` + +``` + +## 318. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_Count + +```markdown +# Groups.Count(属性) + + +## 说明 +可读 +返回分组列表的个数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.Sheets(1).Views(1).Groups.Count; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const count = await app.Sheets(1).Views(1).Groups.Count; +} +main() +``` +``` + +## 319. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / FoldAll + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_FoldAll + +```markdown +# 折叠分组 +Groups.FoldAll(方法) + +## 说明 +折叠分组 + +## 语法 +表达式.FoldAll() + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.FoldAll(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.FoldAll(); +} +main() +``` +``` + +## 320. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / IsTempUnFold + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_IsTempUnFold` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_IsTempUnFold + +```markdown +# Groups.IsTempUnFold(属性) + + +## 说明 +可读 +是否支持临时展开分组 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const isTempUnFold = await app.Sheets(1).Views(1).Groups.IsTempUnFold; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const isTempUnFold = Application.Sheets(1).Views(1).Groups.IsTempUnFold; +} +main() +``` +``` + +## 321. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_Item + +```markdown +# Groups.Item(方法) + +## 说明 +通过索引位置或者字段ID获取单条分组记录 + +## 语法 +表达式.Item(Index) + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|获取的分组字段索引/获取的分组字段ID| + + +## 返回值 +Group + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups(1); + // const res = await app.Sheets(1).Views(1).Groups('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups(1); + // const res = Application.Sheets(1).Views(1).Groups('B'); +} +main() +``` +``` + +## 322. 开发指南 / WPS多维表格开发 / API文档 / API / Groups / UnFoldAll + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Groups_UnFoldAll + +```markdown +# 展开分组 +Groups.UnFoldAll(方法) + +## 说明 +展开分组 + +## 语法 +表达式.UnFoldAll() + +表达式:Groups + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const res = await app.Sheets(1).Views(1).Groups.UnFoldAll(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const res = Application.Sheets(1).Views(1).Groups.UnFoldAll(); +} +main() +``` +``` + +## 323. 开发指南 / WPS多维表格开发 / API文档 / API / Interior / Interior对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Interior` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Interior + +```markdown +# Interior (对象) + + +## 说明 +单元格内部填充对象 + +## 属性 +- [Color](/app-integration-dev/guide/dbsheet/Api/Interior_Color) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const interior = await app.Sheets(1).Views(1).RecordRange(10).Interior + console.log(await interior.Color) + interior.Color = "#00ff00" +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const interior = Application.Sheets(1).Views(1).RecordRange(10).Interior + console.log(interior.Color) + interior.Color = "#00ff00" + } +main() +``` +``` + +## 324. 开发指南 / WPS多维表格开发 / API文档 / API / Interior / Color + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Interior_Color` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Interior_Color + +```markdown +# 设置背景颜色 +Interior.Color(属性) + + + +## 说明 + +可读写 + +设置背景颜色属性 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const interior = await app.Sheets(1).Views(1).RecordRange(10).Interior + console.log(await interior.Color) + interior.Color = "#00ff00" +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const interior = Application.Sheets(1).Views(1).RecordRange(10).Interior + console.log(interior.Color) + interior.Color = "#00ff00" +} +main(); +``` + +``` + +## 325. 开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / KanbanView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/KanbanView + +```markdown +# KanbanView (对象) + + + +## 说明 + +看板视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +- [MoveUnGroupToFirst](/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToFirst) +- [MoveUnGroupToLast](/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToLast) +- [SetGroupCondition](/app-integration-dev/guide/dbsheet/Api/KanbanView_SetGroupCondition) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const kanbanView = await app.Sheets(1).Views(1); + console.log(kanbanView.Type); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const kanbanView = Application.Sheets(1).Views(1); + console.log(kanbanView.Type); +} +main(); +``` + +``` + +## 326. 开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / MoveUnGroupToFirst + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToFirst` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToFirst + +```markdown +# KanbanView.MoveUnGroupToFirst(方法) + + + +## 说明 + +移动“未分组”分组到最前面 + +## 参数 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).Views(1).MoveUnGroupToFirst(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets(1).Views(1).MoveUnGroupToFirst(); +} +main(); +``` + +``` + +## 327. 开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / MoveUnGroupToLast + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToLast` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/KanbanView_MoveUnGroupToLast + +```markdown +# KanbanView.MoveUnGroupToLast(方法) + + + +## 说明 + +移动“未分组”分组到最后面 + +## 参数 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).Views(1).MoveUnGroupToLast(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets(1).Views(1).MoveUnGroupToLast(); +} +main(); +``` + +``` + +## 328. 开发指南 / WPS多维表格开发 / API文档 / API / KanbanView / SetGroupCondition + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/KanbanView_SetGroupCondition` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/KanbanView_SetGroupCondition + +```markdown +# KanbanView.SetGroupCondition(方法) + + + +## 说明 + +设置看板视图分组依据 + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|FieldId|是|string|字段ID| + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).Views(1).SetGroupCondition('B'); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets(1).Views(1).SetGroupCondition('B'); +} +main(); +``` + +``` + +## 329. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField + +```markdown +# LinkField (对象) + + +## 说明 +LinkField 关联字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非关联字段,无法设置相关属性 + +## 属性 +- [LinkSheet](/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet) +- [IsAutoLink](/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink) +- [IsSupportMultiLinks](/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks) +- [LinkView](/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView) +- [AutoLinkGroups](/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = await Application.Sheets("数据表").FieldDescriptors("@单向关联") + const prop = await fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = Sheets("数据表").FieldDescriptors("@单向关联") + const prop = fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() + } +main() +``` +``` + +## 330. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关系组集合 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups + +```markdown +# 设置关系组集合 +FieldDescriptor.AutoLinkGroups(属性) + + +## 说明 +可读写 + +设置或读取 关联字段的关系组集合,如果有多个关系组,则这些关系组是或的关系 + +![alt text](https://cloudcdn.qwps.cn/open/_img/d3038f506e.png) + +## 返回值 +AutoLinkGroups + +## 浏览器环境示例 +``` javascript +// 设置数据表的关联字段的匹配条件 +// 匹配到数据表2:数据表2的状态字段 = 数据表的文本字段,如下设置: +async function example() { + await instance.ready(); + const Application = instance.Application; + // 数据表 + const sheet = Application.Sheets(1) + // 数据表的字段 + const fieldId = await sheet.FieldId("文本") + // 数据表的关联字段 + const linkField = await sheet.FieldDescriptors("@关联") + const prop = linkField.Link + const linkGroups = await Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + // 关联的数据表2 + const linkSheet = await Application.Sheets(2) + // 关联数据表2的字段 + const linkSheet_fieldId = await linkSheet.FieldId("状态") + // 生成匹配条件 + conditions.Add(linkSheet_fieldId, [fieldId], "Field", "Equals") + // 设置关联字段的匹配条件 + prop.AutoLinkGroups = linkGroups + // 设置自动关联 + prop.IsAutoLink = true + linkField.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const sheet = Application.Sheets(1) + const fieldId = sheet.FieldId("状态") + // 获取关联字段 + const linkField = sheet.FieldDescriptors("@关联") + const prop = linkField.Link + const linkGroups = Application.AutoLinkGroups() + const conditions = linkGroups.Conditions + // 关联的数据表2 + const linkSheet = Application.Sheets(2) + // 关联数据表2的字段 + const linkSheet_fieldId = linkSheet.FieldId("状态") + // 生成匹配条件 + conditions.Add(linkSheet_fieldId, [fieldId], "Field", "Equals") + // 设置关联字段的匹配条件 + prop.AutoLinkGroups = linkGroups + // 设置自动关联 + prop.IsAutoLink = true + linkField.Apply() +} +main() +``` +``` + +## 331. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / AutoLinkGroups + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_AutoLinkGroups + +```markdown +# 设置关系组集合 +FieldDescriptor.AutoLinkGroups(属性) + + +## 说明 +可读写 + +设置或读取 关联字段的关系组集合,如果有多个关系组,则这些关系组是或的关系 + +![alt text](https://cloudcdn.qwps.cn/open/_img/d3038f506e.png) + +## 返回值 +AutoLinkGroups + +## 浏览器环境示例 +``` javascript +// 设置数据表的关联字段的匹配条件 +// 匹配到数据表2:数据表2的状态字段 = 数据表的文本字段,如下设置: +async function example() { + await instance.ready(); + const Application = instance.Application; + // 数据表 + const sheet = Application.Sheets(1) + // 数据表的字段 + const fieldId = await sheet.FieldId("文本") + // 数据表的关联字段 + const linkField = await sheet.FieldDescriptors("@关联") + const prop = linkField.Link + const linkGroups = await Application.AutoLinkGroups() + const group = linkGroups.Add() + const conditions = group.Conditions + // 关联的数据表2 + const linkSheet = await Application.Sheets(2) + // 关联数据表2的字段 + const linkSheet_fieldId = await linkSheet.FieldId("状态") + // 生成匹配条件 + conditions.Add(linkSheet_fieldId, [fieldId], "Field", "Equals") + // 设置关联字段的匹配条件 + prop.AutoLinkGroups = linkGroups + // 设置自动关联 + prop.IsAutoLink = true + linkField.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const sheet = Application.Sheets(1) + const fieldId = sheet.FieldId("状态") + // 获取关联字段 + const linkField = sheet.FieldDescriptors("@关联") + const prop = linkField.Link + const linkGroups = Application.AutoLinkGroups() + const conditions = linkGroups.Conditions + // 关联的数据表2 + const linkSheet = Application.Sheets(2) + // 关联数据表2的字段 + const linkSheet_fieldId = linkSheet.FieldId("状态") + // 生成匹配条件 + conditions.Add(linkSheet_fieldId, [fieldId], "Field", "Equals") + // 设置关联字段的匹配条件 + prop.AutoLinkGroups = linkGroups + // 设置自动关联 + prop.IsAutoLink = true + linkField.Apply() +} +main() +``` +``` + +## 332. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 自动关联 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink + +```markdown +# 自动关联 +LinkField.IsAutoLink(属性) + + +## 说明 +可读写 + +设置或读取 单向关联字段 或 双向关联字段 是否自动关联 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Link + console.log(await prop.IsAutoLink) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Link + console.log(prop.IsAutoLink) +} +main() +``` +``` + +## 333. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / IsAutoLink + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_IsAutoLink + +```markdown +# 自动关联 +LinkField.IsAutoLink(属性) + + +## 说明 +可读写 + +设置或读取 单向关联字段 或 双向关联字段 是否自动关联 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Link + console.log(await prop.IsAutoLink) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Link + console.log(prop.IsAutoLink) +} +main() +``` +``` + +## 334. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联多条记录 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks + +```markdown +# 关联多条记录 +LinkField.IsSupportMultiLinks(属性) + + +## 说明 +可读写 + +设置或读取 单向关联字段或双向关联字段 是否可以设置允许关联多条记录 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const link = await field.Link + field.IsSupportMultiLinks = true + field.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const link = field.Link + link.IsSupportMultiLinks = true + field.Apply() +} +main() +``` +``` + +## 335. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / IsSupportMultiLinks + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_IsSupportMultiLinks + +```markdown +# 关联多条记录 +LinkField.IsSupportMultiLinks(属性) + + +## 说明 +可读写 + +设置或读取 单向关联字段或双向关联字段 是否可以设置允许关联多条记录 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const link = await field.Link + field.IsSupportMultiLinks = true + field.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const link = field.Link + link.IsSupportMultiLinks = true + field.Apply() +} +main() +``` +``` + +## 336. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联表格ID + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet + +```markdown +# 关联表格ID +FieldDescriptor.LinkSheet(属性) + + +## 说明 +可读写 + +设置或读取单向关联或双向关联字段的关联表格的Id + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + // 插入单向关联字段 + const Application = instance.Application + const sheet = await Application.Sheets(1) + const linkField = await Application.FieldDescriptor("OneWayLink","单向关联") + const prop = await linkField.Link + prop.LinkSheet = await sheet.StId + prop.IsAutoLink = false + sheet.FieldDescriptors.AddField(linkField) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1) + const linkField = Application.FieldDescriptor("OneWayLink","单向关联") + const prop = linkField.Link + prop.LinkSheet = sheet.StId + prop.IsAutoLink = false + sheet.FieldDescriptors.AddField(linkField) +} +main() +``` +``` + +## 337. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkSheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_LinkSheet + +```markdown +# 关联表格ID +FieldDescriptor.LinkSheet(属性) + + +## 说明 +可读写 + +设置或读取单向关联或双向关联字段的关联表格的Id + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + // 插入单向关联字段 + const Application = instance.Application + const sheet = await Application.Sheets(1) + const linkField = await Application.FieldDescriptor("OneWayLink","单向关联") + const prop = await linkField.Link + prop.LinkSheet = await sheet.StId + prop.IsAutoLink = false + sheet.FieldDescriptors.AddField(linkField) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1) + const linkField = Application.FieldDescriptor("OneWayLink","单向关联") + const prop = linkField.Link + prop.LinkSheet = sheet.StId + prop.IsAutoLink = false + sheet.FieldDescriptors.AddField(linkField) +} +main() +``` +``` + +## 338. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 关联视图ID + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView + +```markdown +# 设置关联视图ID +FieldDescriptor.LinkView(属性) + + +## 说明 +可读写 + +设置或读取单向关联或双向关联字段的关联视图的id + +![alt text](https://cloudcdn.qwps.cn/open/_img/750d9990de.png) +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Link + prop.LinkView = await app.ActiveView.Id + field.Apply() + console.log(await prop.LinkView) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Link + prop.LinkView = ActiveView.Id + field.Apply() + console.log(prop.LinkView) +} +main() +``` +``` + +## 339. 开发指南 / WPS多维表格开发 / API文档 / API / LinkField / LinkView + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_LinkView + +```markdown +# 设置关联视图ID +FieldDescriptor.LinkView(属性) + + +## 说明 +可读写 + +设置或读取单向关联或双向关联字段的关联视图的id + +![alt text](https://cloudcdn.qwps.cn/open/_img/750d9990de.png) +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Link + prop.LinkView = await app.ActiveView.Id + field.Apply() + console.log(await prop.LinkView) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Link + prop.LinkView = ActiveView.Id + field.Apply() + console.log(prop.LinkView) +} +main() +``` +``` + +## 340. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_getValue + +```markdown +# 获取关联字段类型值 + +## 说明 +获取 关联字段 类型值 + +## 返回 +`object` 结构,结构如下: + +### object结构 +|key|值类型|说明| +|---|---|---| +|id|string|关联的引用字段id| +|str|string|展示的文案| + + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@关联").Value + console.log(value) + /** + * 输出值: + * { + * id: "R", + * str: "数据表2-文本1" + * } + */ +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@关联").Value + console.log(value) +} +main() +``` +``` + +## 341. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 关联字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LinkField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LinkField_setValue + +```markdown +# 设置关联字段类型值 + +## 说明 +设置 关联字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置关联字段值,参数为传入关联的记录id + app.Sheets(1).Views(1).RecordRange(3, "@关联").Value = await Application.DBCellValue(["G", "H"]) + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置关联字段值,参数为传入关联的记录id + Application.Sheets(1).Views(1).RecordRange(2, "@联系人").Value = Application.DBCellValue(["G", "H"]) +} +main() +``` +``` + +## 342. 开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LookupField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LookupField + +```markdown +# LookupField (对象) + + +## 说明 +LookupField 引用/查找引用/统计 字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非 引用/查找引用/统计 字段,无法设置相关属性 + +## 属性 +- [LinkFieldId](/app-integration-dev/guide/dbsheet/Api/LookupField_LinkFieldId) +- [LookupFieldId](/app-integration-dev/guide/dbsheet/Api/LookupField_LookupFieldId) +- [LookupType](/app-integration-dev/guide/dbsheet/Api/LookupField_LookupType) +- [LookupSheetId](/app-integration-dev/guide/dbsheet/Api/LookupField_LookupSheetId) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = await Application.Sheets("数据表").FieldDescriptors("@单向关联") + const prop = await fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = Sheets("数据表").FieldDescriptors("@单向关联") + const prop = fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() + } +main() +``` +``` + +## 343. 开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LinkFieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LinkFieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LookupField_LinkFieldId + +```markdown +# FieldDescriptor.LinkFieldId(属性) + + +## 说明 +可读写 + +引用内容 设置为 关联的字段Id 以联接数据表 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = await Application.Sheets("数据表").FieldDescriptors("@单向关联") + const prop = await fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Sheets("数据表").FieldDescriptors("@查找引用") + const linkFieldId = Sheets("数据表").FieldDescriptors("@单向关联") + const prop = fieldDescriptor.Lookup + prop.LinkFieldId = linkFieldId + fieldDescriptor.Apply() +} +main() +``` +``` + +## 344. 开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupFieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupFieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LookupField_LookupFieldId + +```markdown +# LookupField.LookupFieldId(属性) + + +## 说明 +可读写 + +引用内容里 引用字段的Id,指向的是引用的数据表的字段(不一定是当前数据表),需要先从关联的表中读取字段Id。 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = await fieldDescriptor.Lookup + const lookUpSheet = await Application.Sheets.ItemById(prop.LookupSheetId) + const lookupField = await lookUpSheet.FieldDescriptors(prop.LookupFieldId) + console.log(await lookupField.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = fieldDescriptor.Lookup + const lookUpSheet = Application.Sheets.ItemById(prop.LookupSheetId) + const lookupField = lookUpSheet.FieldDescriptors(prop.LookupFieldId) + console.log(lookupField.Name) +} +main() +``` +``` + +## 345. 开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupSheetId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupSheetId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LookupField_LookupSheetId + +```markdown +# FieldDescriptor.LookupSheetId(属性) + + +## 说明 +可读写 + +引用字段里 引用sheet的Id,要通过Sheet Id获取Sheet的实例可以通过 Application.Sheets.ItemById(id) + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = await fieldDescriptor.Lookup + const lookUpSheet = await Application.Sheets.ItemById(prop.LookupSheetId) + const lookupField = await lookUpSheet.FieldDescriptors(prop.LookupFieldId) + console.log(await lookupField.Name) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = fieldDescriptor.Lookup + const lookUpSheet = Application.Sheets.ItemById(prop.LookupSheetId) + const lookupField = lookUpSheet.FieldDescriptors(prop.LookupFieldId) + console.log(lookupField.Name) +} +main() +``` +``` + +## 346. 开发指南 / WPS多维表格开发 / API文档 / API / LookupField / LookupType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/LookupField_LookupType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/LookupField_LookupType + +```markdown +# LookupField.LookupType(属性) + + +## 说明 +可读写 + +引用字段的显示方法,查找引用字段不允许配置,只能使用Origin,统计字段不允许设置Origin + +## 返回值 +[DbLookupFunction](/app-integration-dev/guide/dbsheet/Api/Enum_DbLookupFunction) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = await fieldDescriptor.Lookup + console.log(await prop.LookupType) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@查找引用") + const prop = fieldDescriptor.Lookup + console.log(prop.LookupType) +} +main() +``` +``` + +## 347. 开发指南 / WPS多维表格开发 / API文档 / API / Navigator / Navigator对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Navigator` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Navigator + +```markdown +# Navigator (对象) + + +## 说明 +导航栏对象 + +## 方法 + + +## 属性 +* [Visible](/app-integration-dev/guide/dbsheet/Api/Navigator_Visible) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator + } +``` +``` + +## 348. 开发指南 / WPS多维表格开发 / API文档 / API / Navigator / Visible + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Navigator_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Navigator_Visible + +```markdown +# 设置导航栏可见性 +Navigator.Visible(属性) + + +## 说明 +可读写 + +设置导航栏隐藏或显示 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function getVisible() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator + const visible = await navigator.Visible // 为true导航栏隐藏,为false导航栏显示 +} +async function setVisible() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator + navigator.Visible = false // 隐藏导航栏 + navigator.Visible = true // 显示导航栏 +} +``` +``` + +## 349. 开发指南 / WPS多维表格开发 / API文档 / API / NoticeBar / NoticeBar对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NoticeBar + +```markdown +# NoticeBar (对象) + + +## 说明 +公告栏对象 + +## 方法 + + +## 属性 +* [Visible](/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar + } +``` +``` + +## 350. 开发指南 / WPS多维表格开发 / API文档 / API / NoticeBar / Visible + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NoticeBar_Visible + +```markdown +# 展开/收起 +NoticeBar.Visible(属性) + + +## 说明 +可读写 + +设置公告栏可见性 + +## 返回值 +Boolean + + +## 浏览器环境示例 +``` javascript +async function getVisible() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar + const visible = await noticeBar.Visible // 为true公告栏隐藏,为false公告栏显示 +} +async function setVisible() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar + noticeBar.Visible = false // 隐藏公告栏 + noticeBar.Visible = true // 显示公告栏 +} +``` +``` + +## 351. 开发指南 / WPS多维表格开发 / API文档 / API / NumberField / NumberField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NumberField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NumberField + +```markdown +# NumberField (对象) + + +## 说明 +NumberField 数字字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非数字字段,无法设置相关属性 + +## 属性 +- [IsShowThousand](/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@数字") + const prop = await field.Number + prop.IsShowThousand = true + field.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@数字") + const prop = field.Number + prop.IsShowThousand = true + field.Apply() + } +main() +``` +``` + +## 352. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 显示千位符 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand + +```markdown +# 是否显示千位符 +NumberField.IsShowThousand(属性) + + +## 说明 +可读写 + +字段类型为Number时,通过此属性可以快捷的设置是否显示千位符 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@数字") + const prop = await field.Number + prop.IsShowThousand = true + field.Apply() + } +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@数字") + const prop = field.Number + prop.IsShowThousand = true + field.Apply() + } +main() +``` +``` + +## 353. 开发指南 / WPS多维表格开发 / API文档 / API / NumberField / IsShowThousand + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NumberField_IsShowThousand + +```markdown +# 是否显示千位符 +NumberField.IsShowThousand(属性) + + +## 说明 +可读写 + +字段类型为Number时,通过此属性可以快捷的设置是否显示千位符 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@数字") + const prop = await field.Number + prop.IsShowThousand = true + field.Apply() + } +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@数字") + const prop = field.Number + prop.IsShowThousand = true + field.Apply() + } +main() +``` +``` + +## 354. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NumberField_getValue + +```markdown +# 获取数字字段类型值 + +## 说明 +获取 数字字段 类型值 + +## 返回 + +`number` 类型,如 `100` + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 输出数字值 100 + const value = await app.Sheets(1).Views(1).RecordRange(1, "@数字").Value + console.log(value) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@数字").Value + console.log(value) +} +main() +``` +``` + +## 355. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 数字字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/NumberField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/NumberField_setValue + +```markdown +# 设置数字字段类型值 + +## 说明 +设置 数字字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置数字 + app.Sheets(1).Views(1).RecordRange(2, "@数字").Value = 1 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置数字 + Application.Sheets(1).Views(1).RecordRange(2, "@数字").Value = 1 +} +main() +``` +``` + +## 356. 开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Permission2对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Permission2` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Permission2 + +```markdown +# Permission2 (对象) + + +## 说明 +获取文档的自定义内容权限对象 + +权限角色添加协作者及自定义角色权限内容设置需要用户对当前文档是可管理的,否则相关的设置会提示The current user does not have permission to perform this operation! + + +## 属性 +* [Roles](/app-integration-dev/guide/dbsheet/Api/Permission2_Roles) +* [DefaultRole](/app-integration-dev/guide/dbsheet/Api/Permission2_DefaultRole) +* [GroupDefaultRole](/app-integration-dev/guide/dbsheet/Api/Permission2_GroupDefaultRole) +* [Collaborators](/app-integration-dev/guide/dbsheet/Api/Permission2_Collaborators) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const roleCnt = await app.Permission2.Roles.Count; + //打印出当前文档中的自定义内容权限的列表总数 + console.log(roleCnt) + } +``` ` +## 脚本编辑器 示例 +``` javascript +function main() { + const roleCnt = Application.Permission2.Roles.Count; + // 打印出当前文档中的自定义内容权限的列表总数 + console.log(roleCnt) +} +main() +``` +``` + +## 357. 开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Collaborators + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_Collaborators` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Permission2_Collaborators + +```markdown +# Permission2.Collaborators(属性) + + + +## 说明 + +可读 +返回【通过链接加入后的默认角色】的协作者列表 + +## 返回值 + +RoleUsers + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + // 返回协作者列表 + const roleUsers = await app.Permission2.Collaborators; + const count = await roleUsers.Count; + console.log(count); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + // 返回协作者列表 + const roleUsers = Application.Permission2.Collaborators; + console.log(roleUsers.Count); +} +main(); +``` + +``` + +## 358. 开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / DefaultRole + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_DefaultRole` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Permission2_DefaultRole + +```markdown +# Permission2.DefaultRole(属性) + + + +## 说明 + +可读写 +获取/设置通过链接加入后的默认角色对象 + +不能设置DefaultRole为系统可管理 + +获取/设置DefaultRole要求文件开启分享,如果当前文档暂未开启分享,会失败提示Error: can't get/set DefaultRole. + +## 返回值 + +[Role](/app-integration-dev/guide/dbsheet/Api/Role) + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + // 获取通过链接加入后的默认角色对象 + const defaultRole = await app.Permission2.DefaultRole; + const defaultRoleName = await defaultRole.Name; + console.log(defaultRoleName); + + // 设置通过链接加入后的默认角色--设置为系统角色可查看 + const role = await app.Permission2.Roles(3); + app.Permission2.DefaultRole = role; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + // 获取通过链接加入后的默认角色对象 + const defaultRole = Application.Permission2.DefaultRole; + console.log(defaultRole.Name); + + // 设置通过链接加入后的默认角色--设置为系统角色可查看 + const role = Application.Permission2.Roles(3); + Application.Permission2.DefaultRole = role; +} +main(); +``` + +``` + +## 359. 开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / GroupDefaultRole + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_GroupDefaultRole` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Permission2_GroupDefaultRole + +```markdown +# Permission2.GroupDefaultRole(属性) + + + +## 说明 + +可读写 +获取/设置团队成员的默认角色 + +不能设置GroupDefaultRole为系统可管理,无权限选项可以通过Roles.NoPermissionRole来获取 + +获取/设置GroupDefaultRole要求是团队文件且当前用户对文件是可管理的,否则会失败提示You don't have permission to perform this operation! + +## 返回值 + +[Role](/app-integration-dev/guide/dbsheet/Api/Role) + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + // 获取团队成员的默认角色 + const defaultRole = await app.Permission2.GroupDefaultRole; + const defaultRoleName = await defaultRole.Name; + console.log(defaultRoleName); + + // 设置团队成员的默认角色--设置为系统角色可查看 + const role = await app.Permission2.Roles(3); + app.Permission2.GroupDefaultRole = role; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + // 获取团队成员的默认角色 + const defaultRole = Application.Permission2.GroupDefaultRole; + console.log(defaultRole.Name); + + // 设置团队成员的默认角色--设置为系统角色可查看 + const role = Application.Permission2.Roles(3); + Application.Permission2.GroupDefaultRole = role; +} +main(); +``` + +``` + +## 360. 开发指南 / WPS多维表格开发 / API文档 / API / Permission2 / Roles + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Permission2_Roles` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Permission2_Roles + +```markdown +# Permission2.Roles(属性) + + + +## 说明 + +可读 +获取文档的自定义内容权限角色列表 + +## 返回值 + +[Roles](/app-integration-dev/guide/dbsheet/Api/Roles) + +## 浏览器环境示例 + +``` javascript +// 获取文档的自定义内容权限角色列表 +async function example() { + await instance.ready(); + const app = instance.Application; + const roles = await app.Permission2.Roles; + // 打印出第一个系统角色的名称 + const firstRoleName = await roles(1).Name; + console.log(firstRoleName) +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const roles = Application.Permission2.Roles; + // 打印出第一个系统角色的名称 + const firstRoleName = roles(1).Name + console.log(firstRoleName) +} +main(); +``` + +``` + +## 361. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / PermissionSetting对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting + +```markdown +# PermissionSetting (对象) + + +## 说明 +获取自定义角色的内容权限设置 + + +内容权限设置是在特定Sheet上的内容权限设置,根据Sheet的类型不同,支持的设置范围不同 + +* 数据表类型的Sheet 支持设置权限类型PermissionType为可编辑[Permission_Edit](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType)、可查看[Permission_View](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType)、可管理[Permission_Manage](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType)和无权限[Permission_NoPermission](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType),设置允许添加记录、允许删除记录,权限类型为可编辑时支持设置可查看和编辑的记录范围、可查看和编辑的字段范围;权限类型为可查看时支持设置可查看的记录范围、可查看的字段范围 +* 仪表盘类型的Sheet 只支持设置权限类型PermissionType为可查看[Permission_View](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType)或者为无权限[Permission_NoPermission](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType) +* 说明页面类型的Sheet 只支持设置权限类型为可查看[Permission_View](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType)或者为无权限[Permission_NoPermission](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType) + + +每个角色下的内容权限设置列表是当前文档下所有的Sheet的内容权限设置集合,系统角色不支持该属性,自定义角色支持该属性。 + + +## 属性 +* [PermissionType](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_PermissionType) +* [IsAllowAddRecord](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowAddRecord) +* [IsAllowRemoveRecord](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowRemoveRecord) +* [EditableAndViewableRecordsConfigType](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableAndViewableRecordsConfigType) +* [EditableRecordSetting](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableRecordSetting) +* [ViewableRecordSetting](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableRecordSetting) +* [EditableFieldSetting](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableFieldSetting) +* [ViewableFieldSetting](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableFieldSetting) +* [Sheet](/app-integration-dev/guide/dbsheet/Api/PermissionSetting_Sheet) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const firstPermissionSetting = await customRole.PermissionSettings.Item(1); + // 将设置的自定义角色的第一个内容权限设置类型打印出来 + console.log(firstPermissionSetting.PermissionType); + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将设置的自定义角色的第一个内容权限设置类型打印出来 + console.log(customRole.PermissionSettings.Item(1).PermissionType); +} +main() +``` + +``` + +## 362. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableAndViewableRecordsConfigType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableAndViewableRecordsConfigType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableAndViewableRecordsConfigType + +```markdown +# PermissionSetting.EditableAndViewableRecordsConfigType(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑时支持读写属性 可查看和编辑的记录范围类型,其他情况下不支持读写 + +## 返回值 + +[EditableAndViewableRecordsConfigType](/app-integration-dev/guide/dbsheet/Api/Enum_EditableAndViewableRecordsConfigType) + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + // 读取EditableAndViewableRecordsConfigType + const recordConfigType = await customRole.PermissionSettings(1).EditableAndViewableRecordsConfigType; + console.log(recordConfigType); + // 设置EditableAndViewableRecordsConfigType + customRole.PermissionSettings(1).EditableAndViewableRecordsConfigType = 'Self'; +} +``` + +## 脚本编辑器 示例 + +``` javascript + +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 读取EditableAndViewableRecordsConfigType + console.log(customRole.PermissionSettings(1).EditableAndViewableRecordsConfigType); + // 设置EditableAndViewableRecordsConfigType + customRole.PermissionSettings(1).EditableAndViewableRecordsConfigType = 'Self'; +} +main(); +``` + +``` + +## 363. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableFieldSetting + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableFieldSetting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableFieldSetting + +```markdown +# PermissionSetting.EditableFieldSetting(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑时支持读写属性 可编辑的字段(列)范围,其他情况下不支持读写 + +当权限类型为可编辑时PermissionRecordConfigType为Custom时,EditableFieldSetting才有效表示设置的筛选区域内字段可编辑 + + +设置EditableFieldSetting会在相同字段范围设置为可查看,因为可编辑肯定是可查看的,参数是一个字符串数组,用来表示可编辑的字段范围,数组值可以是字段名也可以是字段ID,如果是字段名必须以@开头,如['@文本', '@数字', '@日期']表示将这三列设置为可编辑字段 + +## 返回值 + +String[] + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const fieldSetting = ['@文本', '@数字', '@日期']; + // 设置EditableFieldSetting + customRole.PermissionSettings(1).EditableFieldSetting = fieldSetting; + // 读取EditableFieldSetting + const editableFieldSetting = await customRole.PermissionSettings(1).EditableFieldSetting; + console.log(editableFieldSetting); +} + +``` + +## 脚本编辑器 示例 + +``` javascript + +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + const fieldSetting = ['@文本', '@数字', '@日期']; + // 设置EditableFieldSetting + customRole.PermissionSettings(1).EditableFieldSetting = fieldSetting; + // 读取EditableFieldSetting + const editableFieldSetting = customRole.PermissionSettings(1).EditableFieldSetting; + console.log(editableFieldSetting); +} +main(); +``` + +``` + +## 364. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / EditableRecordSetting + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableRecordSetting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_EditableRecordSetting + +```markdown +# PermissionSetting.EditableRecordSetting(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑时支持读写属性 可编辑的记录(行)范围,其他情况下不支持读写 + +当PermissionRecordConfigType为Custom时,EditableRecordSetting才有效表示设置的筛选区域内记录可编辑 + +## 返回值 + +Criteria + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const criteria = await app.Criteria('@文本', 'Intersected', ['1', '2']); + // 设置EditableRecordSetting + customRole.PermissionSettings(1).EditableRecordSetting = [criteria]; + // 读取EditableRecordSetting + const editableRecordSetting = await customRole.PermissionSettings(1).EditableRecordSetting; + console.log(editableRecordSetting); +} + +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 设置EditableRecordSetting + const criteriaArr = []; + const criteria = Application.Criteria('@文本', 'Equals', ['1']); + criteriaArr.push(criteria); + customRole.PermissionSettings(1).EditableRecordSetting = criteriaArr; + // 读取EditableRecordSetting + const editableRecordSetting = customRole.PermissionSettings(1).EditableRecordSetting + console.log(editableRecordSetting); +} +main(); +``` + +``` + +## 365. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / IsAllowAddRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowAddRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowAddRecord + +```markdown +# PermissionSetting.IsAllowAddRecord(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑时支持读写属性 允许添加记录,其他情况下不支持读写 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + // 读取IsAllowAddRecord + const isAllowAddRecord = await customRole.PermissionSettings(1).IsAllowAddRecord; + console.log(isAllowAddRecord); + // 设置IsAllowAddRecord + customRole.PermissionSettings(1).IsAllowAddRecord = false; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 读取IsAllowAddRecord + console.log(customRole.PermissionSettings(1).IsAllowAddRecord); + // 设置IsAllowAddRecord + customRole.PermissionSettings(1).IsAllowAddRecord = false; +} +main(); +``` + +``` + +## 366. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / IsAllowRemoveRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowRemoveRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_IsAllowRemoveRecord + +```markdown +# PermissionSetting.IsAllowRemoveRecord(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑时支持读写属性 允许删除记录,其他情况下不支持读写 + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + // 读取IsAllowRemoveRecord + const isAllowRemoveRecord = await customRole.PermissionSettings(1).IsAllowRemoveRecord; + console.log(isAllowRemoveRecord); + // 设置IsAllowRemoveRecord + customRole.PermissionSettings(1).IsAllowRemoveRecord = false; +} +``` + +## 脚本编辑器 示例 + +``` javascript + +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 读取IsAllowRemoveRecord + console.log(customRole.PermissionSettings(1).IsAllowRemoveRecord); + // 设置IsAllowRemoveRecord + customRole.PermissionSettings(1).IsAllowRemoveRecord = false; +} +main(); +``` + +``` + +## 367. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / PermissionType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_PermissionType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_PermissionType + +```markdown +# PermissionSetting.PermissionType(属性) + + + +## 说明 + +可读写 +获取或设置自定义角色的内容权限类型 + +## 返回值 + +[PermissionType](/app-integration-dev/guide/dbsheet/Api/Enum_DbPermissionType) + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + // 读取PermissionType + const firstPermissionType = await customRole.PermissionSettings(1).PermissionType; + console.log(firstPermissionType); + // 设置PermissionType + customRole.PermissionSettings(1).PermissionType = 'Permission_View'; +} + +``` + +## 脚本编辑器 示例 + +``` javascript + +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 读取PermissionType + console.log(customRole.PermissionSettings(1).PermissionType); + // 设置PermissionType + customRole.PermissionSettings(1).PermissionType = 'Permission_View'; +} +main(); +``` + +``` + +## 368. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / Sheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_Sheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_Sheet + +```markdown +# PermissionSetting.Sheet(属性) + + + +## 说明 + +可读 +获取当前权限设置对应的Sheet对象 + +## 返回值 + +Sheet + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const sheet = await customRole.PermissionSettings(1).Sheet; + const sheetName = await sheet.Name; + // 将sheet的名称打印出来 + console.log(sheetName); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将sheet的名称打印出来 + console.log(customRole.PermissionSettings(1).Sheet.Name); +} +main(); +``` + +``` + +## 369. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / ViewableFieldSetting + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableFieldSetting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableFieldSetting + +```markdown +# PermissionSetting.ViewableFieldSetting(属性) + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑/可查看时支持读写属性 可查看的字段(列)范围,其他情况下不支持读写 + +当权限类型为可编辑时PermissionRecordConfigType为Custom时,ViewableFieldSetting才有效表示设置的筛选区域内字段可查看 + + +参数是一个字符串数组,用来表示可查看的字段范围,数组值可以是字段名也可以是字段ID,如果是字段名必须以@开头,如['@文本', '@数字', '@日期']表示将这三列设置为可查看字段 + +## 返回值 + +String[] + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const fieldSetting = ['@文本', '@数字', '@日期']; + // 设置ViewableFieldSetting + customRole.PermissionSettings(1).ViewableFieldSetting = fieldSetting; + // 读取ViewableFieldSetting + const viewableFieldSetting = await customRole.PermissionSettings(1).ViewableFieldSetting; + console.log(viewableFieldSetting); +} + +``` + +## 脚本编辑器 示例 + +``` javascript + +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + const fieldSetting = ['@文本', '@数字', '@日期']; + // 设置ViewableFieldSetting + customRole.PermissionSettings(1).ViewableFieldSetting = fieldSetting; + // 读取ViewableFieldSetting + const viewableFieldSetting = customRole.PermissionSettings(1).ViewableFieldSetting; + console.log(viewableFieldSetting); +} +main(); +``` + +``` + +## 370. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSetting / ViewableRecordSetting + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableRecordSetting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSetting_ViewableRecordSetting + +```markdown +# PermissionSetting.ViewableRecordSetting(属性) + + + +## 说明 + +可读写 +Sheet类型为数据表且权限类型为可编辑/可查看时支持读写属性 可查看的记录(行)范围,其他情况下不支持读写 + +当PermissionRecordConfigType为Custom时,ViewableRecordSetting才有效表示设置的筛选区域内记录可编辑 + +## 返回值 + +Criteria + +## 浏览器环境示例 + +``` javascript + +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const criteria = await app.Criteria('@文本', 'Intersected', ['1', '2']); + // 设置ViewableRecordSetting + customRole.PermissionSettings(1).ViewableRecordSetting = [criteria]; + // 读取ViewableRecordSetting + const viewableRecordSetting = await customRole.PermissionSettings(1).ViewableRecordSetting; + console.log(viewableRecordSetting); +} + +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 设置ViewableRecordSetting + const criteriaArr = []; + const criteria = Application.Criteria('@文本', 'Equals', ['1']); + criteriaArr.push(criteria); + customRole.PermissionSettings(1).ViewableRecordSetting = criteriaArr; + // 读取ViewableRecordSetting + const viewableRecordSetting = customRole.PermissionSettings(1).ViewableRecordSetting + console.log(viewableRecordSetting); +} +main(); +``` + +``` + +## 371. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / PermissionSettings对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSettings + +```markdown +# PermissionSettings (对象) + + +## 说明 +获取自定义角色的内容权限设置列表 + + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Item) + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Count) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const permissionSettingCnt = await customRole.PermissionSettings.Count; + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(permissionSettingCnt); + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(customRole.PermissionSettings.Count); +} +main() +``` +``` + +## 372. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Count + +```markdown +# PermissionSettings.Count(属性) + + + +## 说明 + +可读 +获取自定义角色的内容权限设置列表长度 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const permissionSettingCnt = await customRole.PermissionSettings.Count; + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(permissionSettingCnt); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(customRole.PermissionSettings.Count); +} +main(); +``` + +``` + +## 373. 开发指南 / WPS多维表格开发 / API文档 / API / PermissionSettings / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/PermissionSettings_Item + +```markdown +# PermissionSettings.Item(方法) + + + +## 说明 + +获取指定索引位置的内容权限设置 + +## 语法 + +表达式.Item(Index) + +表达式:PermissionSettings + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始 | + +## 返回值 + +PermissionSetting + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const firstPermissionSetting = await customRole.PermissionSettings.Item(1); + // 将设置的自定义角色的第一个内容权限设置类型打印出来 + console.log(firstPermissionSetting.PermissionType); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将设置的自定义角色的第一个内容权限设置类型打印出来 + console.log(customRole.PermissionSettings.Item(1).PermissionType); +} +main(); +``` + +``` + +## 374. 开发指南 / WPS多维表格开发 / API文档 / API / QueryView / QueryView对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/QueryView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/QueryView + +```markdown +# QueryView (对象) + + + +## 说明 + +表格视图,是 [View](/app-integration-dev/guide/dbsheet/Api/View) 的子类,View 的方法与属性都可用,下面列出它独有的方法与属性。 + +## 方法 + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[QueryFields](/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields)|查询视图的查询条件配置数组|可读写| +|[BackgroundImage](/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage)|查询视图的背景图|可读写| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.QueryFields); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.QueryFields); +} +main(); +``` + +``` + +## 375. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 查询视图 / 设置背景图 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage + +```markdown +# 设置背景图 +QueryView.BackgroundImage + + + +## 说明 + +可读写 + +查询视图的背景图,注意:可以设置为 url/base64 + +## 返回值 + +Attachment + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.BackgroundImage = "https://kdocs-om.wpscdn.cn/om/image.png" +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + view.BackgroundImage = "https://kdocs-om.wpscdn.cn/om/image.png" +} +main(); +``` + +``` + +## 376. 开发指南 / WPS多维表格开发 / API文档 / API / QueryView / BackgroundImage + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/QueryView_BackgroundImage + +```markdown +# 设置背景图 +QueryView.BackgroundImage + + + +## 说明 + +可读写 + +查询视图的背景图,注意:可以设置为 url/base64 + +## 返回值 + +Attachment + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.BackgroundImage = "https://kdocs-om.wpscdn.cn/om/image.png" +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + view.BackgroundImage = "https://kdocs-om.wpscdn.cn/om/image.png" +} +main(); +``` + +``` + +## 377. 开发指南 / WPS多维表格开发 / API文档 / 视图 / 查询视图 / 设置查询条件 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields + +```markdown +# 设置查询条件 +QueryView.QueryFields + + + +## 说明 + +可读写 + +查询视图的查询条件配置数组,可以将数组设置到QueryFields属性,查询条件的数据结构如下 +``` javascript +{ +conditionCanBlank: false, // 是否必填 +customPrompt: "", // 自定义提示语 +enableScanCodeToInput: false, // 是否允许扫码输入 +fieldId: "s", // 字段ID +needSecondCheck: false, // 电话字段时是否校验号码 +op: "Equals" // 匹配方式,参看下面说明 +} +``` + +根据字段类型支持不同的匹配方式 +文本/邮箱/URL/地址/级联:Intersected,Contains,Equals +日期: Intersected,GreaterEquAndLessEqu,Equals +时间: Equals +数字/货币/百分比/最后修改时间/等级/进度/创建时间: GreaterEquAndLessEqu, Equals +身份证/电话/自动编号:Intersected,Equals +复选框/单选项/多选项/联系人/创建人/最后修改人/双向关联/单向关联/父记录:Intersected + +## 返回值 + +Array + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.QueryFields); + // 添加查询条件 + view.QueryFields = [{ + conditionCanBlank: false, // 是否必填 + customPrompt: "", // 自定义提示语 + enableScanCodeToInput: false, // 是否允许扫码输入 + fieldId: "s", // 字段ID + needSecondCheck: false, // 电话字段时是否校验号码 + op: "Equals" // 匹配方式,参看下面说明 + }] + // 使用手机验证码 + view.QueryFields = [{ + conditionCanBlank: false, + customPrompt: "", + enableScanCodeToInput: false, + fieldId: "s", + needSecondCheck: true + op: "Equals" + }] +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.QueryFields); +} +main(); +``` + +``` + +## 378. 开发指南 / WPS多维表格开发 / API文档 / API / QueryView / QueryFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/QueryView_QueryFields + +```markdown +# 设置查询条件 +QueryView.QueryFields + + + +## 说明 + +可读写 + +查询视图的查询条件配置数组,可以将数组设置到QueryFields属性,查询条件的数据结构如下 +``` javascript +{ +conditionCanBlank: false, // 是否必填 +customPrompt: "", // 自定义提示语 +enableScanCodeToInput: false, // 是否允许扫码输入 +fieldId: "s", // 字段ID +needSecondCheck: false, // 电话字段时是否校验号码 +op: "Equals" // 匹配方式,参看下面说明 +} +``` + +根据字段类型支持不同的匹配方式 +文本/邮箱/URL/地址/级联:Intersected,Contains,Equals +日期: Intersected,GreaterEquAndLessEqu,Equals +时间: Equals +数字/货币/百分比/最后修改时间/等级/进度/创建时间: GreaterEquAndLessEqu, Equals +身份证/电话/自动编号:Intersected,Equals +复选框/单选项/多选项/联系人/创建人/最后修改人/双向关联/单向关联/父记录:Intersected + +## 返回值 + +Array + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + console.log(view.QueryFields); + // 添加查询条件 + view.QueryFields = [{ + conditionCanBlank: false, // 是否必填 + customPrompt: "", // 自定义提示语 + enableScanCodeToInput: false, // 是否允许扫码输入 + fieldId: "s", // 字段ID + needSecondCheck: false, // 电话字段时是否校验号码 + op: "Equals" // 匹配方式,参看下面说明 + }] + // 使用手机验证码 + view.QueryFields = [{ + conditionCanBlank: false, + customPrompt: "", + enableScanCodeToInput: false, + fieldId: "s", + needSecondCheck: true + op: "Equals" + }] +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + console.log(view.QueryFields); +} +main(); +``` + +``` + +## 379. 开发指南 / WPS多维表格开发 / API文档 / API / RatingField / RatingField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RatingField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RatingField + +```markdown +# RatingField (对象) + + +## 说明 +RatingField 等级字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果等级字段,无法设置相关属性 + +## 属性 +- [MaxRating](/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@数字") + const prop = await field.Rating + prop.MaxRating = 1 + field.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@数字") + const prop = field.Rating + prop.MaxRating = 2 + field.Apply() + } +main() +``` +``` + +## 380. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 设置等级 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating + +```markdown +# 设置等级 +RatingField.MaxRating(属性) + + +## 说明 +可读写 + +只对等级字段有效,设置等级字段最大值,取值范围为1-5 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Rating + prop.MaxRating = 5 + field.Apply() + + console.log(await prop.MaxRating) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = await field.Rating + prop.MaxRating = 5 + field.Apply() + + console.log(prop.MaxRating) +} +main() +``` +``` + +## 381. 开发指南 / WPS多维表格开发 / API文档 / API / RatingField / MaxRating + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RatingField_MaxRating + +```markdown +# 设置等级 +RatingField.MaxRating(属性) + + +## 说明 +可读写 + +只对等级字段有效,设置等级字段最大值,取值范围为1-5 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Rating + prop.MaxRating = 5 + field.Apply() + + console.log(await prop.MaxRating) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = await field.Rating + prop.MaxRating = 5 + field.Apply() + + console.log(prop.MaxRating) +} +main() +``` +``` + +## 382. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RatingField_getValue + +```markdown +# 获取等级类型值 + +## 说明 +获取 等级字段 类型值 + +## 返回 + +`number` 类型,如 2 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@等级").Value + console.log(value) + // 输出2 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@等级").Value + console.log(value) +} +main() +``` +``` + +## 383. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 等级字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RatingField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RatingField_setValue + +```markdown +# 设置等级类型值 + +## 说明 +设置 等级字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置等级 + app.Sheets(1).Views(1).RecordRange(2, "@等级").Value = 1 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置等级 + Application.Sheets(1).Views(1).RecordRange(2, "@等级").Value = 1 +} +main() +``` +``` + +## 384. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Record对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record + +```markdown +# Record (对象) + + +## 说明 +Record 对象,表示单条记录相关,Record对象可以返回值的数组或者显示的文本数据,值的数组不同的字段会有不同的对象显示 +常见对象如下: +|字段类型|数据显示| +|---|---| +|文本类型|String| +|数值类型|Number| +|联系人类型|{"userId":"10000", "nickname":"name", "avatarUrl":"https://xxxxx/thumbnail/180x180!", "companyId":""}| +|富文本类型|{"fileId":"zzzzzz", "shortSummary":"1","longSummary":null, "modifyDate":1718179889190}| +|超链接类型|{"display":"超链接文本","address":"https://xxx.com"}| +|多选项类型|Array| +|地址类型|{"districts":["安徽省","安庆市","安徽安庆经济开发区"], "detail":"详细地址"}| +|关联类型|[{"id":"B","str":"aaaa"}, {"id":"b","str":"set"}]| +|CheckBox|boolean| +|等级类型|Number| +|级联类型|{"districts":[], "detail":""}| +|附件类型|Attachment| + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/Record_Item) +* [Delete](/app-integration-dev/guide/dbsheet/Api/Record_Delete) +* [Select](/app-integration-dev/guide/dbsheet/Api/Record_Select) + + +## 属性 +* [Id](/app-integration-dev/guide/dbsheet/Api/Record_Id) +* [Value](/app-integration-dev/guide/dbsheet/Api/Record_Value) +* [Text](/app-integration-dev/guide/dbsheet/Api/Record_Text) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records(10) + console.log(await record.Value) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + // 返回字段的值 + console.log(record.Value) + } +main() +``` +``` + +## 385. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / RecordComment对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment + +```markdown +# RecordComment (对象) + +## 说明 +RecordComment对象代表记录Record的评论,可以通过RecordComment对象对记录的评论进行操作。 + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/RecordComment_Item) +- [Add](/app-integration-dev/guide/dbsheet/Api/RecordComment_Add) +- [Delete](/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete) + +## 属性 +- [Count](/app-integration-dev/guide/dbsheet/Api/RecordComment_Count) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` +``` + +## 386. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Add + +```markdown +# 插入新的评论 +RecordComment.Add(方法) + +## 说明 +插入新的评论 + +## 语法 +表达式.Add(Text, TextLinkRuns) + +表达式:RecordComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Text|是|String|评论的文本,插入到评论的最前方| +|TextLinkRuns|否|Array|文本的特殊节点属性| + +## 返回值 +DbComment + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` + +``` + +## 387. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Count + +```markdown +# RecordComment.Count(属性) + + +## 说明 +只读 +返回的记录里包含评论的数量 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main() +``` +``` + +## 388. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Delete + +```markdown +# 删除评论 +RecordComment.Delete(方法) + +## 说明 +删除评论 + +## 语法 +表达式.Delete() + +表达式:RecordComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|Number/String|删除记录的索引| + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + await recordComment.Delete(i) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + await recordComment.Delete(i) + } +} +main() +``` + +``` + +## 389. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComment / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComment_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComment_Item + +```markdown +# RecordComment.Item(方法) + +## 说明 +获取指定索引位置或评论ID的记录 + +## 语法 +表达式.Item(Index) + +表达式:RecordComment + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|number/string|传入number时索引从1开始,传入字符串时表示评论id| + +## 返回值 +[DbComment](/app-integration-dev/guide/dbsheet/Api/DbComment) + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments(1) + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main()``` + +``` + +## 390. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / RecordComments对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments + +```markdown +# RecordComments (对象) + + +## 说明 +RecordComments 当前视图上的评论,每条记录对应一个RecordComments对象,RecordComments对象的属性和方法可以用来操作该条记录的评论。 +多维表的评论是在记录上的,评论的对象主体上是三级 RecordComments -> RecordComment -> DbComment + + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/RecordComments_Item) + +## 属性 +- [Count](/app-integration-dev/guide/dbsheet/Api/RecordComments_Count) + +## 事件 +- [OnCreate](/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate) +- [OnDelete](/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const comment = await app.ActiveView.RecordComments(1).Item(5) + console.log(await comment.Text) // 输出 (3) ['aaaa', 45470, 1] +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const comment = Application.ActiveView.RecordComments(1).Item(5) + console.log(comment.Text) // 输出 (3) ['aaaa', 45470, 1] +} +main() +``` +``` + +## 391. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_Count + +```markdown +# RecordComments.Count(属性) + + +## 说明 +可读写 + +返回当前RecordComment的数量,因为每条记录都会有一个RecordComment对象,所以返回的是记录的数量。 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const count = await instance.Application.ActiveView.RecordComments.Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const count = Application.ActiveView.RecordComments.Count +} +main() +``` +``` + +## 392. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_Item + +```markdown +# RecordComments.Item(方法) + +## 说明 +通过记录的索引或ID获取指定记录的评论对象。可以简化写法 RecordComments.Item(1) 可以简化为 RecordComments(1) + +## 语法 +表达式.Item(Index) + +表达式:RecordComments + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|number/string|传入number时记录索引从1开始,传入字符串时表示记录id| + +## 返回值 +Self + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.ActiveView.RecordComments.Item(1).Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const values = Application.ActiveView.RecordComments.Item(1).Count +} +main()``` + +``` + +## 393. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / OnCreate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_OnCreate + +```markdown +# 监听插入评论 +RecordComments.OnCreate(方法) + + +## 说明 + +为 RecordComments 添加 OnCreate 事件,当创建 评论 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 +这个方法只能监听视图的事件, 如果在浏览器环境需要全局监听也可以使用 + +``` javascript +jssdk.on("OnBroadcast", async (res) => { + const data = res.Data + if (data.type == "DB_COMMENT_UPDATE") { // 收到文档评论更新消息 + if (data.shouldNotLocalUpdate) { + // 本地更新评论信息 + console.log("收到广播消息:", data) + const info = data.info + const {sheetStId, commentId, recordId, action} = info + if (action == "Add") { + // 新增评论 + const addText = await jssdk.Application.Sheets.ItemById(sheetStId).ActiveView.RecordComments(recordId).Item(commentId).Text + console.log("新增评论:", addText) + } else if (action == "Delete") { + // 删除评论 + console.log("删除评论:", info) + } + } + } +}) +``` + +可以通过 action 来判断是哪个事件触发的 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: RecordComments + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordComments.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 +DbComment + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.ActiveView.RecordComments.OnCreate(async (data)=> { + const info = data.info + const {sheetStId, commentId, recordId, action} = info + if (action == "Add") { + // 新增评论 + const addText = await app.Sheets.ItemById(sheetStId).ActiveView.RecordComments(recordId).Item(commentId).Text + console.log("新增评论:", addText) + } else if (action == "Delete") { + // 删除评论 + console.log("删除评论:", info) + } + }) + + // 移除监听 + // eventContext.Destroy(); +} +``` + +``` + +## 394. 开发指南 / WPS多维表格开发 / API文档 / API / RecordComments / OnDelete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordComments_OnDelete + +```markdown +# 监听删除评论 +RecordComments.OnDelete(方法) + + +## 说明 + +为 RecordComments 添加 Delete 事件,当删除 评论 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 +这个方法只能监听视图的事件, 如果在浏览器环境需要全局监听也可以使用 + +jssdk.on("OnBroadcast", (res)=>console.error("##", res)) + +回调的消息数据包含的内容跟事件返回数据是一致的, 可以通过 action 来判断是哪个事件触发的 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: RecordComments + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordComments.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| commentId | String | 评论ID | +| recordId | String | 记录ID | +| sheetStId | Number | 表ID | + +## 事件返回数据示例 + +``` +{"recordId":"Bk","sheetStId":1,"commentId":"e66e42020baa4d5455da5d2043c631a5","action":"Delete"} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.ActiveView.RecordComments.OnDelete((data)=>console.error(JSON.stringify(data))) + await app.ActiveView.RecordComments(1).Item(1).Delete() + + // 移除监听 + // eventContext.Destroy(); +} +``` + +``` + +## 395. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / RecordRange对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange + +```markdown +# RecordRange (对象) + + +## 说明 +RecordRange对象代表记录Record,如果RecordRange在Sheet上返回,则此RecordRange指向的是Sheet上的数据,如果RecordRange在View上返回,则此RecordRange指向的是视图上的数据。我们为RecordRange提供了多种读取数据的方法。 + +字段选择器可以使用以下几种来选取记录 + +1、通过数值指定索引的记录 +``` +RecordRange(1) +``` +2、通过指定记录ID来指定记录 +``` +RecordRange("a") +``` +3、通过符号:可以指定索引范围的记录 +``` +RecordRange("1:100") +``` +4、通过数组可以指定不连续的记录 +``` +RecordRange(["1","5","10:20"]) +``` +5、通过参数2为字符串指定字段ID可以限定显示的字段 +``` +RecordRange(1, "a") +``` +6、通过参数2为数组可以指定多个字段ID可以限定显示的字段 +``` +RecordRange(1, ["a","b","A"]) +``` +7、通过参数2如果以@字符作为首字符表示字段名称 +``` +RecordRange(1, ["@名称", "@数量"]) +``` +8、通过 [Condition()](/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition) 方法来筛选符合条件的记录 + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/RecordRange_Item) +- [Add](/app-integration-dev/guide/dbsheet/Api/RecordRange_Add) +- [Condition](/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition) +- [Delete](/app-integration-dev/guide/dbsheet/Api/RecordRange_Delete) +- [Select](/app-integration-dev/guide/dbsheet/Api/RecordRange_Select) +- [SetValues](/app-integration-dev/guide/dbsheet/Api/RecordRange_SetValues) + +## 属性 +- [Id](/app-integration-dev/guide/dbsheet/Api/RecordRange_Id) +- [Index](/app-integration-dev/guide/dbsheet/Api/RecordRange_Index) +- [FieldId](/app-integration-dev/guide/dbsheet/Api/RecordRange_FieldId) +- [Count](/app-integration-dev/guide/dbsheet/Api/RecordRange_Count) +- [Text](/app-integration-dev/guide/dbsheet/Api/RecordRange_Text) +- [Value](/app-integration-dev/guide/dbsheet/Api/RecordRange_Value) +- [Font](/app-integration-dev/guide/dbsheet/Api/RecordRange_Font) +- [Interior](/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior) + +## 事件 +- [OnUpdate](/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate) +- [OnDeleteRecord](/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const values = await app.ActiveView.RecordRange(1, ["@名称", "@日期", "@数量"]).Value + console.log(values) // 输出 (3) ['aaaa', 45470, 1] +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const values = Application.ActiveView.RecordRange(1, ["@名称", "@日期", "@数量"]).Value + console.log(values) // 输出 (3) ['aaaa', 45470, 1] +} +main() +``` +``` + +## 396. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Add + +```markdown +# 插入记录 + +## 说明 +插入新的记录,在指定行记录之前或之后插入 + +## 语法 +表达式.Add(Before,After,Count) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|Number/String|在行记录之前添加,Number时指定插入时索引,String时指定插入ID| +|After|否|Number/String|在行记录之后添加,Number时指定插入时索引,String时指定插入ID| +|Count|否|Number|一次插入N条数据,未指定时插入1条| + + +## 返回值 +Self + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 在第1行,向上方添加10条记录 + const range = await app.ActiveView.RecordRange.Add(1, null, 10) + + const template = ["商品"] + const range1 = [] + // 给1-10行赋值 + for (let i = 1; i < 11; i++ ) { + range1.push([template[0]+i,i]) + } + range.Value = range1 + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const range = Application.ActiveView.RecordRange.Add(31, null, 5) + // 将插入的5条记录的名称字段 初始化为 “名称” + range.Item(undefined, "@名称").Value = "名称" +} +main() +``` + +``` + +## 397. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Condition + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Condition + +```markdown +# 筛选记录 + +## 说明 +筛选符合条件的记录 + +## 语法 +表达式.Condition(Filters,FilterOp) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Filters|是|Filter[]|筛选数据的条件组, 条件组里每个Filter,可以包含多个筛选条件| +|FilterOp|否|"And"/"Or"|筛选数据条件组之间的关系,是同时满足还是只需要满足一条,默认值为And| + +Filter数据结构: +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Criterias|是|[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria)[]|筛选条件项组| +|Op|否|"And"/"Or"|筛选条件项组之间的关系,是同时满足还是只需要满足一条,默认值为And| + + + +[Criteria](/app-integration-dev/guide/dbsheet/Api/Criteria) 中筛选规则(大小写不敏感): +|枚举值|描述| +|---|---| +|Equals|等于| +|NotEqu|不等于| +|Greater|大于| +|GreaterEqu|大等于| +|Less|小于| +|LessEqu|小等于| +|GreaterEquAndLessEqu|介于(取等)| +|LessOrGreater|不介于(不取等)| +|BeginWith|开头是| +|EndWith|结尾是| +|Contains|包含| +|NotContains|不包含| +|Intersected|指定值| +|Empty|为空| +|NotEmpty|不为空| + +各筛选规则独立地限制了values数组内最多允许填写的元素数,当values内元素数超过阈值时,该筛选规则将失效。“为空、不为空”不允许填写元素;“介于”允许最多填写2个元素;“指定值”允许填写65535个元素;其他规则允许最多填写1个元素 +values[]数组内的元素为字符串时,表示文本匹配。目前还支持对日期进行动态筛选,此时values[]内的元素需以结构体的形式给出: +``` +const dateValue = {"dynamicType": "lastMonth","type": "DynamicSimple"} +Criteria("@日期", "Equals", [dateValue]) +``` +上述示例对应的筛选条件为“等于上一个月”。 +要使用日期动态筛选,values[]内的结构体需要指定"type": "DynamicSimple",当"op"为"equals"时,"dynamicType"可以为如下的值(大小写不敏感): +|枚举值|描述| +|---|---| +|today|今天| +|yesterday|昨天| +|tomorrow|明天| +|last7Days|最近7天| +|last30Days|最近30天| +|thisWeek|本周| +|lastWeek|上周| +|nextWeek|下周| +|thisMonth|本月| +|lastMonth|上月| +|nextMonth|次月| + +当"op"为"greater"或"less"时,"dynamicType"只能是昨天、今天或明天。 + +对不同字段类型,values会有不同的用法 +联系人字段: +``` +// value是一个结构体,指定type为 Contact, value 为用户id +const dateValue = {"type":"Contact", value:"user id"} +``` +单/多选项字段: +``` +// value是一个结构体,指定type为 SelectItem, value 为选项的ID +const dateValue = {"type":"SelectItem", value:"B"} +``` + +## 返回值 +RecordRange + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 创建筛选条件criteria + const Criteria = app.Criteria + const criterias = [] + criterias.push(await Criteria("@名称", "Intersected", ["1"])) + // 创建筛选列表filters + const filters = [] + const filter = {Criterias: criterias, Op: "AND"} + filters.push(filter) + // 筛选记录 + const res = await app.ActiveSheet.Views(1).RecordRange.Condition(filters, "AND") + console.log(res) + // 操作记录,返回第一个筛选结果的记录ID + await res.Item(1).Id + // 删除记录 + await res.Item(1).Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 创建筛选条件criteria + const critera1 = Criteria("@名称", "Intersected", ["1", "999", "aaaa"]) + const critera2 = Criteria("@数量", "Equals", ["1"]) + const criterias = [] + criterias.push(critera1) + criterias.push(critera2) + // 创建filters + const filters = [] + const filter = { Criterias: criterias, Op: "OR" } + filters.push(filter) + const res = Application.ActiveSheet.Views(1).RecordRange.Condition(filters, "AND") + console.log(res.Value) +} +main() +``` + +``` + +## 398. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Count + +```markdown +# RecordRange.Count(属性) + + +## 说明 +可读写 + +返回当前RecordRange的记录数量,在View里返回View中可见记录数量,在Sheet返回所有的记录数量,如果指定了 RecordRange的范围则返回RecordRange的记录数量 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const viewCount = await instance.Application.ActiveView.RecordRange.Count + const sheetCount = await instance.Application.ActiveSheet.RecordRange.Count +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewCount = Application.ActiveView.RecordRange.Count + const sheetCount = Application.ActiveSheet.RecordRange.Count +} +main() +``` +``` + +## 399. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Delete + +```markdown +# RecordRange.Delete(方法) + +## 说明 +删除记录 + +## 语法 +表达式.Delete() + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +ApiResult + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + await instance.Application.ActiveView.RecordRange(41).Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.ActiveView.RecordRange(41).Delete() +} +main() +``` + +``` + +## 400. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / FieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_FieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_FieldId + +```markdown +# RecordRange.FieldId(属性) + + +## 说明 +可读写 + +返回指定RecordRange的字段Id,如果RecordRange未指定数据,则返回undefined + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await instance.Application.ActiveView.Selection.FieldId +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.ActiveView.Selection.FieldId +} +main() +``` +``` + +## 401. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Font + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Font` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Font + +```markdown +# 设置单元格的字体颜色 +RecordRange.Font + + + +## 说明 +可读写 + +返回当前RecordRange首个单元格的字体属性[Font](/app-integration-dev/guide/dbsheet/Api/Font) + +## 返回值 + +[Font](/app-integration-dev/guide/dbsheet/Api/Font) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordRange = await app.Sheet(1).RecordRange(1); + const font = await recordRange.Font + font.Color = "#ff00ff" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).RecordRange(1); + const font = recordRange.Font + font.Color = "#ff00ff" +} +main() +``` + +``` + +## 402. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Id + +```markdown +# RecordRange.Id(属性) + + +## 说明 +可读写 + +返回指定RecordRange的记录id,如果RecordRange未指定数据,则返回undefined + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await instance.Application.ActiveView.RecordRange(1).Id +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.ActiveView.RecordRange(1).Id +} +main() +``` +``` + +## 403. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Index + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Index` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Index + +```markdown +# RecordRange.Index(属性) + + +## 说明 +可读写 + +返回指定RecordRange的记录索引,如果RecordRange未指定数据,则返回undefined + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const index = await instance.Application.ActiveView.RecordRange("a").Index + if (index && index.length > 0) { + console.log(index) + } else { + console.log("记录不存在") + } + +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const index = Application.ActiveView.RecordRange("a").Index + if (index && index.length > 0) { + console.log(index) + } else { + console.log("记录不存在") + } +} +main() +``` +``` + +## 404. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Interior + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Interior + +```markdown +# 设置单元格的填充颜色 +RecordRange.Interior + + + +## 说明 +可读 +返回当前RecordRange首个单元格的填充属性[Interior](/app-integration-dev/guide/dbsheet/Api/Interior) + +## 返回值 + +[Interior](/app-integration-dev/guide/dbsheet/Api/Interior) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordRange = await app.Sheet(1).RecordRange(1); + const Interior = await recordRange.Interior + Interior.Color = "#ff00ff" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).RecordRange(1); + const Interior = recordRange.Interior + Interior.Color = "#ff00ff" +} +main() +``` + +``` + +## 405. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Item + +```markdown +# RecordRange.Item(方法) + +## 说明 +获取指定索引位置的记录 +1、通过数值指定索引的记录 +``` +RecordRange.Item(1) +``` +2、通过指定记录ID来指定记录 +``` +RecordRange.Item("a") +``` +3、通过符号:可以指定索引范围的记录 +``` +RecordRange.Item("1:100") +``` +4、通过数组可以指定不连续的记录 +``` +RecordRange.Item(["1","5","10:20"]) +``` +5、通过参数2为字符串指定字段ID可以限定显示的字段 +``` +RecordRange.Item(1, "a") +``` +6、通过参数2为数组可以指定多个字段ID可以限定显示的字段 +``` +RecordRange.Item(1, ["a","b","A"]) +``` +7、通过参数2如果以@字符作为首字符表示字段名称 +``` +RecordRange.Item(1, ["@名称", "@数量"]) +``` + +## 语法 +表达式.Item(Index,Field) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|number/string/array|传入number时索引从1开始,传入字符串时表示id| +|Field|否|number/string/array|传入number时索引从1开始,传入字符串时如果字符串以@开始则表示为字段名称,否则为字段id| + + +## 返回值 +Self + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const values = await app.ActiveView.RecordRange.Item(1, ["@名称", "@日期", "@数量"]).Value +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const values = Application.ActiveView.RecordRange.Item(1, ["@名称", "@日期", "@数量"]).Value +} +main()``` + +``` + +## 406. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / OnDeleteRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_OnDeleteRecord + +```markdown +# 监听删除记录的事件 +RecordRange.OnDeleteRecord(方法) + + + +## 说明 + +为 RecordRange 添加 DeleteRecord 事件,当删除 RecordRange 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnDeleteRecord(Callback) + +表达式: RecordRange + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordRange.OnDeleteRecord(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| sheetId | Number | 表的 Id | +| recordIds | Array | 记录集合的 Ids | + +## 事件返回数据示例 + +``` +{ + recordIds: ['A','C'] + sheetId: 1 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .RecordRange(1) + .OnDeleteRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).RecordRange(1).Delete(); + //这里会执行OnDeleteRecord的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .RecordRange(1) + .OnDeleteRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).RecordRange(1).Delete(); + //这里会执行OnDeleteRecord的回调 +} +main(); +``` + +``` + +## 407. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / OnUpdate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_OnUpdate + +```markdown +# 监听修改记录的事件 +RecordRange.OnUpdate(方法) + + + +## 说明 + +为 RecordRange 添加 Update 事件,当更新 RecordRange 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnUpdate(Callback) + +表达式: RecordRange + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await RecordRange.OnUpdate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +[RecordRange] + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .RecordRange(1) + .OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).RecordRange(1).Value = ['名称111', 4, '选项1']; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .RecordRange(1) + .OnUpdate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).RecordRange(1).Value = ['名称111', 4, '选项1']; +} +main(); +``` + +``` + +## 408. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Select + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Select` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Select + +```markdown +# RecordRange.Select(方法) + +## 说明 +插入新的记录 + +## 语法 +表达式.Select() + +表达式:RecordRange + +## 参数 +无 + +## 返回值 +Boolean + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const range = await app.ActiveView.RecordRange(1) + range.Select() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const range = Application.ActiveView.RecordRange(1) + // 将插入的5条记录的名称字段 初始化为 “名称” + range.Select() +} +main() +``` + +``` + +## 409. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / SetValues + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_SetValues` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_SetValues + +```markdown +# RecordRange.SetValues(方法) + +## 说明 +设置指定单元格的值 + +## 语法 +表达式.SetValues(Values, ignoreErr) + +表达式:RecordRange + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Values|是|Array|设置到单元格的值| +|ignoreErr|否|bool|默认值为flase,当设置为true时,输入数据中某一条数据出错,这条数据不写入,其它数据正常写入;当设置为false时,其中一条数据出错,则都不写入| + + +## 返回值 +ApiResult + + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application; + const res = await WPSOpenApi.Application.RecordRange("1:2", ["@名称", "@数量"]).SetValues([["1111", 2222]], true) + if (res.code !== 0) { + console.log(res.Message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + + const res = Application.RecordRange("1:2", ["@名称", "@数量"]).SetValues([["1111", 2222]], true) + if (res.code !== 0) { + console.log(res.Message) + } +} +main() +``` + +``` + +## 410. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Text + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Text` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Text + +```markdown +# RecordRange.Text(属性) + + +## 说明 +只读 +返回指定区域的文本值 + +## 返回值 +String/Array + +这里返回的文本根据区域会有三种情况,RecordRange 选择器参看[RecordRange](/app-integration-dev/guide/dbsheet/Api/RecordRange)的说明 +1、指定的区域为一条记录一个字段,返回值为 字符串 +``` +Application.ActiveSheet.RecordRange(1,1).Text +``` +2、指定的区域为一条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange(1,[1,2]).Text +``` +3、指定的区域为多条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange([1,2],[1,2]).Text +``` + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + console.log(await app.ActiveSheet.RecordRange([1,2],[1,2]).Text) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + console.log(Application.ActiveSheet.RecordRange([1,2],[1,2]).Text) +} +main() +``` +``` + +## 411. 开发指南 / WPS多维表格开发 / API文档 / API / RecordRange / Value + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/RecordRange_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/RecordRange_Value + +```markdown +# 设置单元格内容 +RecordRange.Value + + +## 说明 +可读写 + +RecordRange的值,读取和设置记录数据 + +## 返回值 +DbCellValue + +### 这里返回的文本根据区域会有三种情况,RecordRange 选择器参看[RecordRange](/app-integration-dev/guide/dbsheet/Api/RecordRange)的说明 +1、指定的区域为一条记录一个字段,返回单个值(值的类型看具体字段) +``` +Application.ActiveSheet.RecordRange(1,1).Value +``` +2、指定的区域为一条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange(1,[1,2]).Value +``` +3、指定的区域为多条记录的多个字段,返回值为二维数组 +``` +Application.ActiveSheet.RecordRange([1,2],[1,2]).Value +``` + +### 设置值的时候,也有三种设置值的方式 +1、设置为单个值,将这个值设置到整个区域的指定单元格 +``` +Application.ActiveSheet.RecordRange([1,2],[1,2]).Value = "1" +``` +2、传入一维数组,目标是一条记录,则将数组设置到目标区域,如果目标是多条记录,则会将相同的数据设置到所有记录。 +``` +Application.ActiveView.RecordRange([1,2],[1,2]).Value = ["1","2"] +``` +3、传入二维数组,如果二维数组的长度为1,目标是一条记录,则将二维数组[0]设置到目标区域,如果目标是多条记录,则会将相同的数据设置到所有记录。如果二维数组为 M x N,则按顺序传入到目标区域。 +``` +Application.ActiveView.RecordRange([1,2],[1,2]).Value = [["1","2"],["3","4"]] + +// 数组长度为1时等价于 [["1","2"],["1","2"]] +Application.ActiveView.RecordRange([1,2],[1,2]).Value = [["1","2"]] +``` +### 不同字段类型设置Value时的数据结构 +地址字段类型: 通过DBCellValue() 生成字段的数据 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@地址").Value = DBCellValue({districts:["广东省","珠海市","香洲区"],detail:"前岛环路xxxx号"}) +``` +级联字段类型:通过DBCellValue() 生成字段的数据 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@级联选项").Value = DBCellValue({districts:["广东省","珠海市","香洲区"]}) +``` +超链接字段类型: +``` +Application.RecordRange(1, "@超链接").Value = Application.DBCellValue({address:"wps.cn", display:"wps"}) +``` + +关联字段类型: 参数传入关联的记录id +``` +const DBCellValue = Application.DBCellValue +Application.Sheets(1).Views(2).RecordRange(1, "@关联:数据表").Value = DBCellValue(["b","V"]) +``` + +多选项类型: +``` +Application.Sheets(1).Views(2).RecordRange([5,6], 4).Value =[[DBCellValue(["未开始","进行中"])], DBCellValue(["进行中"])] +``` + +联系人字段类型:直接传入联系人的id,如果有多个联系人,可用","进行分割 +``` +Application.Sheets(1).Views(2).RecordRange([5,6], "@联系人").Value = "238777563" +``` + +图片与附件字段:可以传入包含 URL/base64编码的图片/云文档 的数组,支持多个附件。 +注意:由于脚本有运行时长限制,附件较大/或者较多时会导致超时,设置失败 +``` +Application.Sheets(1).Views(2).RecordRange(1, "@图片和附件").Value = DBCellValue([{fileData: url/base64, fileName: ""}]) +``` +如果要在原来的附件上,新增其它附件可以先读出来的数组增加后再重新设置 +``` +const range = Application.Sheets(1).Views(2).RecordRange(1, "@图片和附件") +const dbCellValue = range.Value +const attments = dbCellValue.Value +attments.push({fileData: url/base64, fileName: ""}) +range.Value = oldValue +``` + +其它字段类型可以直接使用字符串,日期和时间类型必须符合日期的格式的字符串 + +### 部分不支持设置值的字段类型 + DbSheetFieldType.Formula, // 公式字段 + DbSheetFieldType.Lookup, // 引用字段 + DbSheetFieldType.CreatedBy, // 创建者字段 + DbSheetFieldType.Note, // 富文本字段 + DbSheetFieldType.SearchLookup, // 查找引用字段 + DbSheetFieldType.Button, // 按钮字段 + DbSheetFieldType.LastModifiedBy, // 最近修改者字段 + DbSheetFieldType.CreatedTime, // 创建时间字段 + DbSheetFieldType.LastModifiedTime, //最后修改时间字段 + DbSheetFieldType.AutoNumber, // 自动编号 + DbSheetFieldType.Automations, // 自动任务 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(2).RecordRange([5,6], 1).Value = "1111111" +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).Views(2).RecordRange([5,6], 1).Value = "1111111" +} +main() +``` +``` + +## 412. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Delete + +```markdown +# Record.Delete(方法) + + +## 说明 +删除当前行 + +## 语法 +表达式.Delete() + +表达式:Record + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + record.Delete() +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + record.Delete() +} +main() +``` +``` + +## 413. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Id + +```markdown +# Record.Id(属性) + + + +## 说明 + +可读 +返回整行记录、单个记录字段的Id + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10); + console.log(await record.Id); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10); + console.log(record.Id); +} +main() +``` +``` + +## 414. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Item + +```markdown +# Record.Item(方法) + + +## 说明 +获取指定索引位置的字段记录 + +## 语法 +表达式.Item(Index) + +表达式:Record + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/字段ID| + +## 返回值 +Record + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + const info = record.Item(1) // 获取第10行号的第一个字段 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + const info = record.Item(1) // 获取第10行号的第一个字段 +} +main() +``` +``` + +## 415. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Select + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Select` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Select + +```markdown +# 选中记录 + + +## 说明 +选中某个区域 + +## 语法 +表达式.Select() + +表达式:Record + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + record.Select() // 选中第10行的记录 + + const info = app.Sheets(1).Views(1).Records(10, 1) + await info.Select() // 选中第10行,第一个字段 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + record.Select() // 选中第10行的记录 + + const info = Application.Sheets(1).Views(1).Records(10, 1) + info.Select() // 选中第10行,第一个字段 +} +main() +``` +``` + +## 416. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Text + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Text` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Text + +```markdown +# Record.Text(属性) + + +## 说明 +可读 +返回整行记录、单个记录字段的值 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + console.log(await record.Text) // 获取第10行的记录 + + const info = app.Sheets(1).Views(1).Records(10, 1) + console.log(await info.Text) // 获取第10行,第一个字段的值 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const groups = Application.Sheets(1).Views(1).Groups; +} +main() +``` +``` + +## 417. 开发指南 / WPS多维表格开发 / API文档 / API / Record / Value + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Record_Value` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Record_Value + +```markdown +# Record.Value(属性) + + +## 说明 +可读写 + +返回整行记录,抑或返回、设置单个记录字段的值。 + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = app.Sheets(1).Views(1).Records(10) + console.log(await record.Value) // 获取第10行的记录 + + const info = app.Sheets(1).Views(1).Records(10, 1) + console.log(await info.Value) // 获取第10行,第一个字段的值 + + info.Value = '1' // 值设为 1 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + console.log(record.Value) // 获取第10行的记录 + + const info = Application.Sheets(1).Views(1).Records(10, 1) + console.log(info.Value) // 获取第10行,第一个字段的值 + + info.Value = '1' // 值设为 1 +} +main() +``` +``` + +## 418. 开发指南 / WPS多维表格开发 / API文档 / API / Records / Records对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records + +```markdown +# Records (对象) + + +## 说明 +Records 对象,表示记录相关集合,用户可通过Records对象直接访问记录和字段 +支持以下几种访问方式 +View.Records.Item(记录id) +View.Records.Item(记录索引) +View.Records(记录ID/记录索引, 字段索引/字段名称) +View.Records(记录ID/记录索引).Item(字段索引/字段名称) + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/Records_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/Records_Add) +* [Delete](/app-integration-dev/guide/dbsheet/Api/Records_Delete) +* [FindNext](/app-integration-dev/guide/dbsheet/Api/Records_FindNext) +* [FindPrevious](/app-integration-dev/guide/dbsheet/Api/Records_FindPrevious) + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/Groups_Count) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records(10) + // 返回字段的文本表示 + console.log(await record.Text) + // 返回字段的值 + console.log(await record.Value) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records(10) + // 返回字段的文本表示 + console.log(record.Text) + // 返回字段的值 + console.log(record.Value) + } +main() +``` +``` + +## 419. 开发指南 / WPS多维表格开发 / API文档 / API / Records / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Add + +```markdown +# 添加记录 + + +## 说明 +添加一条或者多条记录 + +## 语法 +表达式:Add(Before, After, Count) + +表达式:Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|number/string|指定的记录对象(索引从1开始/记录ID),新建的记录将基于此之前| +|After|否|number/string|指定的记录对象(索引从1开始/记录ID),新建的记录将基于此之后| +|Count|否|number|插入多少条记录,默认值为1条| + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(1).Records.Add(undefined, 10, 2) // 在第10行,向下方添加2条记录 + const records = await app.Sheets(1).Views(1).Records.Add(10, undefined, 2) // 在第10行,向上方添加2条记录 + // 在插入的第一条记录的首字段填入 "123" + records.Item(1, 1).Value = "123" +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const records = Application.Sheets(1).Views(1).Records.Add(10, undefined, 2) // 在第10行,向上方添加2条记录 + // 在插入的第一条记录的首字段填入 "123" + records.Item(1, 1).Value = "123" + } +main() +``` +``` + +## 420. 开发指南 / WPS多维表格开发 / API文档 / API / Records / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Count + +```markdown +# Records.Count(属性) + + +## 说明 +可读 +返回Records列表的数量 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const records = await app.Sheets(1).Views(1).Records + // 返回记录数量 + console.log(await records.Count) + const insertRecords = await app.Sheets(1).Views(1).Records.Add(10, undefined, 2) // 在第10行,向上方添加2条记录 + // 输出 2 + console.log(await insertRecords.Count) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const records = Application.Sheets(1).Views(1).Records + // 返回记录数量 + console.log(records.Count) + const insertRecords = Application.Sheets(1).Views(1).Records.Add(10, undefined, 2) // 在第10行,向上方添加2条记录 + // 输出 2 + console.log(insertRecords.Count) + } +main() +``` +``` + +## 421. 开发指南 / WPS多维表格开发 / API文档 / API / Records / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Delete + +```markdown +# 删除记录 + + +## 说明 +删除某行记录 + +## 语法 +表达式:Delete(Index) + +表达式:Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/记录ID| + +## 返回值 +ApiResult + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 删除视图上的第一条数据 + app.Sheets(1).Views(1).Records.Delete(1) + // 在第10行,向上方添加2条记录 + const records = await app.Sheets(1).Views(1).Records.Add(10, undefined, 2) + // 删除刚插入的第一条数据 + records.Delete(1) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + // 删除视图上的第一条数据 + Application.Sheets(1).Views(1).Records.Delete(1) + // 在第10行,向上方添加2条记录 + const records = Application.Sheets(1).Views(1).Records.Add(10, undefined, 2) + // 删除刚插入的第一条数据 + records.Delete(1) + } +main() +``` +``` + +## 422. 开发指南 / WPS多维表格开发 / API文档 / API / Records / FindNext + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_FindNext` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_FindNext + +```markdown +# Application.FindNext (方法) + + +## 说明 +1. 查找匹配相同条件(当前活动单元格)的下一个单元格,并返回表示该单元格的 Record 对象,该操作不影响选定内容和活动单元格。 +2. 持续地调用该方法会返回同一个查找单元格,需要结合`Record.select()`方法移动活动单元格后再调用,才会继续查找下一个值。 + +## 语法 +表达式: FindNext(What) + +表达式: Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|What|是|String|查找值| + +## 返回值 +Record | Null + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records.FindNext('查找值'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records.FindNext('查找值'); +} +main() +``` +``` + +## 423. 开发指南 / WPS多维表格开发 / API文档 / API / Records / FindPrevious + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_FindPrevious` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_FindPrevious + +```markdown +# Application.FindPrevious (方法) + + +## 说明 +1. 查找匹配相同条件(当前活动单元格)的上一个单元格,并返回表示该单元格的 Record 对象,该操作不影响选定内容和活动单元格。 +2. 持续地调用该方法会返回同一个查找单元格,需要结合`Record.select()`方法移动活动单元格后再调用,才会继续查找上一个值。 + +## 语法 +表达式: FindPrevious(What) + +表达式: Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|What|Y|String|查找值| + +## 返回值 +Record | Null + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records.FindPrevious('查找值'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records.FindPrevious('查找值'); +} +main() +``` +``` + +## 424. 开发指南 / WPS多维表格开发 / API文档 / API / Records / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Records_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Records_Item + +```markdown +# 查看记录 + + +## 说明 +获取指定索引行的记录信息 + +## 语法 +表达式:Item(Index) + +表达式:Records + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/记录ID| + +## 返回值 +Record + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const record = await app.Sheets(1).Views(1).Records.Item(10) + // 返回字段的文本表示 + console.log(await record.Text) + // 返回字段的值 + console.log(await record.Value) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const record = Application.Sheets(1).Views(1).Records.Item(10) + // 返回字段的文本表示 + console.log(record.Text) + // 返回字段的值 + console.log(record.Value) + } +main() +``` +``` + +## 425. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Role对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role + +```markdown +# Role (对象) + + +## 说明 +获取文档的自定义权限角色对象 + + +## 方法 +- [DeleteUser](/app-integration-dev/guide/dbsheet/Api/Role_DeleteUser) +- [AddUser](/app-integration-dev/guide/dbsheet/Api/Role_AddUser) +- [DeleteAndReplacedBy](/app-integration-dev/guide/dbsheet/Api/Role_DeleteAndReplacedBy) + +## 属性 +* [PermissionSettings](/app-integration-dev/guide/dbsheet/Api/Role_PermissionSettings) +* [Name](/app-integration-dev/guide/dbsheet/Api/Role_Name) +* [Id](/app-integration-dev/guide/dbsheet/Api/Role_Id) +* [Description](/app-integration-dev/guide/dbsheet/Api/Role_Description) +* [IsBuiltIn](/app-integration-dev/guide/dbsheet/Api/Role_IsBuiltIn) +* [Type](/app-integration-dev/guide/dbsheet/Api/Role_Type) +* [Users](/app-integration-dev/guide/dbsheet/Api/Role_Users) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const role = await app.Permission2.Roles.Item(1); + // 打印出列表中第一个权限角色名 + console.log(role.Name); + } +``` ` +## 脚本编辑器 示例 +``` javascript +function main() { + const role = Application.Permission2.Roles.Item(1); + // 打印出列表中第一个权限角色名 + console.log(role.Name); +} +main() +``` +``` + +## 426. 开发指南 / WPS多维表格开发 / API文档 / API / Role / AddUser + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_AddUser` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_AddUser + +```markdown +# Role.AddUser(方法) + + + +## 说明 + +权限角色中添加协作者 + +添加协作者前要求文件开启分享,如果当前文档暂未开启分享,会添加失败提示Error: can't add user. FileNotShare + +单次添加协作者的数量限制是20,超过20会失败并提示Adding more than the limit of collaborators at one time! + +## 语法 + +表达式.AddUser(Users) + +表达式:Role + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Users | 是 | DbUser | 权限角色中需要添加的协作者数组 | + +## 返回值 + +User + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const editRole = await app.Permission2.Roles(2); + const users = []; + const user1 = await app.User("283091702", "企业用户_283031898", "http://avatar.qwps.cn/avatar/5LyB5Lia55So5oi3XzI4MzAzMTg5OA=="); + users.push(user1); + await editRole.AddUser(users); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const users = []; + const user1 = Application.User("283091702", "企业用户_283031898", "http://avatar.qwps.cn/avatar/5LyB5Lia55So5oi3XzI4MzAzMTg5OA=="); + users.push(user1); + Application.Permission2.Roles.Item(2).AddUser(users); +} +main(); +``` + +``` + +## 427. 开发指南 / WPS多维表格开发 / API文档 / API / Role / DeleteAndReplacedBy + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_DeleteAndReplacedBy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_DeleteAndReplacedBy + +```markdown +# Role.DeleteAndReplacedBy(方法) + + + +## 说明 + +删除当前角色,并将当前角色下的协作者放到参数Index对应的角色下, Index可以是索引也可以是自定义角色名 + +系统角色不能删除,参数Index对应的角色不能是系统可管理角色或无权限角色。 + +## 语法 + +表达式.DeleteAndReplacedBy(Index) + +表达式:Role + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | String/Number | 将准备删除的自定义角色下的协作者放到参数Index对应的角色下 | + +## 返回值 + +ApiResult + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const roles = await app.Permission2.Roles; + const customName = "自定义设置的角色"; + // 添加自定义角色下的协作者 + const role = roles.Add(customName); + const userArray = []; + const user1 = await Application.User("283091702"); + userArray.push(user1); + const user2 = await Application.User("283093318"); + userArray.push(user2); + const user3 = await Application.User("283108459"); + userArray.push(user3); + role.AddUser(userArray); + // 将自定义角色删除,删除自定义角色后,该角色下的协作者被放到了系统可编辑角色下 + const result = await role.DeleteAndReplacedBy(2); + console.log(result); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customName = "自定义设置的角色"; + // 添加自定义角色下的协作者 + const role = Application.Permission2.Roles.Add(customName); + const userArray = []; + const user1 = Application.User("283091702"); + userArray.push(user1); + const user2 = Application.User("283093318"); + userArray.push(user2); + const user3 = Application.User("283108459"); + userArray.push(user3); + role.AddUser(userArray); + // 将自定义角色删除,删除自定义角色后,该角色下的协作者被放到了系统可编辑角色下 + const result = role.DeleteAndReplacedBy(2); + console.log(result); +} +main(); +``` + +``` + +## 428. 开发指南 / WPS多维表格开发 / API文档 / API / Role / DeleteUser + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_DeleteUser` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_DeleteUser + +```markdown +# Role.DeleteUser(方法) + + + +## 说明 + +权限角色中删除协作者 + + +## 语法 + +表达式.DeleteUser(User) + +表达式:Role + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| User | 是 | DbUser | 权限角色中需要删除的协作者 | + +## 返回值 + +ApiResult + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const editRole = await app.Permission2.Roles(2); + const users = []; + const user1 = await app.User("283091702", "企业用户_283031898", "http://avatar.qwps.cn/avatar/5LyB5Lia55So5oi3XzI4MzAzMTg5OA=="); + users.push(user1); + await editRole.AddUser(users); + const result = await editRole.DeleteUser(user1); + console.log(result.Code === 0); // 删除成功 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const users = []; + const user1 = Application.User("283091702", "企业用户_283031898", "http://avatar.qwps.cn/avatar/5LyB5Lia55So5oi3XzI4MzAzMTg5OA=="); + users.push(user1); + const editRole = Application.Permission2.Roles.Item(2); + editRole.AddUser(users); + const result = editRole.DeleteUser(user1); + console.log(result.Code === 0); // 删除成功 +} +main(); +``` + +``` + +## 429. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Description + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_Description` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_Description + +```markdown +# Role.Description(属性) + + + +## 说明 + +可读 +获取权限角色描述信息 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const description = await app.Permission2.Roles(1).Description; + // 将第一个角色描述打印出来 + console.log(description); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const description = Application.Permission2.Roles(1).Description; + // 将第一个角色描述打印出来 + console.log(description); +} +main(); +``` + +``` + +## 430. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_Id + +```markdown +# Role.Id(属性) + + + +## 说明 + +可读 +获取权限角色ID + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const id = await app.Permission2.Roles(1).Id; + // 将角色id打印出来 + console.log(id); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const id = Application.Permission2.Roles(1).Id; + // 将角色id打印出来 + console.log(id); +} +main(); +``` + +``` + +## 431. 开发指南 / WPS多维表格开发 / API文档 / API / Role / IsBuiltIn + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_IsBuiltIn` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_IsBuiltIn + +```markdown +# Role.IsBuiltIn(属性) + + +## 说明 +可读 +是否为系统角色 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +// 是否为系统角色 +async function example() { + await instance.ready(); + const app = instance.Application; + const isBuiltIn = await app.Permission2.Roles(1).IsBuiltIn; + // 将结果打印出来 + console.log(isBuiltIn); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const isBuiltIn = Application.Permission2.Roles(1).IsBuiltIn; + // 将结果打印出来 + console.log(isBuiltIn); +} +main() +``` +``` + +## 432. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_Name + +```markdown +# Role.Name(属性) + + + +## 说明 + +可读 +获取权限角色名称 + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +// 获取权限角色名称 +async function example() { + await instance.ready(); + const app = instance.Application; + const roleName = await app.Permission2.Roles(1).Name; + // 将第一个权限角色名称打印出来 + console.log(roleName); +} + +// 设置权限角色名称---只能设置自定义角色的名称,系统角色名称不支持自定义设置 +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("自定义名字"); + // 将刚添加的自定义角色名改为CustomName + customRole.Name = 'CustomName'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +// 获取权限角色名称 +function main() { + const roleName = Application.Permission2.Roles(1).Name; + // 将第一个权限角色名称打印出来 + console.log(roleName); +} + +// 设置权限角色名称---只能设置自定义角色的名称,系统角色名称不支持自定义设置 +function main() { + const customRole = Application.Permission2.Roles.Add("自定义名字"); + // 将刚添加的自定义角色名改为CustomName + customRole.Name = 'CustomName'; +} +main(); +``` + +``` + +## 433. 开发指南 / WPS多维表格开发 / API文档 / API / Role / PermissionSettings + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_PermissionSettings` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_PermissionSettings + +```markdown +# Role.PermissionSettings(属性) + + + +## 说明 + +可读 +获取角色的内容权限设置列表 + +每个角色下的内容权限设置列表是当前文档下所有的Sheet的内容权限设置集合,系统角色不支持该属性,自定义角色支持该属性。 + +## 返回值 + +PermissionSettings + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const customRole = await app.Permission2.Roles.Add("CustomRole"); + const permissionSettings = await customRole.PermissionSettings; + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(permissionSettings.Count); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customRole = Application.Permission2.Roles.Add("CustomRole"); + // 将设置的自定义角色的权限设置列表长度打印出来 + console.log(customRole.PermissionSettings.Count); +} +main(); +``` + +``` + +## 434. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_Type + +```markdown +# Role.Type(属性) + + + +## 说明 + +可读 +获取权限角色类型 + +## 返回值 + +[RoleBuildInType](/app-integration-dev/guide/dbsheet/Api/Enum_RoleBuildInType) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const type = await app.Permission2.Roles(1).Type; + // 将第一个角色权限类型打印出来 + console.log(type); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const type = Application.Permission2.Roles(1).Type; + // 将第一个角色权限类型打印出来 + console.log(type); +} +main(); +``` + +``` + +## 435. 开发指南 / WPS多维表格开发 / API文档 / API / Role / Users + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Role_Users` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Role_Users + +```markdown +# Role.Users(属性) + + + +## 说明 + +可读 +获取角色的协作者列表 + + +## 返回值 + +RoleUsers + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const systemManageRole = await app.Permission2.Roles(1); + const roleUsers = await systemManageRole.Users; + const userCount = await roleUsers.Count + // 将可管理系统角色下的协作者人数打印出来 + console.log(userCount); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const systemManageRole = Application.Permission2.Roles(1); + // 将可管理系统角色下的协作者人数打印出来 + console.log(systemManageRole.Users.Count); +} +main(); +``` + +``` + +## 436. 开发指南 / WPS多维表格开发 / API文档 / API / Roles / Roles对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Roles` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Roles + +```markdown +# Roles (对象) + + +## 说明 +获取文档的自定义权限角色对象列表 + +列表中包括三个系统角色和设置的自定义角色 +系统角色分别为:可管理、可编辑、可查看,系统角色不能删除编辑权限内容,只能在系统角色中添加删除协作者 +自定义角色是用户自己设置权限内容的角色,可以添加、删除和编辑,设置自定义角色名不能与已经存在的角色同名。 + + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/Roles_Item) +- [Add](/app-integration-dev/guide/dbsheet/Api/Roles_Add) + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/Roles_Count) +* [NoPermissionRole](/app-integration-dev/guide/dbsheet/Api/Roles_NoPermissionRole) + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const roleCnt = await app.Permission2.Roles.Count; + // 打印出当前文档中的自定义内容权限的列表总数 + console.log(roleCnt) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const roleCnt = Application.Permission2.Roles.Count; + // 打印出当前文档中的自定义内容权限的列表总数 + console.log(roleCnt) +} +main() +``` +``` + +## 437. 开发指南 / WPS多维表格开发 / API文档 / API / Roles / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Roles_Add + +```markdown +# Roles.Add(方法) + + + +## 说明 + +通过角色名在列表中添加一个新的自定义内容权限角色 + +角色中的内容权限是默认的: + +* 数据表的权限 可编辑---可查看和编辑所有记录、可查看和编辑所有字段、允许添加记录和允许删除记录 +* 仪表盘的权限 无权限---用户无权限查看该仪表盘 +* 说明页面的权限 无权限---用户无权限查看该说明文档 + +## 语法 + +表达式.Add(Name) + +表达式:Roles + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Name | 是 | string | 添加的角色名称(角色名不能为空,长度不能超过20,不能是列表中已经存在的角色名) | + +## 返回值 + +Role + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const roles = await app.Permission2.Roles; + const customName = "自定义设置的角色"; + const role = roles.Add(customName); + // 打印出返回权限角色名 + console.log(role.Name); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const customName = "自定义设置的角色"; + const role = Application.Permission2.Roles.Add(customName); + // 打印出返回权限角色名 + console.log(role.Name); +} +main(); +``` + +``` + +## 438. 开发指南 / WPS多维表格开发 / API文档 / API / Roles / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Roles_Count + +```markdown +# Roles.Count(属性) + + + +## 说明 + +可读 +获取文档的自定义内容权限角色列表个数(不包括NoPermissionRole) + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +// 获取文档的自定义内容权限角色列表个数 +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.Permission2.Roles.Count; + console.log(count); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const count = Application.Permission2.Roles.Count; + console.log(count); +} +main(); +``` + +``` + +## 439. 开发指南 / WPS多维表格开发 / API文档 / API / Roles / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Roles_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Roles_Item + +```markdown +# Roles.Item(方法) + + + +## 说明 + +通过索引位置或角色名获取权限角色 + +## 语法 + +表达式.Item(Index) + +表达式:Roles + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number/string | 索引从 1 开始/角色名 | + +## 返回值 + +Role + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const roles = await app.Permission2.Roles; + const role = roles.Item(1); + // const role = roles.Item('可管理'); + // 打印出列表中第一个权限角色名 + console.log(role.Name); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + // const role = Application.Permission2.Roles.Item('可管理'); + const role = Application.Permission2.Roles.Item(1); + // 打印出列表中第一个权限角色名 + console.log(role.Name); +} +main(); +``` + +``` + +## 440. 开发指南 / WPS多维表格开发 / API文档 / API / Roles / NoPermissionRole + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Roles_NoPermissionRole` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Roles_NoPermissionRole + +```markdown +# Roles.NoPermissionRole(属性) + + + +## 说明 + +可读 +无权限角色,作为设置团队成员的默认角色的一个选项,也是一个Role对象,但是不能修改角色名称、添加删除协作者、被删除等 + +## 返回值 + +Role + +## 浏览器环境示例 + +``` javascript +// 获取无权限角色 +async function example() { + await instance.ready(); + const app = instance.Application; + const name = await app.Permission2.Roles.NoPermissionRole.Name; + console.log(name); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const name = Application.Permission2.Roles.NoPermissionRole.Name; + console.log(name); +} +main(); +``` + +``` + +## 441. 开发指南 / WPS多维表格开发 / API文档 / API / SelectField / SelectField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField + +```markdown +# SelectField (对象) + + +## 说明 +SelectField 单选项/多选项字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果单选项/多选项字段,无法设置相关属性 + +## 属性 +- [Items](/app-integration-dev/guide/dbsheet/Api/SelectField_Items) +- [IsAddItemWhenInputting](/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filed = await app.Sheets(1).FieldDescriptors("@状态") + const prop = await filed.Select + const Items = [] + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const filed = Application.Sheets(1).FieldDescriptors("@状态") + const prop = field.Select + const Items = [] + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +main() +``` +``` + +## 442. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 允许填写时添加选项 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting + +```markdown +# 允许填写时添加选项 +SelectField.IsAddItemWhenInputting(属性) + + +## 说明 +可读写 + +当字段类型为单选项或多选项时,可以通过设置 IsAddItemWhenInputting 属性设置允许填写时添加选项。当字段类型不是单选项或多选项时,属性无效。 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Select + prop.IsAddItemWhenInputting = true + field.Apply() + console.log(await prop.IsAddItemWhenInputting) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Select + prop.AllowAddItemWhenInputting = true + field.Apply() + console.log(prop.AllowAddItemWhenInputing) +} +main() +``` +``` + +## 443. 开发指南 / WPS多维表格开发 / API文档 / API / SelectField / IsAddItemWhenInputting + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_IsAddItemWhenInputting + +```markdown +# 允许填写时添加选项 +SelectField.IsAddItemWhenInputting(属性) + + +## 说明 +可读写 + +当字段类型为单选项或多选项时,可以通过设置 IsAddItemWhenInputting 属性设置允许填写时添加选项。当字段类型不是单选项或多选项时,属性无效。 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors(2) + const prop = await field.Select + prop.IsAddItemWhenInputting = true + field.Apply() + console.log(await prop.IsAddItemWhenInputting) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors(2) + const prop = field.Select + prop.AllowAddItemWhenInputting = true + field.Apply() + console.log(prop.AllowAddItemWhenInputing) +} +main() +``` +``` + +## 444. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 设置选项 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_Items` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_Items + +```markdown +# 设置选项 +SelectField.Items(属性) + + +## 说明 +可读写 + +设置多项式字段的可选项 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filed = await app.Sheets(1).FieldDescriptors("@状态") + const prop = await filed.Select + const Items = await prop.Items + // 加一项 + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const filed = Application.Sheets(1).FieldDescriptors("@状态") + const prop = field.Select + const Items = prop.Items + // 加一项 + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +main() +``` +``` + +## 445. 开发指南 / WPS多维表格开发 / API文档 / API / SelectField / Items + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_Items` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_Items + +```markdown +# 设置选项 +SelectField.Items(属性) + + +## 说明 +可读写 + +设置多项式字段的可选项 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filed = await app.Sheets(1).FieldDescriptors("@状态") + const prop = await filed.Select + const Items = await prop.Items + // 加一项 + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main(){ + const filed = Application.Sheets(1).FieldDescriptors("@状态") + const prop = field.Select + const Items = prop.Items + // 加一项 + Items.push({"value":"未开始233", "colorHex":"#0081C2"}) + prop.Items = Items + filed.Apply() +} +main() +``` +``` + +## 446. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_getValue + +```markdown +# 获取单选项/多选项类型值 + +## 说明 +获取 单选项字段 或者 多选项字段 类型值 + +## 返回 +1. 单选项字段类型时,返回 `string` 类型,如 '选项1' + +2. 多选项字段类型时,返回`string[]`类型,如 ['选项1', '选项2'] + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@单选项").Value + console.log(value) + // 输出值:'选项1' + const value2 = await app.Sheets(1).Views(1).RecordRange(1, "@多选项").Value + console.log(value) + // 输出值:['选项1', '选项2'] +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@单选项").Value + console.log(value) +} +main() +``` +``` + +## 447. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 单选项/多选项字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SelectField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SelectField_setValue + +```markdown +# 设置单选项/多选项类型值 + +## 说明 +设置 单选项字段 或者 多选项字段 类型值 + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置单选项 + app.Sheets(1).Views(1).RecordRange(2, "@单选项").Value = ["选项1"] + // 设置多选项 + app.Sheets(1).Views(1).RecordRange(2, "@多选项").Value = [[await Application.DBCellValue(["选项1","选项2","选项3"])]] +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置单选项 + Application.Sheets(1).Views(1).RecordRange(2, "@单选项").Value = ["选项1"] + // 设置多选项 + Application.Sheets(1).Views(1).RecordRange(2, "@多选项").Value = [[Application.DBCellValue(["选项1","选项2","选项3"])]] +} +main() +``` +``` + +## 448. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / Selection对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection + +```markdown +# Selection (对象) + +## 说明 + +- 勾选选区对象,用于选中行、列、单元格等 + +## 方法 + +|方法|说明| +|-|-| +|[IsRowSelect](/app-integration-dev/guide/dbsheet/Api/Selection_IsRowSelect)|是否选中行| +|[IsCell](/app-integration-dev/guide/dbsheet/Api/Selection_IsCell)|当前选区是否选中单元格| +|[SelectRange](/app-integration-dev/guide/dbsheet/Api/Selection_SelectRange)|设置选区| +|[SelectCell](/app-integration-dev/guide/dbsheet/Api/Selection_SelectCell)|选中单元格| +|[SelectRow](/app-integration-dev/guide/dbsheet/Api/Selection_SelectRow)|选中行| +|[SelectCol](/app-integration-dev/guide/dbsheet/Api/Selection_SelectCol)|选中列| +|[GetSelectionType](/app-integration-dev/guide/dbsheet/Api/Selection_GetSelectionType)|获取选区类型| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; +} +main() +``` + +``` + +## 449. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / GetSelectionType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_GetSelectionType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_GetSelectionType + +```markdown +# Selection.GetSelectionType(方法) + +## 说明 + +获取选区的类型 + +## 语法 + +表达式.GetSelectionType() + +表达式:Selection + +## 返回值 + +string + +可能是下列其中一个: + - Cell: 单个单元格 + - Row: 单行 + - Column: 单列 + - MultiRow: 选中多行 + - Area: 选中一个区域 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + const type = selection.GetSelectionType(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + const type = selection.GetSelectionType(); +} +main() +``` +``` + +## 450. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / IsCell + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_IsCell` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_IsCell + +```markdown +# Selection.IsCell(方法) + +## 说明 + +判断当前选区是否是单元格 + +## 语法 + +表达式.IsCell() + +表达式:Selection + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + const isCell = selection.IsCell(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + const isCell = selection.IsCell(); +} +main() +``` +``` + +## 451. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / IsRowSelect + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_IsRowSelect` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_IsRowSelect + +```markdown +# Selection.IsRowSelect(方法) + +## 说明 + +判断行是否被选中 + +## 语法 + +表达式.IsRowSelect(Index) + +表达式:Selection + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始/名称| + +## 返回值 + +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + const isSelected = selection.IsRowSelect(1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + const isSelected = selection.IsRowSelect(1); +} +main() +``` +``` + +## 452. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectCell + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectCell` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_SelectCell + +```markdown +# Selection.SelectCell(方法) + +## 说明 + +选中单元格 + +## 语法 + +表达式.SelectCell(Row, Col) + +表达式:Selection + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Row | 是 | number | 索引从 1 开始/名称,单元格的行【x 坐标】| +| Col | 是 | number | 索引从 1 开始/名称,单元格的列【y 坐标】| + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + selection.SelectCell(1, 1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + selection.SelectCell(1, 1); +} +main() +``` +``` + +## 453. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectCol + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectCol` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_SelectCol + +```markdown +# Selection.SelectCol(方法) + +## 说明 + +选中列 + +## 语法 + +表达式.SelectCol(Index) + +表达式:Selection + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始/名称,单元格的列【y 坐标】| + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + selection.SelectCol(1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + selection.SelectCol(1); +} +main() +``` +``` + +## 454. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectRange + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectRange` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_SelectRange + +```markdown +# Selection.SelectRange(方法) + +## 说明 + +选中一个区域 + +## 语法 + +表达式.SelectRange(RowFrom, RowTo, ColFrom, ColTo) + +表达式:Selection + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| RowFrom | 是 | number | 索引从 1 开始/名称,单元格的开始行| +| RowTo | 是 | number | 索引从 1 开始/名称,单元格的结束行| +| ColFrom | 是 | number | 索引从 1 开始/名称,单元格的开始列| +| ColTo | 是 | number | 索引从 1 开始/名称,单元格的结束列| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + selection.SelectRange(1, 4, 3, 6); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + selection.SelectRange(1, 4, 3, 6); +} +main() +``` +``` + +## 455. 开发指南 / WPS多维表格开发 / API文档 / API / Selection / SelectRow + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Selection_SelectRow` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Selection_SelectRow + +```markdown +# Selection.SelectRow(方法) + +## 说明 + +选中行 + +## 语法 + +表达式.SelectRow(Index) + +表达式:Selection + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number | 索引从 1 开始/名称,单元格的行【x 坐标】| + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const dbSheet = await app.ActiveDBSheet; + const selection = await dbSheet.Selection; + selection.SelectRow(1); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const selection = app.ActiveDBSheet.Selection; + selection.SelectRow(1); +} +main() +``` +``` + +## 456. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Sheet对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet + +```markdown +# Sheet 数据表操作 + + + +## 说明 + +- sheet: 泛指数据表(dbSheet)、仪表盘(dashboardSheet)、说明页面(fpSheet) + +## 方法 +|方法|说明| +|-|-| +|[AddDescription](/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription)|为当前数据表添加说明| +|[Copy](/app-integration-dev/guide/dbsheet/Api/Sheet_Copy)|创建副本| +|[CreateFields](/app-integration-dev/guide/dbsheet/Api/Sheet_CreateFields)|创建字段| +|[Delete](/app-integration-dev/guide/dbsheet/Api/Sheet_Delete)|删除当前数据表| +|[DeleteFields](/app-integration-dev/guide/dbsheet/Api/Sheet_DeleteFields)|删除指定字段信息| +|[FieldId](/app-integration-dev/guide/dbsheet/Api/Sheet_FieldId)|通过字段名称来获取字段Id| +|[GetFields](/app-integration-dev/guide/dbsheet/Api/Sheet_GetFields)|获取该数据表的所有字段信息| +|[Share](/app-integration-dev/guide/dbsheet/Api/Sheet_Share)|sheet分享| +|[UpdateFields](/app-integration-dev/guide/dbsheet/Api/Sheet_UpdateFields)|更新字段| +|[AppendFromLocal](/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromLocal)|将本地表格文件数据追加导入到当前数据表| +|[AppendFromCloud](/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromCloud)|将在线表格文件数据追加导入到当前数据表| + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[FieldDescriptors](/app-integration-dev/guide/dbsheet/Api/Sheet_FieldDescriptors)|字段描述集合|可读写| +|[Icon](/app-integration-dev/guide/dbsheet/Api/Sheet_Icon)|图标|可读写| +|[Id](/app-integration-dev/guide/dbsheet/Api/Sheet_Id)|Id|可读| +|[Name](/app-integration-dev/guide/dbsheet/Api/Sheet_Name)|名称|可读写| +|[RecordRange](/app-integration-dev/guide/dbsheet/Api/Sheet_RecordRange)|所有记录|可读| +|[Views](/app-integration-dev/guide/dbsheet/Api/Sheet_Views)|视图集合|可读| + +## 事件 +|事件|说明| +|-|-| +|[OnCreateRecord](/app-integration-dev/guide/dbsheet/Api/Sheet_OnCreateRecord)|新增 Record 时触发| +|[OnDelete](/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete)|删除 Sheet 时触发| +|[OnRename](/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename)|修改 Name 时触发| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = await app.Sheets(1); +} +main() +``` + +``` + +## 457. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AddDescription + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_AddDescription + +```markdown +# 添加说明 + +## 说明 +为当前数据表添加说明 + +## 语法 +表达式.AddDescription(Value) + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Value|是|string|待添加的说明文案| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).AddDescription('hello'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).AddDescription('hello'); +} +main() +``` +``` + +## 458. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AppendFromCloud + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromCloud` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromCloud + +```markdown +# 将在线表格文件数据追加导入到当前数据表 +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +将在线表格文件数据追加导入到当前数据表 + +## 语法 +表达式.AppendFromCloud(FileId) + +表达式: Sheet + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| FileId | 是 | string | 在线表格文件的 fileId | + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const curSheet = app.Sheets.Item(1) + try { + const isAppended = await curSheet.AppendFromCloud(fileId) + if (isAppended) { + console.log('“追加数据到数据表成功') + } + } catch (error) { + console.log('“追加数据到数据表失败', error.message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + try { + const isAppended = Application.Sheets.Item(1).AppendFromCloud(fileId) + if (isAppended) { + console.log('“追加数据到数据表成功') + } + } catch (error) { + console.log('“追加数据到数据表失败', error.message) + } +} +main() +``` +``` + +## 459. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / AppendFromLocal + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromLocal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_AppendFromLocal + +```markdown +# 将本地表格文件数据追加导入到当前数据表 +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +将本地表格文件数据追加导入到当前数据表 + +## 语法 +表达式.AppendFromLocal(File) + +表达式: Sheet + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| - | - | - | - | +| File | 是 | File | 本地表格文件对象 | + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const curSheet = app.Sheets.Item(1) + + const fileInput = document.getElementById('fileInput'); + const file = fileInput.files[0]; + if (!file) { + console.error('没有选择文件'); + return; + } + + try { + const isAppended = await curSheet.AppendFromLocal(file) + if (isAppended) { + console.log('“追加数据到数据表成功') + } + } catch (error) { + console.log('“追加数据到数据表失败', error.message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + try { + const isAppended = Application.Sheets.Item(1).AppendFromLocal(file) + if (isAppended) { + console.log('“追加数据到数据表成功') + } + } catch (error) { + console.log('“追加数据到数据表失败', error.message) + } +} +main() +``` +``` + +## 460. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Copy + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Copy + +```markdown +# 创建副本 + +## 说明 +为当前数据表创建副本 + +## 语法 +表达式.Copy(Value) + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Value|否|boolean|创建副本的方式,默认为 false。传 true 复制全部内容;传 false 仅复制空表和视图;复制的sheet为仪表盘时,此参数不传| + + +## 返回值 +Sheet + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 复制全部内容 + await app.Sheets(1).Copy(true); + // 仅复制空表和视图 + await app.Sheets(1).Copy(false); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 复制全部内容 + Application.Sheets(1).Copy(true); + // 仅复制空表和视图 + Application.Sheets(1).Copy(false); +} +main() +``` +``` + +## 461. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / CreateFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_CreateFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_CreateFields + +```markdown +# 创建字段 + + + +## 说明 + +为当前数据表创建字段 + +## 语法 + +表达式.CreateFields(Fields) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ----- | -------------- | +| Fields | 是 | Array | 创建的字段数组 | + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.ActiveSheet.CreateFields([{name:'等级',type:'Rating',max:5},{name:'富文本',type:'MultiLineText'}]) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.ActiveSheet.CreateFields([{name:'等级',type:'Rating',max:5},{name:'富文本',type:'MultiLineText'}]) +} +main() +``` +``` + +## 462. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Delete + +```markdown +# 删除数据表 + +## 说明 +删除当前数据表 + +## 语法 +表达式.Delete(HideTip) + +表达式: Sheet + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------- | -------- | ------- | ---------------------- | +| HideTip | 否 | boolean | 是否需要隐藏删除确认框 | + +## 返回值 +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).Delete(true); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).Delete(true); +} +main() +``` +``` + +## 463. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / DeleteFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_DeleteFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_DeleteFields + +```markdown +# 删除指定字段信息 + + + +## 说明 + +删除该数据表的指定 ids 的字段信息 + +## 语法 + +表达式.DeleteFields(FiledIds) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ----- | ------------------------------ | +| FiledIds | 是 | Array | 要删除的字段的 ids(字符串数组) | + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.ActiveSheet.DeleteFields(['B','C']); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.ActiveSheet.DeleteFields(['B','C']); +} +main(); +``` + +``` + +## 464. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / FieldDescriptors + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_FieldDescriptors` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_FieldDescriptors + +```markdown +# 字段描述集合 + +## 说明 +可读写 + +该表的字段描述集合 + +## 返回值 +[FieldDescriptors](/app-integration-dev/guide/dbsheet/Api/FieldDescriptors) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldDescriptors = app.Sheet(1).FieldDescriptors; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptors = Application.Sheets(1).FieldDescriptors; +} +main() +``` +``` + +## 465. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / FieldId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_FieldId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_FieldId + +```markdown +# 通过字段名称来获取字段Id + +## 说明 +通过字段名称来获取字段Id + +## 语法 +表达式: FieldId() + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Name|是|String|字段名称| + + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fieldId = await app.Sheets(1).FieldId('字段名'); +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldId = Application.Sheets(1).FieldId('字段名'); +} +main() +``` +``` + +## 466. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / GetFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_GetFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_GetFields + +```markdown +# 获取该数据表的所有字段信息 + + + +## 说明 + +获取该数据表的所有字段信息 + +## 语法 + +表达式.GetFields() + +表达式: Sheet + +## 参数 + +无参数 + +## 返回值 + +[Fields](/app-integration-dev/guide/dbsheet/Api/Fields) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fields = app.ActiveSheet.GetFields(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fields = Application.ActiveSheet.GetFields(); +} +main() +``` +``` + +## 467. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Icon + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Icon` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Icon + +```markdown +# 设置图标 + +## 说明 +可读写 + +设置图标、返回当前数据表的图标 + +## 返回值 +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = app.Sheets(1); + // read + const sheetIcon = await sheet.Icon; + // write + sheet.Icon = '📚'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1); + // read + const sheetIcon = sheet.Icon; + // write + sheet.Icon = '📚'; +} +main() +``` +``` + +## 468. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Id + +```markdown +# 返回数据表Id + +## 说明 +可读 +返回当前数据表的 Id + +## 返回值 +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheetId = await app.Sheets(1).Id; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheetId = Application.Sheets(1).Id; +} +main() +``` +``` + +## 469. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Name + +```markdown +# 重命名 + +## 说明 +可读写 + +重命名、返回当前数据表的名称 + +## 返回值 +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = app.Sheets(1); + // read + const sheetName = await sheet.Name; + // write + sheet.Name = 'newSheetName'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets(1); + // read + const sheetName = sheet.Name; + // write + sheet.Name = 'newSheetName'; +} +main() +``` +``` + +## 470. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnCreateRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnCreateRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_OnCreateRecord + +```markdown +# 监听新建行记录的事件 + + + +## 说明 + +为当前数据表添加 CreateRecord 事件,当新增 Record 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnCreateRecord(Callback) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheet.OnCreateRecord(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +RecordRange + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).OnCreateRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).Records.Add(1, undefined, 5); + //这里会执行OnCreateRecord的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).OnCreateRecord(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).RecordRange.Add(1, undefined, 5); + //这里会执行OnCreateRecord的回调 +} +main(); +``` + +``` + +## 471. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnDelete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_OnDelete + +```markdown +# 监听删除数据表的事件 + + + +## 说明 + +为当前数据表添加 Delete 事件,当删除 Sheet 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheet.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ------- | ------ | ------- | +| sheetId | Number | 表的 Id | + +## 事件返回数据示例 + +``` +{ + sheetId: 2 +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + let eventContext; + eventContext = await app.Sheets(1).OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Delete(true); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + let eventContext; + eventContext = Application.Sheets(1).OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Delete(true); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 472. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / OnRename + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_OnRename + +```markdown +# 监听重命名数据表的事件 + + + +## 说明 + +为当前数据表添加 Rename 事件,当被修改 Name 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnRename(Callback) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheet.OnRename(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ----------- | ------ | ------- | +| Sheet | Sheet | 表| +| originValue | String | 原表名 | +| value | String | 现表名 | + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const sheetName = app.Sheets(1).Name; + //这里会执行OnRename的回调 + sheetName = 'newName'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Name = 'newName'; + //这里会执行OnRename的回调 +} +main(); +``` + +``` + +## 473. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / RecordRange + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_RecordRange` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_RecordRange + +```markdown +# 数据表的所有记录 + + + +## 说明 + +可读 +该数据表的所有记录 + +## 返回值 + +RecordRange + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordRange = await app.Sheet(1).RecordRange; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).RecordRange; +} +main() +``` + +``` + +## 474. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Share + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Share` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Share + +```markdown +# sheet分享 + +## 说明 +- 当前方法暂时仅支持仪表盘sheet分享 + +## 语法 +表达式.Share() + +表达式: Sheet + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 分享仪表盘 + await app.Sheets(1).Share(); +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + // 分享仪表盘 + Application.Sheets(1).Share(); +} +main() +``` +``` + +## 475. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / UpdateFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_UpdateFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_UpdateFields + +```markdown +# 更新字段 + + + +## 说明 + +为该数据表更新字段 + +## 语法 + +表达式.UpdateFields(Fields) + +表达式: Sheet + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ----- | ---------------- | +| Fields | 是 | Array | 要更新的字段数组 | + +## 返回值 + +Fields + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).UpdateFields([{ id: 'L', name: '富文本123', type: 'MultiLineText' }]); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets(1).UpdateFields([{ id: 'L', name: '富文本123', type: 'MultiLineText' }]); +} +main() +``` + +## 476. 开发指南 / WPS多维表格开发 / API文档 / API / Sheet / Views + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheet_Views` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Views + +```markdown +# 数据表的视图集合 + + + +## 说明 + +可读 +返回当前数据表的视图集合 + +## 返回值 + +Views + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheet(1).Views; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const views = Application.Sheets(1).Views; +} +main() +``` +``` + +## 477. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Sheets对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets + +```markdown +# Sheets 数据表集合操作 + +## 说明 + +- 注意这里可以获取到三种 sheet 类型 +- sheet: 泛指数据表(dbSheet)、仪表盘(dashboardSheet)、说明页面(fpSheet) + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[Count](/app-integration-dev/guide/dbsheet/Api/Sheets_Count)|数据表个数|可读| + +## 方法 +|方法|说明| +|-|-| +|[Add](/app-integration-dev/guide/dbsheet/Api/Sheets_Add)|新建数据表| +|[Delete](/app-integration-dev/guide/dbsheet/Api/Sheets_Delete)|删除数据表| +|[Move](/app-integration-dev/guide/dbsheet/Api/Sheets_Move)|移动数据表| +|[Item](/app-integration-dev/guide/dbsheet/Api/Sheets_Item)|通过索引位置或者名称获取数据表| +|[ItemById](/app-integration-dev/guide/dbsheet/Api/Sheets_ItemById)|通过Id 获取 数据表| +|[GetActiveSheetIndex](/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetIndex)|获取当前激活数据表的索引位置| +|[GetActiveSheetId](/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetId)|获取当前激活数据表的表 Id| + +## 事件 +|事件|说明| +|-|-| +|[OnCreateSheet](/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet)|新增数据表时触发| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add({ Type: 'xlEtFlexPaperSheet' }); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets.Add({ Type: 'xlEtFlexPaperSheet' }); +} +main() +``` +``` + +## 478. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Add + +```markdown +# 新建数据表 +JSSDK: v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +新建数据表到指定位置,Before 和 After 只需要提供一个,另一个填 null 即可 + +## 语法 +表达式.Add(Before, After,Type,Config) + +表达式:Sheets + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Before|否|number/string|插入到Before(索引从1开始/数据表名)对应sheet之前| +|After|否|number/string|插入到After(索引从1开始/数据表名)对应sheet之后| +|Type|是|string|"xlEtFlexPaperSheet"(说明页面)(暂不支持)、"xlEtDataBaseSheet"(数据表)、"xlDbDashBoardSheet"(仪表盘)| +|Config|否|object|数据表专属配置,结构:Config:{ fields : Field[] , name ?: string , views ?: View[] };| +## 参数Config属性详解 +|属性名|是否必需|类型|描述| +|---|---|---|---| +|fields|否|Field[]|字段数组,Field类型结构:{fieldType: FieldType,args: { fieldName: string, fieldWidth: number, listItems?: { value: string, color: number}[], numberFormat?: string, maxRating?: number } }| +|name |否|string|数据表名,默认为‘data1’| +|views |否|View[]|视图配置数组,View结构:{name: string,type: ViewType},ViewType的取值为:'Grid'(网格视图)、'Kanban'(看板视图)、'Gallery'(相册视图)、'Form'(表单视图)、'Gantt'(甘特视图)、'Query'(查询视图)或'Calendar'(日历视图);默认创建'Grid'。暂只支持'Grid'和'Form'。| +## 返回值 +Sheet + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Add( + null,1,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + Application.Sheets.Add( + 1,null,'xlEtDataBaseSheet', + { + fields: + [ + {fieldType:'SingleLineText',args:{fieldName:'文本',fieldWidth:15}}, + {fieldType:'MultiLineText',args:{fieldName:'多行文本',fieldWidth:15}}, + {fieldType:'Date',args:{fieldName:'日期',numberFormat:'yyyy/mm/dd;@',fieldWidth:15}}, + {fieldType:'SingleSelect',args:{fieldName:'单选项',fieldWidth:15, + listItems:[{value: '选项1', color: 4283466178},{value: '选项2',color: 4281378020}]}}, + {fieldType:'Number',args:{fieldName:'数字',fieldWidth:15}}, + {fieldType:'Rating',args:{fieldName:'等级',maxRating:6,fieldWidth:15}}, + ], + name:'数据表', + views: + [ + {name:'表格视图',type:'Grid'}, + {name:'表单视图',type:'Form'} + ] + } + ) +} +main() +``` +``` + +## 479. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Delete + +```markdown +# 删除数据表 + +## 说明 +通过索引位置或数据表名来删除指定表 + +## 语法 +表达式.Delete(Index) + +表达式: Sheets + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | ---------------------- | +| Index | 是 | number/string | 索引从 1 开始/数据表名 | + +## 返回值 +Boolean + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Delete(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets.Delete(1); +} +main() +``` +``` + +## 480. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / GetActiveSheetId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetId + +```markdown +# 获取当前激活数据表的表 Id + +## 说明 +获取当前激活数据表的表 Id + +## 语法 +表达式: GetActiveSheetId() + +表达式: Sheets + +## 参数 +无参数 + +## 返回值 +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheetId = await app.Sheets.GetActiveSheetId(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheetId = Application.Sheets.GetActiveSheetId(); +} +main() +``` +``` + +## 481. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / GetActiveSheetIndex + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetIndex` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_GetActiveSheetIndex + +```markdown +# 获取当前激活数据表的索引 + +## 说明 +获取当前激活数据表的索引位置 + +## 语法 +表达式.GetActiveSheetIndex() + +表达式: Sheets + +## 参数 +无参数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheetIndex = await app.Sheets.GetActiveSheetIndex(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheetIndex = Application.Sheets.GetActiveSheetIndex(); +} +main() +``` +``` + +## 482. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Item + +```markdown +# 通过索引位置获取 Sheet + +JSSDK: v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 + +通过索引位置或者名称获取 Sheet + +## 语法 + +表达式.Item(Index) + +表达式:Sheets + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Index | 是 | number/string | 索引从 1 开始/名称| + +## 返回值 + +Sheet + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets.Item(1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets.Item(1); +} +main() +``` +``` + +## 483. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / ItemById + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_ItemById` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_ItemById + +```markdown +# 通过Id 获取数据表 + +JSSDK: v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 + +通过Id 获取 Sheet + +## 语法 + +表达式.ItemById(Id) + +表达式:Sheets + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------ | ------------- | +| Id | 是 | number/string | 表格Id | + +## 返回值 + +Sheet + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sheet = await app.Sheets.ItemById(1) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sheet = Application.Sheets.ItemById(1); +} +main() +``` +``` + +## 484. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / Move + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_Move` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Move + +```markdown +# 移动数据表 + +## 说明 +移动数据表到指定位置,Before 和 After 只需要提供一个,另一个填 null 即可 + +## 语法 +表达式.Move(From, Before, After) + +表达式: Sheets + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | ---------------------------------------------------- | +| From | 是 | number/string | 待移动 sheet 的名称或索引号,从 1 开始 | +| Before | 是 | number/string | 移动到 Before(索引从 1 开始/数据表名)对应 sheet 之前 | +| After | 是 | number/string | 移动到 After(索引从 1 开始/数据表名)对应 sheet 之后 | + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets.Move(111111, null, 22222); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + Application.Sheets.Move(111111, null, 22222); +} +main() +``` +``` + +## 485. 开发指南 / WPS多维表格开发 / API文档 / API / Sheets / OnCreateSheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_OnCreateSheet + +```markdown +# 监听增加数据表的事件 + + + +## 说明 + +为当前数据表集合添加 CreateSheet 事件(当前只支持添加数据表事件,添加说明页和仪表盘不会触发该事件,后续版本更新后支持),当新增 sheet 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式: OnCreateSheet(Callback) + +表达式: Sheets + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Sheets.OnCreateSheet(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| --------- | ------ | -------------- | +| Sheet | Sheet | 表 | + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets.OnCreateSheet(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + await app.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + //这里会执行OnCreateSheet的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets.OnCreateSheet(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets.Add({ Type: 'xlEtDataBaseSheet' }); + //这里会执行OnCreateSheet的回调 +} +main(); +``` + +``` + +## 486. 开发指南 / WPS多维表格开发 / API文档 / API / Sort / Sort对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sort` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sort + +```markdown +# Sort (对象) + + +## 说明 +单条排序记录 + +## 方法 +- [Delete](/app-integration-dev/guide/dbsheet/Api/Sort_Delete) + +## 属性 +- [IsAscending](/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending) +- [Field](/app-integration-dev/guide/dbsheet/Api/Sort_Field) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const sort = await sorts(1); + sort.Delete() + //const sort = sorts('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const sort = sorts(1); + sort.Delete() + //const sort = sorts('B'); +} +main() +``` +``` + +## 487. 开发指南 / WPS多维表格开发 / API文档 / API / Sort / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sort_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sort_Delete + +```markdown +# 删除排序条件 +Sort.Remove(方法) + +## 说明 +删除单个排序条件 + +## 语法 +表达式.Delete() + +表达式:Sort + +## 参数 +无参数 + +## 返回值 +[ApiResult](/app-integration-dev/guide/dbsheet/Api/ApiResult) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const res = await sorts(1).Delete(); + if (res.Code === 0) { + console.log("成功删除") + } else { + console.error("删除错误" + res.Message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const res = sorts(1).Delete(); + if (res.Code === 0) { + console.log("成功删除") + } else { + console.error("删除错误" + res.Message) + } +} +main() +``` +``` + +## 488. 开发指南 / WPS多维表格开发 / API文档 / API / Sort / Field + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sort_Field` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sort_Field + +```markdown +# Sort.Field(属性) + + +## 说明 +可读写 + +排序字段 + +## 返回值 +Field + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const field = sorts(1).Field; + + // 设置排序条件字段 + sorts(1).Field = '@数字'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const field = sorts(1).Field; + + // 设置排序条件字段 + sorts(1).Field = '@数字'; +} +main() +``` +``` + +## 489. 开发指南 / WPS多维表格开发 / API文档 / API / Sort / IsAscending + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sort_IsAscending + +```markdown +# 设置排序升序属性 +Sort.IsAscending(属性) + + +## 说明 +可读写 + +设置排序升序或者降序 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +// 获取IsAscending属性 +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const isAscending = sorts(1).IsAscending; +} + +// 设置IsAscending属性 +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(1).Sorts(1).IsAscending = false; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const isAscending = sorts(1).IsAscending; + isAscending = false; +} +main() +``` +``` + +## 490. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Sorts对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts + +```markdown +# Sorts (对象) + + +## 说明 +当前视图下的排序列表 + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/Sorts_Item) +- [Add](/app-integration-dev/guide/dbsheet/Api/Sorts_Add) + +## 属性 +- [Count](/app-integration-dev/guide/dbsheet/Api/Sorts_Count) +- [IsAuto](/app-integration-dev/guide/dbsheet/Api/Sorts_IsAuto) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + console.log(await sorts.Count) +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + console.log(sorts.Count) +} +main() +``` +``` + +## 491. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_Add + +```markdown +# 添加排序条件 +Sorts.Add(方法) + +## 说明 +添加排序 + +## 语法 +表达式.Add(Field,IsAscending) + +表达式: Sorts + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ----------- | -------- | ------------- | ------------------------------------ | +| Field | 是 | number/string | 新增排序字段索引/新增排序字段 ID/新增排序字段名(名称要以@字符作为开始) | +| IsAscending | 否 | boolean | 是否为升序 | + +## 返回值 +Sort + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const res = sorts.Add(1); + //const res = sorts.Add('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const res = sorts.Add(1); + //const res = sorts.Add('B'); +} +main() +``` +``` + +## 492. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / ChangeOrder + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_ChangeOrder + +```markdown +# 移动排序条件 + +Sorts.ChangeOrder(方法) + +## 说明 +移动排序条件(设置排序优先级) + +## 语法 +表达式.ChangeOrder(FromField, BeforeField, AfterField) + +表达式: Sorts + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ----------------- | --------------------------------- | +| FromField | 是 | [string] | 要移动的排序字段的字段ID/要移动的排序字段的字段名称(名称要以@字符作为开始) | +| BeforeField | 否 | [string] | 目标位置前的排序字段ID/目标位置前的排序字段名称(名称要以@字符作为开始) | +| AfterField | 否 | [string] | 目标位置后的排序字段ID/目标位置后的排序字段名称(名称要以@字符作为开始) | + +FromField、BeforeField和AfterField必须都是已设置的排序条件字段,BeforeField和AfterField至少需要传入一个,如果BeforeField和AfterField同时存在以BeforeField作为应用参数 + +比如表格视图中已设置的排序条件在排序面板中从上到下依次为【公式,日期,名称,数量】 +现在想将名称这条排序条件移动到日期的前面,结果变为【公式,名称,日期,数量】,就可以用以下方式实现 +``` +await WPSOpenApi.Application.Sheets(1).Views(1).Sorts.ChangeOrder('@名称', '@日期') +``` +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + // 将公式排序条件移动到日期排序条件的后面 + const res = await sorts.ChangeOrder('@公式', undefined, '@日期'); + if (res.Code === 0) { + console.log("设置排序优先级成功") + } else { + console.error("设置排序优先级失败" + res.Message) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + // 将公式排序条件移动到日期排序条件的后面 + const res = sorts.ChangeOrder('@公式', undefined, '@日期'); + if (res.Code === 0) { + console.log("设置排序优先级成功") + } else { + console.error("设置排序优先级失败" + res.Message) + } +} +main() +``` +``` + +## 493. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_Count + +```markdown +# Sorts.Count(属性) + + +## 说明 +可读 +返回排序列表的个数 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const count = sorts.Count; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const count = sorts.Count; +} +main() +``` +``` + +## 494. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / IsAuto + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_IsAuto` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_IsAuto + +```markdown +# Sorts.IsAuto(属性) + + +## 说明 +可读写 + +自动排序属性 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +// 获取自动排序属性 +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const isAuto = sorts.IsAuto; +} + +// 设置自动排序属性 +async function example() { + await instance.ready(); + const app = instance.Application; + app.Sheets(1).Views(1).Sorts.isAuto = false; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const isAuto = sorts.IsAuto; + isAuto = false; +} +main() +``` +``` + +## 495. 开发指南 / WPS多维表格开发 / API文档 / API / Sorts / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Sorts_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sorts_Item + +```markdown +# Sorts.Item(方法) + +## 说明 + +通过索引位置或者字段 ID 获取单条排序记录 + +## 语法 +表达式.Item(Index) + +表达式:Sorts + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | --------------------- | +| Index | 是 | number/string | 索引从 1 开始/字段 ID | + +## 返回值 +Sort + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; + const sort = sorts.Item(1); + //const sort = sorts.Item('B'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; + const sort = sorts.Item(1); + //const sort = sorts.Item('B'); +} +main() +``` +``` + +## 496. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / SummarySheet对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySheet + +```markdown +# SummarySheet (对象) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +SummarySheet 合并表对象,用于操作合并表 + +## 方法 +* [RefreshSyncSheet](/app-integration-dev/guide/dbsheet/Api/SummarySheet_RefreshSyncSheet) +* [RemoveSheetSyncLink](/app-integration-dev/guide/dbsheet/Api/SummarySheet_RemoveSheetSyncLink) + +## 属性 +* [SourceConfigs](/app-integration-dev/guide/dbsheet/Api/SummarySheet_SourceConfigs) + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 先切到合并表,然后获取合并表实例 + const summarySheet = await app.ActiveSheet + const configs = await summarySheet.SourceConfigs + console.log(await configs.Item(1).FileId) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 先切到合并表,然后获取合并表 + const summarySheet = Application.ActiveSheet + const configs = summarySheet.SourceConfigs + console.log(configs.Item(1).FileId) +} +main() +``` +``` + +## 497. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / RefreshSyncSheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_RefreshSyncSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySheet_RefreshSyncSheet + +```markdown +# SummarySheet.RefreshSyncSheet(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +刷新数据 + +## 语法 +表达式.RefreshSyncSheet() + +表达式:SummarySheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个合并表,获取该合并表的实例对象 + const summarySheet = await app.ActiveSheet + await summarySheet.RefreshSyncSheet() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个合并表,获取该合并表的实例对象 + const summarySheet = Application.ActiveSheet + summarySheet.RefreshSyncSheet() +} +main() +``` +``` + +## 498. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / RemoveSheetSyncLink + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_RemoveSheetSyncLink` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySheet_RemoveSheetSyncLink + +```markdown +# SummarySheet.RemoveSheetSyncLink(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +解除同步关系 + +## 语法 +表达式.RemoveSheetSyncLink() + +表达式:SummarySheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个合并表,获取该合并表的实例对象 + const summarySheet = await app.ActiveSheet + await summarySheet.RemoveSheetSyncLink() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个合并表,获取该合并表的实例对象 + const summarySheet = Application.ActiveSheet + summarySheet.RemoveSheetSyncLink() +} +main() +``` +``` + +## 499. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySheet / SourceConfigs + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySheet_SourceConfigs` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySheet_SourceConfigs + +```markdown +# SummarySheet.SourceConfigs(属性) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +只读 +合并表的数据源配置对象 + +## 返回值 +SummarySourceConfigs + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 先切到合并表,然后获取合并表配置 + const configs = await app.ActiveSheet.SourceConfigs + console.log(await configs.Item(1).FileId) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 先切到合并表,然后获取合并表配置 + const configs = Application.ActiveSheet.SourceConfigs + console.log(configs.Item(1).FileId) +} +main() +``` +``` + +## 500. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SummarySourceConfig对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig + +```markdown +# SummarySourceConfig (对象) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +合并表数据源对象中的某个源文件配置对象,数据源对象是由多个文件配置组成的一个数组。 +每个源文件配置对象都包含了两个属性,文件id:FileId,文件中选中的数据表id数组:SheetIds + +## 方法 +* [SetUrl](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetUrl) +* [SetSheets](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetSheets) + + +## 属性 +* [FileId](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_FileId) +* [SheetIds](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SheetIds) + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 先切到合并表,然后获取合并表配置 + const config = await app.ActiveSheet.SourceConfigs.Item(1) + // 返回配置文件的id + console.log(await config.FileId) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 先切到合并表,然后获取合并表配置 + const config = Application.ActiveSheet.SourceConfigs.Item(1) + // 返回配置文件的id + console.log(config.FileId) +} +main() +``` +``` + +## 501. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / FileId + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_FileId` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_FileId + +```markdown +# SummarySourceConfig.FileId(属性) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +可读写 +合并表中某个源文件配置对象的文件id。注意:修改后,该对象中对应的SheetIds会自动重置为空数组。(只是编辑的本地对象,需要调SummarySourceConfigs对象中的Apply方法才能更新到云上) + +## 返回值 +String + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Item(1) + console.log(await config.FileId) + config.FileId = '100139340929' + console.log(await config.FileId) + config.SheetIds = [1, 3] + // 将改动后的配置更新到云上 + await configs.Apply() + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Item(1) + console.log(config.FileId) + config.FileId = '100139340929' + console.log(config.FileId) + config.SheetIds = [1, 3] + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 502. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SetSheets + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetSheets` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetSheets + +```markdown +# SummarySourceConfig.SetSheets(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +通过一组数据表名或索引,来修改合并表源文件配置对象中的SheetIds属性(只是编辑的本地对象,需要调SummarySourceConfigs对象中的Apply方法才能更新到云上) + +## 语法 +表达式.SetSheets(Sheets) + +表达式:SummarySourceConfig + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Sheets|是|Number/String[]|数据表名或索引组成的数组| + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Item(1) + console.log(await config.SheetIds) + await config.SetSheets([1, '数据表(2)']) + console.log(await config.SheetIds) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Item(1) + console.log(config.SheetIds) + config.SetSheets([1, '数据表(2)']) + console.log(config.SheetIds) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 503. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SetUrl + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetUrl` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SetUrl + +```markdown +# SummarySourceConfig.SetUrl(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +通过url修改合并表源文件配置对象中的FileId属性(只是编辑的本地对象,需要调SummarySourceConfigs对象中的Apply方法才能更新到云上) + +## 语法 +表达式.SetUrl(Url) + +表达式:SummarySourceConfig + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Url|是|String|文件url| + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Item(1) + console.log(await config.FileId) + await config.SetUrl("https://www.kdocs.cn/l/ccSvj0b4dC7u?R=L1MvMTI=") + console.log(await config.FileId) + await config.SetSheets([1, 2]) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Item(1) + console.log(config.FileId) + config.SetUrl("https://www.kdocs.cn/l/ccSvj0b4dC7u?R=L1MvMTI=") + console.log(config.FileId) + config.SetSheets([1, 2]) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 504. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfig / SheetIds + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SheetIds` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfig_SheetIds + +```markdown +# SummarySourceConfig.SheetIds(属性) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +可读写 +合并表中某个源文件配置对象的选中数据表的id数组。(只是编辑的本地对象,需要调SummarySourceConfigs对象中的Apply方法才能更新到云上) + +## 返回值 +Number[] + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Item(1) + console.log(await config.SheetIds) + config.SheetIds = [1, 3] + console.log(await config.SheetIds) + // 将改动后的配置更新到云上 + await configs.Apply() + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Item(1) + console.log(config.SheetIds) + config.SheetIds = [1, 3] + console.log(config.SheetIds) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 505. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / SummarySourceConfigs对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs + +```markdown +# SummarySourceConfigs (对象) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +合并表的数据源配置对象 + +## 方法 +* [Item](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Item) +* [Add](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add) +* [Delete](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete) +* [Apply](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Apply) + + +## 属性 +* [Count](/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Count) + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 先切到合并表,然后获取合并表配置 + const configs = await app.ActiveSheet.SourceConfigs + console.log(await configs.Item(1).FileId) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 先切到合并表,然后获取合并表配置 + const configs = Application.ActiveSheet.SourceConfigs + console.log(configs.Item(1).FileId) +} +main() +``` +``` + +## 506. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Add + +```markdown +# 添加数据源 +SummarySourceConfigs.Add(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +合并表配置对象中添加数据源(只是编辑的本地对象,需要调Apply方法才能更新到云上) + +## 语法 +表达式.Add(File,Sheets) + +表达式:SummarySourceConfigs + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|File|是|String|文件id/文件url| +|Sheets|是|Number/String[]|数据表数组,支持两种形式,表名和索引(从1开始)| + + +## 返回值 +SummarySourceConfig + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + const config = await configs.Add("100136699885", [1, 2]) + // 返回配置文件的id + console.log(await config.FileId) + // 返回文件下选中的数据表id数组 + console.log(await config.SheetIds) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + const config = configs.Add("100136699885", [1, 2]) + // 返回配置文件的id + console.log(config.FileId) + // 返回文件下选中的数据表id数组 + console.log(config.SheetIds) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 507. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Apply + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Apply` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Apply + +```markdown +# SummarySourceConfigs.Apply(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +更新本地的数据源配置到云上 + +## 语法 +表达式.Apply() + +表达式:SummarySourceConfigs + +## 参数 +无参数 + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + await configs.Add("100136699885", [1, 2]) + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + configs.Add("100136699885", [1, 2]) + configs.Apply() +} +main() +``` +``` + +## 508. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Count + +```markdown +# SummarySourceConfigs.Count(属性) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +只读 +合并表数据源配置中,包含的源文件的数量 + +## 返回值 +Number + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + console.log(await configs.Count) + // 向配置中新加一个源文件配置 + await configs.Add("100136699885", [1, 2]) + console.log(await configs.Count) + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + console.log(configs.Count) + // 向配置中新加一个源文件配置 + configs.Add("100136699885", [1, 2]) + console.log(configs.Count) +} +main() +``` +``` + +## 509. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Delete + +```markdown +# 删除数据源 +SummarySourceConfigs.Delete(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +合并表配置对象中删除数据源(只是编辑的本地对象,需要调Apply方法才能更新到云上) + +## 语法 +表达式.Delete(Index) + +表达式:SummarySourceConfigs + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|Number/String|支持索引、文件id和文件url| + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const configs = await app.ActiveSheet.SourceConfigs + await configs.Delete(1) + // 将改动后的配置更新到云上 + await configs.Apply() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const configs = Application.ActiveSheet.SourceConfigs + configs.Delete(1) + // 将改动后的配置更新到云上 + configs.Apply() +} +main() +``` +``` + +## 510. 开发指南 / WPS多维表格开发 / API文档 / API / SummarySourceConfigs / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SummarySourceConfigs_Item + +```markdown +# SummarySourceConfigs.Item(方法) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 +## 说明 +获取指定索引的源文件配置 + +## 语法 +表达式.Item(Index) + +表达式:SummarySourceConfigs + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|是|number/string|索引从1开始/文件id| + + +## 返回值 +SummarySourceConfig + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const config = await app.ActiveSheet.SourceConfigs.Item(1) + // 返回配置文件的id + console.log(await config.FileId) + // 返回文件下选中的数据表id数组 + console.log(await config.SheetIds) +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + const config = Application.ActiveSheet.SourceConfigs.Item(1) + // 返回配置文件的id + console.log(config.FileId) + // 返回文件下选中的数据表id数组 + console.log(config.SheetIds) +} +main() +``` +``` + +## 511. 开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / SyncDBSheet对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SyncDBSheet + +```markdown +# SyncDBSheet (对象) +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +所有同步表的基类,包含同步表共有的操作:刷新同步表和解除同步关系 + +## 方法 +* [RefreshSyncSheet](/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet) +* [RemoveSheetSyncLink](/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink) + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = await app.ActiveSheet + await syncSheet.RefreshSyncSheet() + } +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = Application.ActiveSheet + syncSheet.RefreshSyncSheet() +} +main() +``` +``` + +## 512. 开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / RefreshSyncSheet + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RefreshSyncSheet + +```markdown +# 刷新数据 +SyncDBSheet.RefreshSyncSheet(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +刷新数据 + +## 语法 +表达式.RefreshSyncSheet() + +表达式:SyncDBSheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = await app.ActiveSheet + await syncSheet.RefreshSyncSheet() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = Application.ActiveSheet + syncSheet.RefreshSyncSheet() +} +main() +``` +``` + +## 513. 开发指南 / WPS多维表格开发 / API文档 / API / SyncDBSheet / RemoveSheetSyncLink + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/SyncDBSheet_RemoveSheetSyncLink + +```markdown +# 解除同步关系 +SyncDBSheet.RemoveSheetSyncLink(方法) + +JSSDK v1.1.10+、WebOffice v2.4.1+ 支持 + +## 说明 +解除同步关系 + +## 语法 +表达式.RemoveSheetSyncLink() + +表达式:SyncDBSheet + +## 参数 +无参数 + + +## 返回值 +Boolean + +## jsAPI示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = await app.ActiveSheet + await syncSheet.RemoveSheetSyncLink() +} +``` +## 脚本编辑器示例 +``` javascript +function main() { + // 切到某个同步表,获取该同步表的实例对象 + const syncSheet = Application.ActiveSheet + syncSheet.RemoveSheetSyncLink() +} +main() +``` +``` + +## 514. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / TextLinkRun对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRun + +```markdown +# TextLinkRun (对象) + +## 说明 +TextLinkRun代表文本链接的对象。 + +## 方法 + +## 属性 +- [Address](/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Address) +- [Pos](/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Pos) +- [Length](/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Length) +- [LinkRunsType](/app-integration-dev/guide/dbsheet/Api/TextLinkRun_LinkRunsType) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Address) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + console.log(textLinkRuns.Count) + } +} +main() +``` +``` + +## 515. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Address + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Address` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Address + +```markdown +# TextLinkRun.Address(属性) + + +## 说明 +只读 +返回文本链接的地址 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Address) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + const linkCount = textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = textLinkRuns.Item(j) + console.log(textLinkRun.Address) + } + } +} +main() +``` +``` + +## 516. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Length + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Length` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Length + +```markdown +# TextLinkRun.Length(属性) + + +## 说明 +只读 +返回的文本链接的长度 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Length) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + const linkCount = textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = textLinkRuns.Item(j) + console.log(textLinkRun.Length) + } + } +} +main() +``` +``` + +## 517. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / LinkRunsType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_LinkRunsType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRun_LinkRunsType + +```markdown +# TextLinkRun.LinkRunsType(属性) + + +## 说明 +只读 +返回文本链接的类型 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.LinkRunsType) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + const linkCount = textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = textLinkRuns.Item(j) + console.log(textLinkRun.LinkRunsType) + } + } +} +main() +``` +``` + +## 518. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRun / Pos + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Pos` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRun_Pos + +```markdown +# TextLinkRun.Pos(属性) + + +## 说明 +只读 +返回链接的开始位置,以字符为单位。 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Pos) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + const linkCount = textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = textLinkRuns.Item(j) + console.log(textLinkRun.Pos) + } + } +} +main() +``` +``` + +## 519. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / TextLinkRuns对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRuns + +```markdown +# TextLinkRuns (对象) + +## 说明 +TextLinkRuns 对象代表文本链接的集合。 + +## 方法 +- [Item](/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Item) + +## 属性 +- [Count](/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Count) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Address) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + console.log(textLinkRuns.Count) + } +} +main() +``` +``` + +## 520. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Count + +```markdown +# TextLinkRuns.Count(属性) + + +## 说明 +只读 +返回的记录里包含TextLinkRun的数量 + +## 返回值 +Number + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments.Item(1) + recordComment.Add("Hello World") + const count = await recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + const textLinkRuns = await comment.TextLinkRuns + const linkCount = await textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = await textLinkRuns.Item(j) + console.log(await textLinkRun.Address) + } + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments.Item(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + const textLinkRuns = comment.TextLinkRuns + const linkCount = textLinkRuns.Count + for (let j = 1; j <= linkCount; j++) { + const textLinkRun = textLinkRuns.Item(j) + console.log(textLinkRun.Address) + } + } +} +main() +``` +``` + +## 521. 开发指南 / WPS多维表格开发 / API文档 / API / TextLinkRuns / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/TextLinkRuns_Item + +```markdown +# TextLinkRuns.Item(方法) + +## 说明 +获取指定索引位置或评论ID的记录 + +## 语法 +表达式.Item(Index) + +表达式:TextLinkRuns + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Index|否|number|传入number时索引从1开始| + +## 返回值 +[TextLinkRun](/app-integration-dev/guide/dbsheet/Api/TextLinkRun) + +## jsApi 示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const recordComment = await app.ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = await recordComment.Item(i) + console.log(await comment.Text) + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordComment = ActiveView.RecordComments(1) + const count = recordComment.Count + for (let i = 1; i <= count; i++) { + const comment = recordComment.Item(i) + console.log(comment.Text) + } +} +main()``` + +``` + +## 522. 开发指南 / WPS多维表格开发 / API文档 / API / UrlField / UrlField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/UrlField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/UrlField + +```markdown +# UrlField (对象) + + +## 说明 +UrlField 超链接字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非超链接字段,无法设置相关属性 + +## 属性 +- [HyperLinkText](/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@超链接") + const prop = await field.Url + prop.HyperLinkText = "Go" + field.Apply() + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@超链接") + const prop = field.Url + prop.HyperLinkText = "Go" + field.Apply() + } +main() +``` +``` + +## 523. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 设置显示样式 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText + +```markdown +# 设置显示样式 +UrlField.HyperLinkText(属性) + + +## 说明 +可读写 + +只对超链接字段有效,超链接字段设置显示的文本,如果设置了 HyperLinkText ,超链接字段显示样式就会以按钮形式显示 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@超链接") + const prop = await field.Url + // 以按钮形式显示 "Go" + prop.HyperLinkText = "Go" + field.Apply() + + // 以超链接形式显示 + prop.HyperLinkText = "" + field.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@超链接") + const prop = field.Url + // 以按钮形式显示 "Go" + prop.HyperLinkText = "Go" + field.Apply() + + // 以超链接形式显示 + prop.HyperLinkText = "" + field.Apply() +} +main() +``` +``` + +## 524. 开发指南 / WPS多维表格开发 / API文档 / API / UrlField / HyperLinkText + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/UrlField_HyperLinkText + +```markdown +# 设置显示样式 +UrlField.HyperLinkText(属性) + + +## 说明 +可读写 + +只对超链接字段有效,超链接字段设置显示的文本,如果设置了 HyperLinkText ,超链接字段显示样式就会以按钮形式显示 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const field = await app.Sheets(1).FieldDescriptors("@超链接") + const prop = await field.Url + // 以按钮形式显示 "Go" + prop.HyperLinkText = "Go" + field.Apply() + + // 以超链接形式显示 + prop.HyperLinkText = "" + field.Apply() +} +``` + +## 脚本编辑器 示例 +``` javascript +function main() { + const field = Application.Sheets(1).FieldDescriptors("@超链接") + const prop = field.Url + // 以按钮形式显示 "Go" + prop.HyperLinkText = "Go" + field.Apply() + + // 以超链接形式显示 + prop.HyperLinkText = "" + field.Apply() +} +main() +``` +``` + +## 525. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 获取字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_getValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/UrlField_getValue + +```markdown +# 获取超链接字段类型值 + +## 说明 +获取 超链接字段 类型值 + +## 返回 + +`object` 结构,结构如下: + +### object结构 +|key|值类型|说明| +|---|---|---| +|address|string|超链接地址| +|display|string|展示的文案| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const value = await app.Sheets(1).Views(1).RecordRange(1, "@超链接").Value + console.log(value) + /** + * 输出值: + * { + * address: "https://365.kdocs.cn/", + * display: "跳转文档" + * } + */ +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const value = Application.Sheets(1).Views(1).RecordRange(1, "@超链接").Value + console.log(value) +} +main() +``` +``` + +## 526. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 超链接字段 / 设置字段值 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/UrlField_setValue` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/UrlField_setValue + +```markdown +# 设置超链接类型值 + +## 说明 +设置 超链接字段 类型值 + +## 语法 +``` +DBCellValue([{ + address: "", + display: "", +}]) +``` + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|address|是|string|超链接地址| +|display|是|string|展示的文案| + + +## 返回值 + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + // 设置超链接 + app.Sheets(1).Views(1).RecordRange(2, "@超链接").Value = await Application.DBCellValue({ + address:"wps.cn", + display:"wps" + }) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + // 设置超链接 + Application.Sheets(1).Views(1).RecordRange(2, "@超链接").Value = Application.DBCellValue({ + address:"wps.cn", + display:"wps" + }) +} +main() +``` +``` + +## 527. 开发指南 / WPS多维表格开发 / API文档 / API / View / View对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View + +```markdown +# View (对象) + + +## 说明 +视图 + +## 方法 +|方法|说明| +|-|-| +|[Activate](/app-integration-dev/guide/dbsheet/Api/View_Activate)|激活该视图| +|[Copy](/app-integration-dev/guide/dbsheet/Api/View_Copy)|复制视图| +|[Delete](/app-integration-dev/guide/dbsheet/Api/View_Delete)|删除视图| + + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[Description](/app-integration-dev/guide/dbsheet/Api/View_Description)|视图说明|| +|[IsFavView](/app-integration-dev/guide/dbsheet/Api/View_IsFavView)|快速访问视图|| +|[Fields](/app-integration-dev/guide/dbsheet/Api/View_Fields)|获取当前视图下的字段列表|可读| +|[Filters](/app-integration-dev/guide/dbsheet/Api/View_Filters)|获取当前视图下的筛选器|可读| +|[Groups](/app-integration-dev/guide/dbsheet/Api/View_Groups)|获取指定视图下面的分组列表|可读| +|[Id](/app-integration-dev/guide/dbsheet/Api/View_Id)|视图Id|| +|[Name](/app-integration-dev/guide/dbsheet/Api/View_Name)|视图名称|| +|[IsPersonal](/app-integration-dev/guide/dbsheet/Api/View_IsPersonal)|是否公共视图|| +|[RecordRange](/app-integration-dev/guide/dbsheet/Api/View_RecordRange)|视图的RecordRange|| +|[Records](/app-integration-dev/guide/dbsheet/Api/View_Records)|视图的Records|| +|[Selection](/app-integration-dev/guide/dbsheet/Api/View_Selection)|该视图的选中的RecordRange|| +|[Sorts](/app-integration-dev/guide/dbsheet/Api/View_Sorts)|获取或设置当前视图下的排序条件列表|可读写| +|[ViewShare](/app-integration-dev/guide/dbsheet/Api/View_ViewShare)|该视图的视图分享|| + +## 事件 +|事件|说明| +|-|-| +|[OnDelete](/app-integration-dev/guide/dbsheet/Api/View_OnDelete)|| +|[OnRename](/app-integration-dev/guide/dbsheet/Api/View_OnRename)|| + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); +} +main() +``` +``` + +## 528. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ViewShare对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare + +```markdown +# ViewShare (对象) + + +## 说明 +单个视图的分享视图相关 + +## 方法 +|属性|说明| +|-|-| +|[SetEnable](/app-integration-dev/guide/dbsheet/Api/ViewShare_SetEnable)|切换当前视图的分享视图开关| +|[ChangePermission](/app-integration-dev/guide/dbsheet/Api/ViewShare_ChangePermission)|修改分享视图的权限| + + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[CanAddRemoveRecords](/app-integration-dev/guide/dbsheet/Api/ViewShare_CanAddRemoveRecords)|返回当前分享视图高级权限中,是否允许添加记录|可读写| +|[VisibleRecType](/app-integration-dev/guide/dbsheet/Api/ViewShare_VisibleRecType)|单个视图的分享视图相关|| +|[EditableRecType](/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableRecType)|返回当前分享视图高级权限中,可编辑的记录范围|可读| +|[SharedLinkInfo](/app-integration-dev/guide/dbsheet/Api/ViewShare_SharedLinkInfo)|返回当前分享视图的信息|可读| +|[ShareUrl](/app-integration-dev/guide/dbsheet/Api/ViewShare_ShareUrl)|返回当前分享视图的分享链接|可读| +|[EditableFieldsInfo](/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableFieldsInfo)|返回当前分享视图高级权限中,允许编辑的字段id|可读写| + + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare; + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; +} +main() +``` +``` + +## 529. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / CanAddRemoveRecords + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_CanAddRemoveRecords` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_CanAddRemoveRecords + +```markdown +# ViewShare.CanAddRecords(属性) + + +## 说明 +可读写 +返回当前分享视图高级权限中,是否允许添加记录 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare + // read + const canAddRecords = await viewShare.CanAddRemoveRecords; + // write + viewShare.CanAddRemoveRecords = true; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare + // read + const canAddRecords = viewShare.CanAddRemoveRecords; + // write + viewShare.CanAddRemoveRecords = true; +} +main() +``` +``` + +## 530. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ChangePermission + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_ChangePermission` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_ChangePermission + +```markdown +# ViewShare.ChangePermission(方法) + +## 说明 +修改分享视图的权限 + +## 语法 +表达式.ChangePermission(RangeType, PermissionType) + +表达式: ViewShare + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|RangeType|是|[SharedLinkToType](/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkToType)|分享的协作者范围| +|PermissionType|是|[SharedLinkPermissionType](/app-integration-dev/guide/dbsheet/Api/Enum_SharedLinkPermissionType)|分享的协作者权限| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare; + const res = viewShare.ChangePermission('assigned', 'edit') +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; + const res = viewShare.ChangePermission('assigned', 'edit') +} +main() +``` +``` + +## 531. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / EditableFieldsInfo + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableFieldsInfo` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableFieldsInfo + +```markdown +# ViewShare.EditableFieldIds(属性) + + +## 说明 +可读写 +返回当前分享视图高级权限中,允许编辑的字段id + +## 返回值 +Object + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const view = instance.Application.Sheets(1).Views(1); + const viewShare = view.ViewShare + + // read + const editableFieldsInfo = await viewShare.EditableFieldsInfo; + + // write + // 所有字段可编辑 + viewShare.EditableFieldsInfo = {type: 'All'} + + // 当前视图中索引为1的字段,在分享视图中可编辑 + const fields = view.Fields; + const fieldId = await fields(1).Id + viewShare.EditableFieldsInfo = { + type: 'Custom', + ids: [fieldId] + } +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const viewShare = view.ViewShare + + // read + const editableFieldsInfo = viewShare.EditableFieldsInfo; + + // write + // 所有字段可编辑 + viewShare.EditableFieldsInfo = {type: 'All'} + + // 当前视图中索引为1的字段,在分享视图中可编辑 + const fields = view.Fields; + const fieldId = fields(1).Id + viewShare.EditableFieldsInfo = { + type: 'Custom', + ids: [fieldId] + } +} +main() +``` +``` + +## 532. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / EditableRecType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableRecType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_EditableRecType + +```markdown +# ViewShare.EditableRecType(属性) + + + +## 说明 + +可读 +返回当前分享视图高级权限中,可编辑的记录范围 + +## 返回值 + +[DbSharedCriteriaType](/app-integration-dev/guide/dbsheet/Api/Enum_DbSharedCriteriaType) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare; + // read + const visible = await viewShare.EditableRecType; + // write + viewShare.EditableRecType = 'Self'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; + // read + const visible = viewShare.EditableRecType; + // write + viewShare.EditableRecType = 'Self'; +} +main(); +``` + +``` + +## 533. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / SetEnable + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_SetEnable` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_SetEnable + +```markdown +# ViewShare.SetEnable(方法) + +## 说明 +切换当前视图的分享视图开关 + +## 语法 +表达式.SetEnable(Enable) + +表达式: ViewShare + +## 参数 +|参数名|是否必需|类型|描述| +|---|---|---|---| +|Enable|是|boolean|切换分享视图的开关,true就是开,false就是关| + + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare; + const res = viewShare.SetEnable(true) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; + const res = viewShare.SetEnable(true) +} +main() +``` +``` + +## 534. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / ShareUrl + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_ShareUrl` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_ShareUrl + +```markdown +# ViewShare.ShareUrl(属性) + + +## 说明 +可读 +返回当前分享视图的分享链接 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShareUrl = await app.Sheets(1).Views(1).ViewShare.ShareUrl; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShareUrl = Application.Sheets(1).Views(1).ViewShare.ShareUrl; +} +main() +``` +``` + +## 535. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / SharedLinkInfo + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_SharedLinkInfo` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_SharedLinkInfo + +```markdown +# ViewShare.SharedLinkInfo(属性) + + +## 说明 +可读 +返回当前分享视图的信息 + +## 返回值 +Object + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sharedLinkInfo = await app.Sheets(1).Views(1).ViewShare.SharedLinkInfo; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sharedLinkInfo = Application.Sheets(1).Views(1).ViewShare.SharedLinkInfo; +} +main() +``` +``` + +## 536. 开发指南 / WPS多维表格开发 / API文档 / API / ViewShare / VisibleRecType + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/ViewShare_VisibleRecType` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/ViewShare_VisibleRecType + +```markdown +# ViewShare.VisibleRecType(属性) + + + +## 说明 + +可读写 +返回当前分享视图高级权限中,可查看的记录范围 + +## 返回值 + +[DbSharedCriteriaType](/app-integration-dev/guide/dbsheet/Api/Enum_DbSharedCriteriaType) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const viewShare = await app.Sheets(1).Views(1).ViewShare; + // read + const visible = await viewShare.VisibleRecType; + // write + viewShare.VisibleRecType = 'Self'; +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; + // read + const visible = viewShare.VisibleRecType; + // write + viewShare.VisibleRecType = 'Self'; +} +main(); +``` + +``` + +## 537. 开发指南 / WPS多维表格开发 / API文档 / API / View / Activate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Activate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Activate + +```markdown +# View.Activate(方法) + + + +## 说明 + +激活该视图 + +## 语法 + +表达式.Activate() + +表达式: View + +## 参数 + +## 返回值 + + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Sheets(1).Views(1).Activate(); +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + Application.Sheets(1).Views(1).Activate(); +} +main(); +``` + +``` + +## 538. 开发指南 / WPS多维表格开发 / API文档 / API / View / Copy + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Copy` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Copy + +```markdown +# 复制视图 + +## 说明 +复制视图 + +## 语法 +表达式.Copy() + +表达式:View + +## 参数 + + +## 返回值 +View + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const result = await view.Copy(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const result = view.Copy(); +} +main() +``` +``` + +## 539. 开发指南 / WPS多维表格开发 / API文档 / API / View / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Delete + +```markdown +# 删除视图 + +## 说明 +删除指定视图 + +## 语法 +表达式.Delete() + +表达式:View + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + await view.Delete(); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + view.Delete(); +} +main() +``` +``` + +## 540. 开发指南 / WPS多维表格开发 / API文档 / API / View / Description + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Description` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Description + +```markdown +# View.Description(属性) + + +## 说明 +视图说明 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +// 获取视图说明 +async function getDescription() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const description = await view.Description; +} + +// 设置视图说明 +async function setDescription() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.Description = '新视图说明'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const description = view.Description; + view.Description = '新视图说明'; +} +main() +``` +``` + +## 541. 开发指南 / WPS多维表格开发 / API文档 / API / View / Fields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Fields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Fields + +```markdown +# View.Fields(属性) + + + +## 说明 + +可读 +获取当前视图下的字段列表 + +## 返回值 + +Fields + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const fields = await app.Sheets(1).Views(1).Fields; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fields = Application.Sheets(1).Views(1).Fields; +} +main() +``` +``` + +## 542. 开发指南 / WPS多维表格开发 / API文档 / API / View / Filters + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Filters` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Filters + +```markdown +# View.Filters(属性) + + +## 说明 +可读 +获取当前视图下的筛选器 + +## 返回值 +Filters + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const filters = await app.Sheets(1).Views(1).Filters; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const filters = Application.Sheets(1).Views(1).Filters; +} +main() +``` +``` + +## 543. 开发指南 / WPS多维表格开发 / API文档 / API / View / Groups + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Groups` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Groups + +```markdown +# View.Groups(属性) + + + +## 说明 +可读 +获取指定视图下面的分组列表 + +## 返回值 + +Groups + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const groups = await view.Groups; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const groups = view.Groups; +} +main() +``` +``` + +## 544. 开发指南 / WPS多维表格开发 / API文档 / API / View / Id + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Id` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Id + +```markdown +# View.Id(属性) + + + +## 说明 + +视图Id + +## 返回值 + +String + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const viewId = await view.Id; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewId = Application.Sheets(1).Views(1).Id; +} +main() +``` +``` + +## 545. 开发指南 / WPS多维表格开发 / API文档 / API / View / IsFavView + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_IsFavView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_IsFavView + +```markdown +# 设置快速访问视图 + +View.IsFavView + +## 说明 +可读写 +设置视图是否为快速访问视图 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function getFavView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const isFavView = await view.IsFavView; // 若为快速访问视图返回true,若不为快速访问视图返回false +} + +async function setFavView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.IsFavView = false; // 取消设置为快速访问视图 + view.IsFavView = true; // 设置为快速访问视图 +} +``` + +## 脚本编辑器 示例 +``` javascript +function getFavView() { + const view = Application.Sheets(1).Views(1); + const isFavView = view.IsFavView; // 若为快速访问视图返回true,若不为快速访问视图返回false +} +function setFavView() { + const view = Application.Sheets(1).Views(1); + view.IsFavView = false; // 取消设置为快速访问视图 + view.IsFavView = true; // 设置为快速访问视图 +} +main(); +``` +``` + +## 546. 开发指南 / WPS多维表格开发 / API文档 / API / View / IsPersonal + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_IsPersonal` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_IsPersonal + +```markdown +# 设置个人/公共视图 + +View.IsPersonal + +## 说明 +可读写 +设置视图为个人视图或公共视图 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function getPublicView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const isPersonal = await view.IsPersonal; // 若为个人视图返回true,若不为公共视图返回false + return !isPersonal; +} + +async function setPublicView() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.IsPersonal = false; // 设置为公共视图 + view.IsPersonal = true; // 设置为个人视图 +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const isPublicView = !view.IsPersonal; + view.IsPersonal = false; // 设置为公共视图 + view.IsPersonal = true; // 设置为个人视图 +} +main() +``` +``` + +## 547. 开发指南 / WPS多维表格开发 / API文档 / API / View / Name + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Name` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Name + +```markdown +# 重命名 + + +## 说明 +重命名、 获取视图名称 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +// 获取视图名称 +async function getName() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const name = await view.Name; +} +// 设置视图名称 +async function setName() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + view.Name = '新视图名称'; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const name = view.Name; + view.Name = '新视图名称'; +} +main() +``` +``` + +## 548. 开发指南 / WPS多维表格开发 / API文档 / API / View / OnDelete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_OnDelete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_OnDelete + +```markdown +# 监听删除视图的事件 +View.OnDelete(方法) + + + +## 说明 + +为当前视图添加 Delete 事件,当删除 View 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnDelete(Callback) + +表达式: View + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await View.OnDelete(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ------- | ------ | --------- | +| sheetId | Number | 表的 Id | +| viewId | String | 视图的 Id | + +## 事件返回数据示例 + +``` +{ + sheetId: 1 + viewId: 'B' +} +``` + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + app.Sheets(1).Views(1).Delete(); + //这里会执行OnDelete的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .OnDelete(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).Delete(); + //这里会执行OnDelete的回调 +} +main(); +``` + +``` + +## 549. 开发指南 / WPS多维表格开发 / API文档 / API / View / OnRename + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_OnRename` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_OnRename + +```markdown +# 监听重命名视图的事件 +View.OnRename(方法) + + + +## 说明 + +为当前视图添加 Rename 事件,当被修改 Name 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnRename(Callback) + +表达式: View + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | -------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await View.OnRename(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +| 名称 | 类型 | 说明 | +| ----------- | ------ | --------- | +| View | View | 视图 | +| originValue | String | 原始值 | +| value | String | 修改后的值 | + +## 事件返回数据示例 + +View, originValue, value + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app + .Sheets(1) + .Views(1) + .OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + const sheetName = app.Sheets(1).Views(1).Name; + sheetName = 'newName'; + //这里会执行OnRename的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1) + .Views(1) + .OnRename(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views(1).Name = 'newName'; + //这里会执行OnRename的回调 +} +main(); +``` + +``` + +## 550. 开发指南 / WPS多维表格开发 / API文档 / API / View / RecordRange + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_RecordRange` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_RecordRange + +```markdown +# View.RecordRange(属性) + + + +## 说明 + +视图的RecordRange + +## 返回值 + +RecordRange + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const recordRange = await view.RecordRange; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).Views(1).RecordRange; +} +main() +``` +``` + +## 551. 开发指南 / WPS多维表格开发 / API文档 / API / View / Records + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Records` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Records + +```markdown +# View.Records(属性) + + + +## 说明 + +视图的Records + +## 返回值 + +Records + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const records = await view.Records; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const records = Application.Sheets(1).Views(1).Records; +} +main() +``` +``` + +## 552. 开发指南 / WPS多维表格开发 / API文档 / API / View / Selection + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Selection` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Selection + +```markdown +# View.Selection(属性) + + + +## 说明 + +该视图的选中的RecordRange + +## 返回值 + +RecordRange + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const recordRange = await view.Selection; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const recordRange = Application.Sheets(1).Views(1).Selection; +} +main() +``` +``` + +## 553. 开发指南 / WPS多维表格开发 / API文档 / API / View / Sorts + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Sorts` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Sorts + +```markdown +# View.Sorts(属性) + + +## 说明 +可读写 +获取或设置当前视图下的排序条件列表 + +## 返回值 +Sorts + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const sorts = await app.Sheets(1).Views(1).Sorts; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const sorts = Application.Sheets(1).Views(1).Sorts; +} +main() +``` +``` + +## 554. 开发指南 / WPS多维表格开发 / API文档 / API / View / Type + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_Type` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_Type + +```markdown +# View.Type(属性) + + +## 说明 +只读属性,视图类型,视图类型包括以下几种 +'Grid', // 网格视图 +'Kanban', // 看板视图 +'Gallery', // 画册视图 +'Form', // 表单视图 +'Gantt', // 甘特视图 +'Query', // 查询视图 +'Calendar', // 日历视图 + +## 返回值 +String + +## 浏览器环境示例 +``` javascript +// 获取视图名称 +async function main() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const type = await view.Type; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views(1); + const type = view.Type; +} +main() +``` +``` + +## 555. 开发指南 / WPS多维表格开发 / API文档 / API / View / ViewShare + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/View_ViewShare` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/View_ViewShare + +```markdown +# View.ViewShare(属性) + + + +## 说明 + +该视图的视图分享 + +## 返回值 + +ViewShare + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views(1); + const viewShare = await view.ViewShare; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const viewShare = Application.Sheets(1).Views(1).ViewShare; +} +main() +``` +``` + +## 556. 开发指南 / WPS多维表格开发 / API文档 / API / Views / Views对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views + +```markdown +# Views (对象) + + +## 说明 +视图集合类 + +## 方法 +|属性|说明| +|-|-| +|[Add](/app-integration-dev/guide/dbsheet/Api/Views_Add)|添加视图| +|[Delete](/app-integration-dev/guide/dbsheet/Api/Views_Delete)|删除视图| +|[Item](/app-integration-dev/guide/dbsheet/Api/Views_Item)|根据 索引或名称 获取视图| +|[ItemById](/app-integration-dev/guide/dbsheet/Api/Views_ItemById)|根据 视图Id 获取视图| + +## 属性 +|属性|说明|读写说明| +|-|-|-| +|[Count](/app-integration-dev/guide/dbsheet/Api/Views_Count)|获取视图集合的个数|| +|[ActiveView](/app-integration-dev/guide/dbsheet/Api/Views_ActiveView)|获取当前激活的视图|| + +## 事件 +|属性|说明| +|-|-| +|[OnCreate](/app-integration-dev/guide/dbsheet/Api/Views_OnCreate)|添加 View 时触发| + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const views = Application.Sheets(1).Views; +} +main() +``` +``` + +## 557. 开发指南 / WPS多维表格开发 / API文档 / API / Views / ActiveView + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_ActiveView` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_ActiveView + +```markdown +# Views.ActiveView(属性) + + + +## 说明 + +获取当前激活的视图 + +## 返回值 + +View + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const view = await app.Sheets(1).Views.ActiveView; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views.ActiveView; +} +main() +``` +``` + +## 558. 开发指南 / WPS多维表格开发 / API文档 / API / Views / Add + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_Add` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_Add + +```markdown +# 新建视图 + +## 说明 +添加视图 + +## 语法 +表达式.Add(Type,Name) + +表达式:Views + +## 参数 +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ----------------------------------------------------- | -------- | +| Type | 是 | 'Grid'或'Kanban'或'Gallery'或'Form'或’Query‘或‘Gantt’ | 视图类别。| +| Name | 是 | string | 视图名称 | + +## 返回值 +[View](/app-integration-dev/guide/dbsheet/Api/View), [GridView](/app-integration-dev/guide/dbsheet/Api/GridView), [GanttView](/app-integration-dev/guide/dbsheet/Api/GanttView) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; + + const gridView = await views.Add('Grid', '表格视图'); + console.log(await gridView.RowHeight); + await views.Add('Kanban', '看板视图'); + await views.Add('Gallery', '画册视图'); + await views.Add('Form', '表单视图'); + await views.Add('Query', '查询视图'); + const ganttView = await views.Add('Gantt', '甘特视图'); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const views = Application.Sheets(1).Views; + const gridView = views.Add('Grid', '表格视图'); + console.log(gridView.RowHeight); + views.Add('Kanban', '看板视图'); + views.Add('Gallery', '画册视图'); + views.Add('Form', '表单视图'); + views.Add('Query', '查询视图'); + const ganttView = views.Add('Gantt', '甘特视图'); +} +main() +``` +``` + +## 559. 开发指南 / WPS多维表格开发 / API文档 / API / Views / Count + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_Count` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_Count + +```markdown +# Views.Count(属性) + + + +## 说明 + +获取视图集合的个数 + +## 返回值 + +Number + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const count = await app.Sheets(1).Views.Count; +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const count = Application.Sheets(1).Views.Count; +} +main() +``` +``` + +## 560. 开发指南 / WPS多维表格开发 / API文档 / API / Views / Delete + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_Delete` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_Delete + +```markdown +# Views.Delete(方法) + + + +## 说明 + +根据索引/Id 删除视图 + +## 语法 + +表达式.Delete(Index) + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | --------------------- | +| Index | 是 | number/string | 索引从 1 开始/视图ID | + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; + await views.Delete(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const views = Application.Sheets(1).Views; + views.Delete(1); +} +main() +``` +``` + +## 561. 开发指南 / WPS多维表格开发 / API文档 / API / Views / Item + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_Item` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_Item + +```markdown +# Views.Item(方法) + + + +## 说明 + +根据 索引或名称 获取视图 [View](/app-integration-dev/guide/dbsheet/Api/View), 注意当获取到的视图类型不同时,返回的View对象也会不同,参看返回值 + +## 语法 + +表达式.Item(Index) +表达式: Views + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | --------------------- | +| Index | 是 | number/string | 索引从 1 开始/ 视图名称 | + +## 返回值 +[View](/app-integration-dev/guide/dbsheet/Api/View) / [GridView](/app-integration-dev/guide/dbsheet/Api/GridView)/ [GanttView](/app-integration-dev/guide/dbsheet/Api/GanttView)/ [QueryView](/app-integration-dev/guide/dbsheet/Api/QueryView) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; + const view = await views.Item(1); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views.Item(1); +} +main() +``` +``` + +## 562. 开发指南 / WPS多维表格开发 / API文档 / API / Views / ItemById + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_ItemById` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_ItemById + +```markdown +# Views.ItemById(方法) + + + +## 说明 + +根据 视图Id 获取视图 [View](/app-integration-dev/guide/dbsheet/Api/View), 注意当获取到的视图类型不同时,返回的View对象也会不同,参看返回值 + +## 语法 + +表达式.ItemById(Id) +表达式: Views + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| ------ | -------- | ------------- | --------------------- | +| Id | 是 | string | 视图Id | + +## 返回值 +[View](/app-integration-dev/guide/dbsheet/Api/View) / [GridView](/app-integration-dev/guide/dbsheet/Api/GridView)/ [GanttView](/app-integration-dev/guide/dbsheet/Api/GanttView)/ [QueryView](/app-integration-dev/guide/dbsheet/Api/QueryView) + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const views = await app.Sheets(1).Views; + const view = await views.ItemById("A"); +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const view = Application.Sheets(1).Views.ItemById("A"); +} +main() +``` +``` + +## 563. 开发指南 / WPS多维表格开发 / API文档 / API / Views / OnCreate + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Views_OnCreate` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Views_OnCreate + +```markdown +# 监听增加视图的事件 +Views.OnCreate(方法) + + + +## 说明 + +为 Views 添加 Create 事件,当添加 View 时触发。注意在脚本编辑器中使用时,脚本运行结束就会退出运行,这时可能回调无法被正常触发 + +## 语法 + +表达式.OnCreate(Callback) + +表达式: Views + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| -------- | -------- | ---- | --------------------------------------------------------------------------------- | +| Callback | 是 | func | 指定事件发生时的回调方法 ; const eventContext = await Views.OnCreate(()=>{ ... }) | + +## 返回值 + +EventContext + +## 事件返回数据 + +View + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + let eventContext; + eventContext = await app.Sheets(1).Views.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + + await app.Sheets(1).Views.Add('Grid', '表格视图'); + //这里会执行OnCreate的回调 +} +``` + +## 脚本编辑器 示例 + +``` javascript +function main() { + let eventContext; + eventContext = Application.Sheets(1).Views.OnCreate(data => { + console.log(data); + // 取消事件监听 + eventContext.Destroy(); + }); + Application.Sheets(1).Views.Add('Grid', '表格视图'); + //这里会执行OnCreate的回调 +} +main(); +``` + +``` + +## 564. 开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / WatchedField对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/WatchedField + +```markdown +# WatchedField (对象) + + +## 说明 +WatchedField 最后修改人/最后修改时间 字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果最后修改人/最后修改时间,无法设置相关属性 + +## 属性 +- [IsWatchedAll](/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll) +- [WatchedFields](/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = await fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() + console.log(await prop.IsWatchedAll) + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() + } +main() +``` +``` + +## 565. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 最后修改人/最后修改时间字段 / 监听所有字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll + +```markdown +# 监听所有字段 +WatchedField.IsWatchedAll(属性) + + +## 说明 +可读写 + +最后修改人/最后修改时间,是否监听 所有字段的修改 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = await fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() + console.log(await prop.IsWatchedAll) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 566. 开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / IsWatchedAll + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/WatchedField_IsWatchedAll + +```markdown +# 监听所有字段 +WatchedField.IsWatchedAll(属性) + + +## 说明 +可读写 + +最后修改人/最后修改时间,是否监听 所有字段的修改 + +## 返回值 +Boolean + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = await fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() + console.log(await prop.IsWatchedAll) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const prop = fieldDescriptor.Watch + prop.IsWatchedAll = true + fieldDescriptor.Apply() +} +main() +``` +``` + +## 567. 开发指南 / WPS多维表格开发 / API文档 / 字段 / 最后修改人/最后修改时间字段 / 监听某些字段 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields + +```markdown +# 监听某些字段 +WatchedField.WatchedFields(属性) + + +## 说明 +可读写 + +最后修改人/最后修改时间,监听某些字段的修改情况, 如果需要监听某些特定的字段,需要将属性 IsWatchedAll 设置为false, 否则这个设置不生效 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptors = await Application.Sheets("数据表").FieldDescriptors + const fieldDescriptor = await fieldDescriptors.Item("@最后修改时间") + const prop = await fieldDescriptor.Watch + const watchId = await fieldDescriptors.Item("@文本").Id + prop.IsWatchedAll = false + prop.WatchedFields = [watchId] + fieldDescriptor.Apply() + console.log(await prop.WatchedFields) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const watchId = await Application.Sheets("数据表").FieldDescriptors("@文本").Id + const prop = fieldDescriptor.Watch + prop.IsWatchedAll = false + prop.WatchedFields = [watchId] + fieldDescriptor.Apply() +} +main() +``` +``` + +## 568. 开发指南 / WPS多维表格开发 / API文档 / API / WatchedField / WatchedFields + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/WatchedField_WatchedFields + +```markdown +# 监听某些字段 +WatchedField.WatchedFields(属性) + + +## 说明 +可读写 + +最后修改人/最后修改时间,监听某些字段的修改情况, 如果需要监听某些特定的字段,需要将属性 IsWatchedAll 设置为false, 否则这个设置不生效 + +## 返回值 +Array + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const Application = instance.Application + const fieldDescriptors = await Application.Sheets("数据表").FieldDescriptors + const fieldDescriptor = await fieldDescriptors.Item("@最后修改时间") + const prop = await fieldDescriptor.Watch + const watchId = await fieldDescriptors.Item("@文本").Id + prop.IsWatchedAll = false + prop.WatchedFields = [watchId] + fieldDescriptor.Apply() + console.log(await prop.WatchedFields) +} +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const fieldDescriptor = Application.Sheets("数据表").FieldDescriptors("@最后修改时间") + const watchId = await Application.Sheets("数据表").FieldDescriptors("@文本").Id + const prop = fieldDescriptor.Watch + prop.IsWatchedAll = false + prop.WatchedFields = [watchId] + fieldDescriptor.Apply() +} +main() +``` +``` + +## 569. 开发指南 / WPS多维表格开发 / API文档 / API / Window / Window对象 + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window + +```markdown +# Window (对象) + + +## 说明 +窗口对象,窗口对象只能在浏览器内使用,在脚本编辑器由于是在服务器上运行的脚本,不适用于Window对象 + +## 方法 +* [SetLayout](/app-integration-dev/guide/dbsheet/Api/Window_SetLayout) +* [BailHook](/app-integration-dev/guide/dbsheet/Api/Window_BailHook) +* [DisplayRecord](/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord) +* [HiddenAllRecord](/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord) +* [InterceptCopyRecordLink](/app-integration-dev/guide/dbsheet/Api/Window_InterceptCopyRecordLink) + +## 属性 +* [Navigator](/app-integration-dev/guide/dbsheet/Api/Window_Navigator) +* [NoticeBar](/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar) +* [GanttViewUI](/app-integration-dev/guide/dbsheet/Api/Window_GanttViewUI) +* [GridViewUI](/app-integration-dev/guide/dbsheet/Api/Window_GridViewUI) +* [FormViewUI](/app-integration-dev/guide/dbsheet/Api/Window_FormViewUI) + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const windowObject = await app.Window + } +``` +## 脚本编辑器 示例 +``` javascript +function main() { + const windowObject = Window +} +main() +``` +``` + +## 570. 开发指南 / WPS多维表格开发 / API文档 / API / Window / BailHook + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_BailHook` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_BailHook + +```markdown +# 代理界面元素 +Window.BailHook(方法) + + + +## 说明 + +对特定的界面元素进行代理,代理方法返回true时,则不显示原界面 + +## 语法 + +表达式.BailHook(CmbId) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| CmbId | 是 | string | 界面元素ID,目前支持 `RecordInfo`(记录详情卡片) | + + + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + + const hook = await app.Window.BailHook("RecordInfo") + hook.InvokeSingle((params)=>{ + console.log(params) // 移动端返回参数 {recordId: 'Jp', activeFieldId: 'E'} + // pc端返回参数 {recordId: 'Jp', isShowComment: false} + // 移动端和PC端 用到的参数都是 recordId,其它参数是界面区别 + // 可以通过 await WPSOpenApi.Application.ActiveView.RecordRange(params.recordId).Value 读取记录的数据 + const count = await Application.ActiveView.RecordRange.Count + const record = Application.ActiveView.RecordRange(params.recordId) + const values = await record.Value + const index = await record.Index // 注意 Index base 1, 可能有多条记录,返回 [index] + const prevRecord = Application.ActiveView.RecordRange(index.map(_=> _ - 1)) + const nextRecord = Application.ActiveView.RecordRange(index.map(_=> _ + 1)) + // 在这里实现自定义的界面逻辑,替换掉原来的界面 + record.Select() + return true // return true 会不弹出原界面 + }) +} +``` +``` + +## 571. 开发指南 / WPS多维表格开发 / API文档 / API / Window / DisplayRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_DisplayRecord + +```markdown +# 展开记录 + + + +## 说明 + +当前窗口下展开记录,显示详情信息 + +## 语法 + +表达式.DisplayRecord(RecodId) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| RecodId | 否 | String | 展开的记录ID | + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.DisplayRecord("B"); +} +``` +``` + +## 572. 开发指南 / WPS多维表格开发 / API文档 / API / Window / FormViewUI + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_FormViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_FormViewUI + +```markdown +# 表单视图的界面设置 +Window.FormViewUI(属性) + + +## 说明 +返回表单视图的界面设置,如果当前视图不是表单视图,则返回undefined + +## 返回值 +FormViewUI + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const formViewUI = await app.Window.FormViewUI +} +``` +``` + +## 573. 开发指南 / WPS多维表格开发 / API文档 / API / Window / GanttViewUI + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_GanttViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_GanttViewUI + +```markdown +# 甘特视图的界面设置 +Window.GanttViewUI(属性) + + +## 说明 +返回甘特视图的界面设置,如果当前视图不是甘特视图,则返回undefined + +## 返回值 +GanttViewUI + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const ganttViewUI = await app.Window.GanttViewUI +} +``` +``` + +## 574. 开发指南 / WPS多维表格开发 / API文档 / API / Window / GridViewUI + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_GridViewUI` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_GridViewUI + +```markdown +# 表格视图的界面设置 +Window.GridViewUI(属性) + + +## 说明 +返回表格视图的界面设置,如果当前视图不是表格视图,则返回undefined + +## 返回值 +GridViewUI + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const gridViewUI = await app.Window.GridViewUI +} +``` +``` + +## 575. 开发指南 / WPS多维表格开发 / API文档 / API / Window / HiddenAllRecord + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_HiddenAllRecord + +```markdown +# 关闭当前展开的记录 + + + +## 说明 + +关闭当前展开的记录 + +## 语法 + +表达式.HiddenAllRecord() + +表达式: Window + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.HiddenAllRecord(); +} +``` +``` + +## 576. 开发指南 / WPS多维表格开发 / API文档 / API / Window / Navigator + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_Navigator` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_Navigator + +```markdown +# 窗口导航栏 +Window.Navigator(属性) + + +## 说明 +返回窗口导航栏对象信息 + +## 返回值 +Navigator + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const navigator = await app.Window.Navigator +} +``` +``` + +## 577. 开发指南 / WPS多维表格开发 / API文档 / API / Window / NoticeBar + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_NoticeBar + +```markdown +# 窗口公告栏 +Window.NoticeBar(属性) + + +## 说明 +返回窗口公告栏对象信息 + +## 返回值 +NoticeBar + +## 浏览器环境示例 +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + const noticeBar = await app.Window.NoticeBar +} +``` +``` + +## 578. 开发指南 / WPS多维表格开发 / API文档 / API / Window / SetLayout + +- 页面路径: `/app-integration-dev/guide/dbsheet/Api/Window_SetLayout` +- 原文链接: https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Window_SetLayout + +```markdown +# 设置经典布局 +Window.SetLayout(方法) + + + +## 说明 + +设置该视图是否为经典布局 + +## 语法 + +表达式.SetLayout(isClassic) + +表达式: Window + +## 参数 + +| 参数名 | 是否必需 | 类型 | 描述 | +| --------- | -------- | ------- | -------------- | +| isClassic | 是 | Boolean | 是否为经典布局 | + +## 返回值 + +## 浏览器环境示例 + +``` javascript +async function example() { + await instance.ready(); + const app = instance.Application; + await app.Window.SetLayout(true); + await app.Window.SetLayout(false); +} +``` +``` diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-spec-doc.md b/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-spec-doc.md new file mode 100644 index 0000000..5f47490 --- /dev/null +++ b/18-基础架构及交付部署特战队/1-项目部署-管理/docs/airscript-spec-doc.md @@ -0,0 +1,1013 @@ +# AirScript 离线规格文档(开发参考) + +> 抓取时间:2026-03-19 +> 目标:汇总 AirScript 相关文档,形成可离线查阅的功能规格说明(含递归跟进的子页面) + +## 1. 文档范围与来源 + +本文件覆盖以下两类来源: + +1. AirScript 官方文档站(主来源,已递归抓取) +2. 金山多维表格开放文档入口(作为补充入口) + +说明:`365.kdocs.cn` 的部分页面为前端动态渲染,抓取工具无法稳定提取正文;已通过 `airsheet.wps.cn` 对应 AirScript 页面与多维表 API 页面补齐核心内容。 + +## 2. AirScript 总体架构 + +AirScript 是运行在金山文档云端的脚本环境,核心特点: + +- 语言:JavaScript(1.0 为 ES6 子集,2.0 支持现代 JS) +- 开发入口:文档内脚本编辑器(无需本地环境) +- 核心对象:`Application`(文档 API 顶层对象)、`Context`(运行上下文) +- 覆盖对象:在线表格(Workbook/Sheet/Range)与多维表(DataBook) +- 外部集成:APIToken + webhook(HTTP 触发) + +## 3. 运行时版本与兼容性 + +### 3.1 AirScript 1.0 + +- 面向传统在线表格与多维表 API +- 同步式 API 体验 +- 语法支持有限(不支持 `await/class/import/export` 等) + +### 3.2 AirScript 2.0(Beta) + +- 对齐 WPS JS 宏体系,API 数量显著增加 +- 性能提升(高频 API 调用场景更明显) +- 支持现代 JS 语法(如 `async/await`、`Promise`、`class`) +- 当前重点支持工作表场景;数据表(多维表)能力仍在逐步开放 + +### 3.3 版本使用建议 + +- 存量 1.0 脚本可继续运行 +- 新项目若主战场是工作表自动化,优先 2.0 +- 若强依赖多维表数据表 API,当前仍需 1.0 + +## 4. 脚本上下文与参数约定 + +### 4.1 全局对象 + +- `Application`:文档对象模型入口 +- `Context`:运行上下文(包括 `argv` 参数) + +### 4.2 视图配置参数 + +- 编辑器“视图配置”定义参数后,可通过 `Context.argv.xxx` 读取 +- 适合把脚本交付给非开发人员,通过表单化参数执行脚本 + +### 4.3 外部调用上下文(APIToken) + +请求体 `Context` 支持(按文档) + +- `Context.argv`: 自定义业务参数对象 +- `Context.sheet_name`: 表名(工作表) +- `Context.range`: 区域(如 `$B$156`) +- `Context.link_from`: 触发超链接单元格 +- `Context.db_active_view`: 多维表当前视图 +- `Context.db_selection`: 多维表当前选区 + +## 5. API 能力总览(AirScript 1.0) + +### 5.1 工作表模型(Workbook API) + +主要对象: + +- `Application` +- `Workbook` +- `Sheet` +- `Range` +- `AutoFilter` +- `Sort` / `SortField` +- `Font` +- `Border` +- `Shape` / `Chart` +- `Hyperlink` +- `FormatConditions` / `FormatCondition` +- `Validation` +- `WorksheetFunction` +- `Enum` + +关键能力分组: + +- 结构与导航:工作表增删改、激活、移动、集合遍历 +- 单元格读写:`Value/Value2`、`Text`、`Formula`、`FormulaArray` +- 格式控制:字体、边框、对齐、数字格式、条件格式 +- 数据处理:筛选、排序、填充、替换、文本分列 +- 数据质量:数据有效性规则 +- 导出与评论:保存、评论、导出 PDF/图片 + +### 5.2 多维表模型(DataBook API) + +主要对象: + +- `Application`(数据表上下文) +- `Sheet`(数据表) +- `Field`(字段管理) +- `Record`(行记录管理) +- `Enum` + +`Sheet` 典型属性/方法: + +- 属性:`Id`, `Name`, `Index`, `Visible`, `Type`, `Field`, `Record` +- 方法:`Activate()`, `Move()`, `Delete()`, `IsDBSheet()` + +`Field` 典型方法: + +- `GetFields()` +- `CreateFields()` +- `DeleteFields()` +- `UpdateFields()` + +`Record` 典型方法: + +- `GetRecords()`(支持分页/筛选/字段子集) +- `GetRecord()` +- `CreateRecords()` +- `UpdateRecords()` +- `DeleteRecords()` +- `GetAttachmentURL()` + +## 6. 多维表字段与筛选规格(附录归纳) + +### 6.1 字段类型(创建与赋值关注点) + +常见字段类型(文档枚举): + +- 文本与数值:`MultiLineText`, `Number`, `Currency`, `Percentage` +- 时间:`Date`, `Time`, `CreatedTime` +- 业务类型:`SingleSelect`, `MultipleSelect`, `Checkbox`, `Rating`, `Complete` +- 实体类型:`Contact`, `Attachment`, `Link` +- 系统/计算:`AutoNumber`, `CreatedBy`, `Formula`, `Lookup` +- 其他:`Phone`, `Email`, `ID`, `Url`, `Note` + +赋值注意: + +- 并非所有字段支持写入(如部分系统字段) +- `SingleSelect/MultipleSelect/Rating/Contact/Link` 创建时需额外结构参数 +- 附件/图片下载通过 `GetAttachmentURL` 转 URL + +### 6.2 视图类型 + +- `Grid` +- `Kanban` +- `Gallery` +- `Form` +- `Gantt` + +### 6.3 筛选条件结构 + +筛选对象: + +- `mode`: `AND | OR` +- `criteria[]`: 每条包含 `field`, `op`, `values` + +典型操作符: + +- 比较:`Equals`, `NotEqu`, `Greater`, `GreaterEqu`, `Less`, `LessEqu` +- 区间:`GreaterEquAndLessEqu`, `LessOrGreater` +- 文本:`BeginWith`, `EndWith`, `Contains`, `NotContains` +- 集合:`Intersected` +- 空值:`Empty`, `NotEmpty` + +动态日期筛选: + +- 通过 `values[]` 传 `DynamicSimple` 结构(如 `today`, `lastWeek`, `thisMonth`) + +## 7. 高级服务 API(需启用服务) + +高级服务启用路径:脚本编辑器 -> 服务 -> 添加服务。 +如未启用,运行时会出现对象未定义错误。 + +### 7.1 HTTP(网络 API) + +- 全局对象:`HTTP` +- 方法:`fetch`, `get`, `post`, `put`, `delete` +- 响应对象:`status`, `statusText`, `headers`, `text()`, `json()`, `binary()` + +限制要点: + +- 仅允许域名请求(禁止 IP / 端口) +- 超时时间有上限 +- 响应体大小有限制 + +### 7.2 KSDrive(云文档 API) + +- 全局对象:`KSDrive` +- 主要方法:`createFile`, `openFile`, `listFiles` +- 文件句柄:`File.Application`, `File.close()` +- 支持文件类型:`AP`, `KSheet`, `ET`, `DB` + +关键约束: + +- `openFile` 返回对象使用完必须 `close()`,否则后续打开会报错 + +### 7.3 SMTP(邮件 API) + +- 全局对象:`SMTP` +- 登录:`SMTP.login(...)` +- 发送:`mailer.send(...)` +- 支持收件人数组、昵称格式地址、文本+HTML 内容 + +### 7.4 SQL(数据库 API) + +- 全局对象:`SQL` +- 驱动:`MySQL`, `PostgreSQL`, `SQLServer` +- 连接:`SQL.connect(...)` +- 执行:`connection.queryAll(sql, params)` +- 关闭:`connection.close()` + +返回结构要点: + +- `affectRowCount` +- `rows` + +## 8. 内置函数(Built-in) + +典型内置对象: + +- `Crypto`:摘要与 HMAC +- `Buffer`:字节缓冲处理 +- `Time`:如 `sleep(ms)` +- `Arguments`:获取参数(支持路径键) + +## 9. APIToken 外部执行接口规格 + +## 9.1 凭证与地址 + +- 凭证头:`AirScript-Token` +- 目标地址:脚本 webhook(含 `file_id` 与 `script_id`) + +### 9.2 同步执行 + +- `POST /api/v3/ide/file/:file_id/script/:script_id/sync_task` +- 调用后直接返回执行结果、日志与状态 + +### 9.3 异步执行 + +- `POST /api/v3/ide/file/:file_id/script/:script_id/task` +- 返回 `task_id` +- 通过 `GET /api/v3/script/task?task_id=...` 轮询结果 + +### 9.4 返回结构(通用) + +- `data.logs[]`: 执行日志 +- `data.result`: 脚本返回值 +- `status`: 任务状态 +- `error` / `error_details`: 错误信息 + +### 9.5 安全与生命周期 + +- APIToken 与用户绑定,属高敏感凭证 +- 默认存在有效期(文档示例为 180 天,可延期) +- 建议服务端保管,不在前端明文暴露 + +## 10. 开发实践建议(从官方示例抽象) + +- 范围控制优先:用 `Selection` + `UsedRange` 求交集,避免全表遍历 +- 对象复用:循环中缓存 `row/range`,减少频繁 API 调用 +- 大数据分页:多维表 `GetRecords` 使用 `offset` 分页拉取 +- 资源释放:`KSDrive.openFile` 后务必 `close` +- SQL 与 SMTP 凭证分离:不要硬编码在共享脚本 +- 脚本交付时使用“视图配置”降低使用门槛 + +## 11. 递归抓取到的核心页面索引 + +### 11.1 入门与指南 + +- `guide/summary.html` +- `guide/rules.html` +- `start/quickstart.html` +- `start/best-practice.html` +- `start/view-setting.html` +- `example/excel.html` +- `example/dbSheet.html` + +### 11.2 API 1.0(工作表) + +- `api/excel/workbook/overview.html` +- `api/excel/workbook/Range.html` +- `api/excel/workbook/AutoFilter.html` +- `api/excel/workbook/Sort.html` +- `api/excel/workbook/SortField.html` +- `api/excel/workbook/Font.html` + +### 11.3 API 1.0(多维表) + +- `api/excel/databook/Application.html` +- `api/excel/databook/Sheet.html` +- `api/excel/databook/Field.html` +- `api/excel/databook/Record.html` +- `api/excel/databook/Enum.html` +- `api/excel/databook/附录.html` + +### 11.4 高级服务 + +- `api/advanced/Overview.html` +- `api/advanced/HTTP.html` +- `api/advanced/KSDrive.html` +- `api/advanced/SMTP.html` +- `api/advanced/sql.html` +- `api/build-in.html` + +### 11.5 外部执行 + +- `apitoken/intro.html` +- `apitoken/api.html` +- `apitoken/scenario.html` + +### 11.6 AirScript 2.0 + +- `apiV2/overview.html` +- `apiV2/excel/workbook/AboveAverage/...` + +## 12. 来源链接(原始文档) + +- [AirScript 文档首页](https://airsheet.wps.cn/docs/) +- [AirScript 概述](https://airsheet.wps.cn/docs/guide/summary.html) +- [脚本语言](https://airsheet.wps.cn/docs/guide/rules.html) +- [快速开始](https://airsheet.wps.cn/docs/start/quickstart.html) +- [最佳实践](https://airsheet.wps.cn/docs/start/best-practice.html) +- [视图配置](https://airsheet.wps.cn/docs/start/view-setting.html) +- [表格案例](https://airsheet.wps.cn/docs/example/excel.html) +- [多维表案例](https://airsheet.wps.cn/docs/example/dbSheet.html) +- [API 总览(工作表)](https://airsheet.wps.cn/docs/api/excel/workbook/overview.html) +- [数据表 Application](https://airsheet.wps.cn/docs/api/excel/databook/Application.html) +- [数据表 Sheet](https://airsheet.wps.cn/docs/api/excel/databook/Sheet.html) +- [数据表 Field](https://airsheet.wps.cn/docs/api/excel/databook/Field.html) +- [数据表 Record](https://airsheet.wps.cn/docs/api/excel/databook/Record.html) +- [数据表 Enum](https://airsheet.wps.cn/docs/api/excel/databook/Enum.html) +- [数据表附录(字段/视图/筛选)](https://airsheet.wps.cn/docs/api/excel/databook/%E9%99%84%E5%BD%95.html) +- [高级服务概述](https://airsheet.wps.cn/docs/api/advanced/Overview.html) +- [HTTP API](https://airsheet.wps.cn/docs/api/advanced/HTTP.html) +- [KSDrive API](https://airsheet.wps.cn/docs/api/advanced/KSDrive.html) +- [SMTP API](https://airsheet.wps.cn/docs/api/advanced/SMTP.html) +- [SQL API](https://airsheet.wps.cn/docs/api/advanced/sql.html) +- [内置函数](https://airsheet.wps.cn/docs/api/build-in.html) +- [脚本令牌简介](https://airsheet.wps.cn/docs/apitoken/intro.html) +- [脚本令牌接口](https://airsheet.wps.cn/docs/apitoken/api.html) +- [脚本令牌应用场景](https://airsheet.wps.cn/docs/apitoken/scenario.html) +- [AirScript 2.0 概述](https://airsheet.wps.cn/docs/apiV2/overview.html) +- [金山多维表格开发入口(原始入口)](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/dbsheet-standard) + +1. **编辑器手动运行**:点击顶部菜单「效率」→「AirScript 脚本编辑器」,在打开的窗口中编写代码并点击运行。 +2. **按钮触发**:在多维表格中添加「按钮」字段,并在其设置中选择点击按钮时「执行 AirScript 脚本」。 +3. **自动化流程触发**:在多维表格的自动化流程配置中,添加操作「执行以下操作」→「执行 AirScript 脚本」,并选择对应的脚本文件及配置参数。 + +--- + +## 2. 快速入门 + +**在线文档**: [AirScript-quickstart](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart) + +### 在 AirScript 编辑器中运行 + +在金山文档首页新建一个 WPS 多维表格并打开来体验 AirScript。打开 WPS 多维表格,点击「脚本」-「JS脚本」下的「新建脚本」,点击即可调起 AirScript 编辑器。 + +#### 示例 1:Hello World + +```javascript +function main(){ + console.log("hello world!") +} +main() +``` + +#### 示例 2:操作工作表与单元格 + +```javascript +function main(){ + // 遍历并打印所有工作表的名称 + let sheets = Application.Sheets + for (let i = 0; i < sheets.Count; i++) { + let sheet = sheets.Item(i + 1) + console.log(sheet.Name) + } + const sheet = Application.Selection.GetActiveSheet() + // 打印当前激活Sheet的名称 + console.log(sheet.name) + // 打印单元格内容 + console.log(Application.ActiveView.RecordRange(1, 1).Text) + // 修改单元格内容 + Application.ActiveView.RecordRange(1, 1).Value = 2; + // 打印修改后的单元格内容 + console.log(Application.ActiveView.RecordRange(1, 1).Text) +} +main() +``` + +### 在自动化流程中运行 + +1. 点击「自动化」-「新建自动化」,添加「执行AirScript脚本」操作,点击「管理脚本」-「新建脚本」进入脚本编辑器即可。 +2. 在脚本中获取到传递的参数进行开发使用: + +```javascript +// 通过 Context.argv 获取入参 +console.log("脚本入参: ", Context.argv); +console.log("脚本入参p1: ", Context.argv.p1); +``` + +更多自动化请查看 [执行AirScript脚本操作使用指南](https://kdocs.cn/l/cdQOqc6TZuMk) + +--- + +## 3. 内置基础类型 + +**在线文档**: [AirScript-build-in](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in) + +内置的基本数据类型、对象和函数用来帮助开发者开发,遵循 JavaScript 函数命名的标准规范,同时不能和 OpenApi 提供对象重名。 + +### 基本数据类型 + +| 类型 | 说明 | +|------|------| +| Boolean | 布尔值 | +| Null | 空值 | +| Undefined | 未定义 | +| Number | 数字 | +| String | 字符串 | + +### 内置对象 + +| 对象 | 说明 | +|------|------| +| Object | 基础对象 | +| Array | 数组 | +| Function | 函数 | +| Date | 日期 | +| RegExp | 正则表达式 | +| JSON | JSON 处理 | +| Math | 数学计算 | +| Number | 数字对象 | +| String | 字符串对象 | +| Map / Set | 集合 | +| Promise | 异步处理 | + +### 全局对象与函数 + +- **console**: 日志输出,支持 `.log`, `.info`, `.warn`, `.error`, `.time`, `.timeEnd` +- **fetch**: 网络请求 +- **常用函数**: `parseInt`, `parseFloat`, `isNaN`, `isFinite`, `decodeURI`, `encodeURI` 等 + +### 高级内置服务 + +#### Crypto — 加密服务 + +```javascript +// Hash 计算 +Crypto.hash("md5", "hello") // 支持: md5, sha1, sha256 +Crypto.hash("sha256", "data") + +// HMAC 计算 +Crypto.hmac("hmac-sha1", "key", "data") // 支持: hmac-sha1, hmac-sha256 +Crypto.hmac("hmac-sha256", "secretKey", "message") +``` + +#### Buffer — 二进制数据处理 + +```javascript +// 创建 Buffer +Buffer.from("hello", "text") // 支持编码: text, base64, hex +Buffer.from("aGVsbG8=", "base64") + +// 转换输出 +let buf = Buffer.from("hello", "text") +buf.toString("base64") // 输出 base64 编码 +buf.toString("hex") // 输出 hex 编码 +``` + +#### Time — 时间服务 + +```javascript +Time.sleep(1000) // 睡眠 1000 毫秒 +Time.now() // 获取当前纳秒时间 +``` + +#### Arguments — 脚本执行参数 + +```javascript +// 获取脚本执行参数(自动化流程传参时使用) +let args = Context.argv +console.log(args) +``` + +--- + +## 4. 脚本经典案例 + +**在线文档**: [AirScript-demo](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo) + +### 案例 1:选中区域快速批量填值 + +通过 `Selection` 获取当前选区并循环填入指定值。 + +```javascript +function main() { + const range = Application.Selection.Range; + for (let i = 1; i <= range.Rows.Count; i++) { + for (let j = 1; j <= range.Columns.Count; j++) { + range.Rows(i).Columns(j).Value = "待处理"; + } + } +} +``` + +### 案例 2:快速实现"一键归档" + +根据状态字段(如"已完成")将记录从当前表移动到归档表。 + +```javascript +// 核心逻辑:获取符合条件的记录范围 +// 然后执行 AddRecords 并 DeleteRecords +function main() { + const activeSheet = Application.Selection.GetActiveSheet(); + const archiveSheet = Application.Sheets.Item("归档表"); + // 遍历记录,筛选状态为"已完成"的记录 + // 将其添加到归档表并从原表删除 +} +``` + +### 案例 3:快速删除空白数据 + +自动识别并删除关键字段为空的行。 + +### 案例 4:快速创建一张表 + +使用 `Application.Sheets.Add()` 动态创建新表并定义字段结构。 + +```javascript +function main() { + Application.Sheets.Add("新表名", { + Fields: [ + { Name: "姓名", Type: "Text" }, + { Name: "年龄", Type: "Number" } + ] + }); +} +``` + +### 案例 5:格式化数据批量插入 + +将外部 JSON 或格式化字符串批量导入到多维表格中。 + +### 案例 6:自动双向关联 + +当 A 表关联 B 表时,脚本自动反向设置 B 表关联 A 表,保持数据同步。 + +### 案例 7:同步主表数据到其他表 + +实现跨表的数据联动,当主表更新时,自动更新关联表中的冗余字段。 + +### 案例 8:获取日期筛选后记录 + +利用 `RecordRange.Condition` 配合日期函数进行条件筛选。 + +### 案例 9:获取联系人筛选后记录 + +筛选特定负责人或创建人的记录信息。 + +### 案例 10:批量将获取的图片 URL 进行文字识别 (OCR) + +调用百度云 OCR 接口,识别表中附件字段的图片内容并将文字回填。 + +```javascript +const access_token = "xxxxxx"; +function main() { + const view = Application.ActiveSheet.Views(1); + const attachments = view.RecordRange('1:' + view.RecordRange.Count, ["@图片和附件"]).Value; + // 调用 fetch 请求 OCR 接口并将结果回填 +} +``` + +--- + +## 5. API 文档 — 数据表 (Sheets) + +### 5.1 Application.Sheets + +全局入口,获取当前文档中所有数据表的集合。 + +```javascript +const sheets = Application.Sheets; +``` + +### 5.2 Sheets.Count — 获取数据表总数 + +**在线文档**: [Sheets_Count](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Count) + +```javascript +const count = Application.Sheets.Count; +console.log("共有 " + count + " 张数据表"); +``` + +**返回值**: `Number` — 数据表数量 + +### 5.3 Sheets.Item(Index) — 获取指定数据表 + +**在线文档**: [Sheets_Item](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Item) + +**语法**: `Application.Sheets.Item(Index)` + +**参数**: +| 参数 | 类型 | 说明 | +|------|------|------| +| Index | Number / String | 数据表的索引(从 1 开始)或名称 | + +**示例**: + +```javascript +// 通过索引获取 +const sheet = Application.Sheets.Item(1); + +// 通过名称获取 +const sheet = Application.Sheets.Item("项目基本信息表"); +``` + +**返回值**: `Sheet` 对象 + +### 5.4 Sheets.Add() — 新建数据表 + +**在线文档**: [Sheets_Add](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Add) + +**语法**: `Application.Sheets.Add(Name, Options)` + +**参数**: +| 参数 | 类型 | 说明 | +|------|------|------| +| Name | String | 新表的名称 | +| Options | Object | 可选,包含 Fields 数组来初始化表结构 | + +**示例**: + +```javascript +Application.Sheets.Add("新表名", { + Fields: [ + { Name: "姓名", Type: "Text" }, + { Name: "年龄", Type: "Number" }, + { Name: "状态", Type: "SingleSelect" } + ] +}); +``` + +**返回值**: 新创建的 `Sheet` 对象 + +### 5.5 Sheet 对象属性 + +#### Sheet.Name — 获取/设置表名 + +**在线文档**: [Sheet_Name](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Name) + +```javascript +const sheet = Application.Sheets.Item(1); +// 获取表名 +console.log(sheet.Name); +// 修改表名 +sheet.Name = "新表名"; +``` + +#### Sheet.Id — 获取表 ID + +**在线文档**: [Sheet_Id](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Id) + +```javascript +const sheet = Application.Sheets.Item(1); +console.log(sheet.Id); // 返回该数据表的唯一数字 ID +``` + +**返回值**: `Number` — 数据表唯一 ID + +--- + +## 6. API 文档 — 字段 (Field / FieldDescriptor) + +### 6.1 Sheet.FieldDescriptors — 获取所有字段描述符 + +**在线文档**: [FieldDescriptors](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors) + +获取指定数据表的所有字段描述信息集合。 + +```javascript +const sheet = Application.Sheets.Item(1); +const descriptors = sheet.FieldDescriptors; + +// 获取字段总数 +console.log(descriptors.Count); +``` + +**属性**: +| 属性 | 类型 | 说明 | +|------|------|------| +| Count | Number | 字段总数 | + +**方法**: +| 方法 | 说明 | +|------|------| +| Item(Index) | 获取指定序号的字段描述(从 1 开始) | + +### 6.2 FieldDescriptors.Item(Index) — 获取单个字段描述 + +**在线文档**: [FieldDescriptors_Item](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item) + +**语法**: `表达式.Item(Index)` 或 `表达式(Index)` + +**参数**: +| 参数 | 类型 | 说明 | +|------|------|------| +| Index | Number / String | 字段索引(从 1 开始)或字段名称(以 `@` 前缀) | + +**示例**: + +```javascript +const sheet = Application.Sheets.Item(1); +const descriptors = sheet.FieldDescriptors; + +// 通过索引获取 +const field1 = descriptors.Item(1); +console.log(field1.name); // 字段名 +console.log(field1.type); // 字段类型 + +// 通过名称获取 +const field2 = descriptors.Item("@项目名称"); +console.log(field2.type); +``` + +**返回值**: `FieldDescriptor` 对象 + +### 6.3 FieldDescriptor 对象 + +**在线文档**: [FieldDescriptor](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor) + +用于描述字段的属性(如类型)。修改后需调用 `.Apply()` 方法才能生效。 + +**属性**: +| 属性 | 类型 | 说明 | +|------|------|------| +| name | String | 字段名称 | +| type | String | 字段类型 | + +**方法**: +| 方法 | 说明 | +|------|------| +| Apply() | 应用对字段描述的修改 | + +### 6.4 Field 对象 + +**在线文档**: [Field](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field) + +代表视图中呈现的字段实例。 + +**属性**: +| 属性 | 类型 | 说明 | +|------|------|------| +| Id | Number | 字段唯一 ID | +| Name | String | 字段名称 | +| Type | String | 字段类型 | +| Width | Number | 字段宽度 | + +### 6.5 字段类型 (Field Type) 枚举 + +以下是创建字段时支持的类型值: + +| 类型值 | 说明 | +|--------|------| +| `Text` / `MultiLineText` | 多行文本 | +| `Number` | 数字 | +| `SingleSelect` | 单选 | +| `MultipleSelect` | 多选 | +| `Date` / `DateTime` | 日期 / 日期时间 | +| `Checkbox` | 复选框 | +| `Attachment` | 附件 | +| `Link` | 关联(外键关联其他表) | +| `Url` | 超链接 | +| `Phone` | 电话 | +| `Email` | 邮箱 | +| `AutoNumber` | 自动编号 | +| `Contact` | 成员/联系人 | +| `Formula` | 公式 | +| `CreatedTime` | 创建时间 | +| `ModifiedTime` | 修改时间 | +| `CreatedBy` | 创建人 | +| `ModifiedBy` | 修改人 | + +> **注意**: 使用 `Application.Sheet.CreateSheet()` 创建表时的字段类型值可能与此处略有不同。 +> 请参考创建表的 API 文档确认有效值。 + +--- + +## 7. API 文档 — 记录 (Record) + +### 7.1 RecordRange — 获取记录范围 + +通过视图对象访问记录: + +```javascript +const view = Application.ActiveSheet.Views(1); +// 获取单个记录的单元格值 +const value = view.RecordRange(1, 1).Text; + +// 获取记录范围 +const range = view.RecordRange('1:10', ["@字段名"]); +``` + +### 7.2 Record 操作示例 + +```javascript +// 获取当前选中的表 +const sheet = Application.Selection.GetActiveSheet(); + +// 读取数据 +const view = sheet.Views(1); +const count = view.RecordRange.Count; +console.log("记录总数: " + count); + +// 修改单元格 +view.RecordRange(1, 1).Value = "新值"; + +// 批量读取 +for (let i = 1; i <= count; i++) { + console.log(view.RecordRange(i, 1).Text); +} +``` + +--- + +## 8. API 文档 — 视图 (View) + +### 8.1 获取视图 + +```javascript +// 获取当前活跃视图 +const activeView = Application.ActiveView; + +// 通过 Sheet 的 Views 集合获取 +const sheet = Application.Sheets.Item(1); +const view = sheet.Views(1); // 索引从 1 开始 +``` + +### 8.2 Selection — 选区对象 + +```javascript +const selection = Application.Selection; + +// 获取当前选中的 Sheet +const sheet = selection.GetActiveSheet(); + +// 获取选中范围 +const range = selection.Range; +``` + +--- + +## 9. API 文档 — 其他 + +### 9.1 Application.Sheet.CreateSheet() — 创建表 (REST API 风格) + +> **注意**: 此方法与 `Application.Sheets.Add()` 不同,使用了 REST API 风格的调用方式。 + +```javascript +var sheet = Application.Sheet.CreateSheet({ + Name: '表名', + Views: [{ name: '默认视图', type: 'Grid' }], + Fields: [ + { name: '字段1', type: 'MultiLineText' }, + { name: '状态', type: 'SingleSelect', items: [ + { value: '选项1' }, { value: '选项2' } + ] }, + { name: '日期', type: 'Date' }, + { name: '数字', type: 'Number' }, + { name: '复选', type: 'Checkbox' }, + { name: '附件', type: 'Attachment' }, + { name: '链接', type: 'Url' }, + { name: '电话', type: 'Phone' }, + { name: '自动编号', type: 'AutoNumber' }, + { name: '成员', type: 'Contact', multipleContacts: false, noticeNewContact: false } + ] +}); +var sheetId = sheet.id; +``` + +### 9.2 Application.Field.CreateFields() — 创建字段 + +```javascript +Application.Field.CreateFields({ + SheetId: sheetId, + Fields: [ + { name: '关联字段', type: 'Link', linkSheet: targetSheetId, multipleLinks: false } + ] +}); +``` + +### 9.3 Application.Field.GetFields() — 获取字段信息 + +```javascript +var fields = Application.Field.GetFields({ + SheetId: sheetId +}); +// fields 返回该表的所有字段详细信息 +console.log(JSON.stringify(fields, null, 2)); +``` + +### 9.4 HTTP / fetch — 网络请求 + +```javascript +// 使用 fetch 发起 HTTP 请求 +const response = fetch("https://api.example.com/data", { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ key: "value" }) +}); +console.log(response.json()); +``` + +### 9.5 console — 日志输出 + +```javascript +console.log("普通日志"); +console.info("信息日志"); +console.warn("警告日志"); +console.error("错误日志"); + +// 计时 +console.time("操作耗时"); +// ... 执行操作 ... +console.timeEnd("操作耗时"); +``` + +--- + +## 附录 A: 常用代码片段 + +### A.1 遍历所有表并打印表名 + +```javascript +const sheets = Application.Sheets; +for (let i = 1; i <= sheets.Count; i++) { + const sheet = sheets.Item(i); + console.log(i + ". " + sheet.Name + " (Id: " + sheet.Id + ")"); +} +``` + +### A.2 获取指定表的所有字段信息 + +```javascript +const sheet = Application.Sheets.Item("项目基本信息表"); +const descriptors = sheet.FieldDescriptors; +for (let i = 1; i <= descriptors.Count; i++) { + const fd = descriptors.Item(i); + console.log(fd.name + " → " + fd.type); +} +``` + +### A.3 导出所有表结构为 JSON + +```javascript +var result = []; +var sheets = Application.Sheets; +for (var i = 1; i <= sheets.Count; i++) { + var sheet = sheets.Item(i); + var fields = []; + var descriptors = sheet.FieldDescriptors; + for (var j = 1; j <= descriptors.Count; j++) { + var fd = descriptors.Item(j); + fields.push({ name: fd.name, type: fd.type }); + } + result.push({ + tableName: sheet.Name, + sheetId: sheet.Id, + fieldCount: fields.length, + fields: fields + }); +} +console.log(JSON.stringify(result, null, 2)); +``` + +### A.4 获取环境信息 + +```javascript +// 当前激活的表 +console.log("当前表: " + Application.Selection.GetActiveSheet().Name); + +// 当前文档中的所有表 +var sheets = Application.Sheets; +console.log("表数量: " + sheets.Count); +``` + +--- + +## 附录 B: 文档链接索引 + +| 章节 | 在线链接 | +|------|---------| +| AirScript 简介 | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-instro) | +| 快速入门 | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-quickstart) | +| 内置基础类型 | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-build-in) | +| 脚本经典案例 | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/AirScript/AirScript-demo) | +| API: Sheets.Add | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Add) | +| API: Sheets.Item | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheets_Item) | +| API: Sheet.Name | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Name) | +| API: Sheet.Id | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Sheet_Id) | +| API: FieldDescriptors | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors) | +| API: FieldDescriptors.Item | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptors_Item) | +| API: FieldDescriptor | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/FieldDescriptor) | +| API: Field | [链接](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/Field) | diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/scripts/airscript-export-full-schema-with-stage-log.js b/18-基础架构及交付部署特战队/1-项目部署-管理/scripts/airscript-export-full-schema-with-stage-log.js new file mode 100644 index 0000000..66da998 --- /dev/null +++ b/18-基础架构及交付部署特战队/1-项目部署-管理/scripts/airscript-export-full-schema-with-stage-log.js @@ -0,0 +1,646 @@ +/** + * ============================================================ + * 金山多维表格 AirScript - 完整字段定义导出 + 阶段日志落表 + * ============================================================ + * + * 目标: + * 1) 导出指定 7 张表的字段定义(含完整 JSON) + * 2) 解决控制台日志分阶段现象: 同步写入日志表 + * + * 参考(来自本项目离线文档): + * - Sheet.GetFields() + * - FieldDescriptors / FieldDescriptors.Item() + * - Application.Sheet.CreateSheet() + * - View.RecordRange().Value + */ + +// ---------------------------- +// 配置区 +// ---------------------------- +var TARGET_TABLES = [ + '项目基本信息表', + '项目本地化部署升级信息表', + '项目本地化部署状态表', + '项目部署环境信息表', + '项目部署网络信息表', + '项目部署中间件信息表', + '项目部署业务信息表', + '持续交付部署表', + '持续交付部署状态表', +]; + +var EXPORT_SCHEMA_SHEET_NAME = '数据导出-字段定义'; +var EXPORT_LOG_SHEET_NAME = '数据导出-执行日志'; +var MAX_JSON_CELL_LENGTH = 30000; + +// ---------------------------- +// 运行态数据 +// ---------------------------- +var logRows = []; +var schemaRows = []; +var runId = buildRunId(); + +// ---------------------------- +// 工具函数 +// ---------------------------- +function buildRunId() { + var d = new Date(); + function pad(n) { return n < 10 ? '0' + n : '' + n; } + return ( + d.getFullYear() + + pad(d.getMonth() + 1) + + pad(d.getDate()) + '_' + + pad(d.getHours()) + + pad(d.getMinutes()) + + pad(d.getSeconds()) + ); +} + +function nowText() { + var d = new Date(); + function pad(n) { return n < 10 ? '0' + n : '' + n; } + return ( + d.getFullYear() + '-' + + pad(d.getMonth() + 1) + '-' + + pad(d.getDate()) + ' ' + + pad(d.getHours()) + ':' + + pad(d.getMinutes()) + ':' + + pad(d.getSeconds()) + ); +} + +function addLog(stage, level, message, detail) { + var row = { + runId: runId, + time: nowText(), + stage: stage, + level: level, + message: message, + detail: detail || '' + }; + logRows.push(row); + + var line = '[' + row.time + '][' + row.stage + '][' + row.level + '] ' + row.message; + if (row.detail) line += ' | ' + row.detail; + console.log(line); +} + +function safeGet(obj, key) { + try { + return obj[key]; + } catch (e) { + return undefined; + } +} + +function pickFirst(obj, keys, fallback) { + for (var i = 0; i < keys.length; i++) { + var v = safeGet(obj, keys[i]); + if (v !== undefined && v !== null && v !== '') { + return v; + } + } + return fallback; +} + +function safeStringify(value) { + try { + return JSON.stringify(value); + } catch (e) { + try { + return String(value); + } catch (e2) { + return ''; + } + } +} + +function normalizeCellText(value) { + if (value === undefined || value === null) return ''; + + var text = ''; + if (typeof value === 'string') { + text = value; + } else if (typeof value === 'number' || typeof value === 'boolean') { + text = String(value); + } else { + text = safeStringify(value); + } + + if (text.length > MAX_JSON_CELL_LENGTH) { + return text.substring(0, MAX_JSON_CELL_LENGTH) + ' ...(truncated)'; + } + return text; +} + +function findSheetByName(sheetName) { + var sheets = Application.Sheets; + var count = sheets.Count; + for (var i = 1; i <= count; i++) { + var s = sheets.Item(i); + if (s.Name === sheetName) return s; + } + return null; +} + +function extractFieldArrayFromGetFields(rawResult) { + if (!rawResult) return []; + if (Array.isArray(rawResult)) return rawResult; + if (rawResult.fields && Array.isArray(rawResult.fields)) return rawResult.fields; + if (rawResult.Fields && Array.isArray(rawResult.Fields)) return rawResult.Fields; + return []; +} + +function snapshotFieldDescriptor(fd) { + return { + Id: pickFirst(fd, ['Id', 'id'], ''), + Name: pickFirst(fd, ['Name', 'name'], ''), + Type: pickFirst(fd, ['Type', 'type'], ''), + Description: pickFirst(fd, ['Description', 'description'], ''), + DefaultVal: pickFirst(fd, ['DefaultVal', 'defaultVal'], ''), + DefaultValType: pickFirst(fd, ['DefaultValType', 'defaultValType'], ''), + NumberFormat: pickFirst(fd, ['NumberFormat', 'numberFormat'], ''), + ValueUnique: pickFirst(fd, ['ValueUnique', 'IsValueUnique'], ''), + SyncField: pickFirst(fd, ['SyncField', 'IsSyncField'], ''), + Width: pickFirst(fd, ['Width', 'width'], ''), + Button: pickFirst(fd, ['Button'], null), + Address: pickFirst(fd, ['Address'], null), + Cascade: pickFirst(fd, ['Cascade'], null), + Contact: pickFirst(fd, ['Contact'], null), + Date: pickFirst(fd, ['Date'], null), + Watch: pickFirst(fd, ['Watch'], null), + Formula: pickFirst(fd, ['Formula'], null), + Lookup: pickFirst(fd, ['Lookup'], null), + Link: pickFirst(fd, ['Link'], null), + Automation: pickFirst(fd, ['Automation'], null), + Attachment: pickFirst(fd, ['Attachment'], null), + Url: pickFirst(fd, ['Url'], null), + Number: pickFirst(fd, ['Number'], null), + Select: pickFirst(fd, ['Select'], null), + Rating: pickFirst(fd, ['Rating'], null) + }; +} + +function chooseRawField(rawFields, descriptorSnap, index) { + if (!rawFields || rawFields.length === 0) return null; + + var id = descriptorSnap.Id; + var name = descriptorSnap.Name; + + for (var i = 0; i < rawFields.length; i++) { + var rf = rawFields[i]; + var rid = pickFirst(rf, ['id', 'Id', 'fieldId', 'FieldId'], ''); + if (id && rid && String(rid) === String(id)) return rf; + } + for (var j = 0; j < rawFields.length; j++) { + var rf2 = rawFields[j]; + var rname = pickFirst(rf2, ['name', 'Name', 'fieldName', 'FieldName'], ''); + if (name && rname && String(rname) === String(name)) return rf2; + } + if (index >= 0 && index < rawFields.length) return rawFields[index]; + return null; +} + +function ensureOutputSheet(sheetName, fields) { + var old = findSheetByName(sheetName); + if (old) { + addLog('准备输出表', 'INFO', '删除旧输出表', sheetName); + try { + old.Delete(); + } catch (eDel) { + addLog('准备输出表', 'WARN', '删除旧输出表失败', sheetName + ' | ' + eDel.message); + } + } + + var createResult = Application.Sheet.CreateSheet({ + Name: sheetName, + Views: [{ name: '默认视图', type: 'Grid' }], + Fields: fields + }); + + var newId = createResult ? createResult.id : ''; + addLog('准备输出表', 'INFO', '已创建输出表', sheetName + ' | SheetId=' + newId); + + try { Time.sleep(300); } catch (eSleep) { } + + var created = findSheetByName(sheetName); + if (!created) { + throw new Error('未找到新创建的输出表: ' + sheetName); + } + return created; +} + +function buildFieldSelectors(fields) { + var selectors = []; + for (var i = 0; i < fields.length; i++) { + selectors.push('@' + fields[i].name); + } + return selectors; +} + +function writeRowsByCellFallback(view, rows, progressStep) { + var total = rows.length; + var step = progressStep || 20; + + for (var i = 0; i < total; i++) { + var row = rows[i]; + var rowNo = i + 1; + try { + for (var col = 0; col < row.length; col++) { + view.RecordRange(rowNo, col + 1).Value = row[col]; + } + } catch (eWrite) { + addLog('写入输出', 'ERROR', '写入行失败', 'row=' + rowNo + ' | ' + eWrite.message); + } + + if ((i + 1) % step === 0 || i === total - 1) { + addLog('写入输出', 'INFO', '写入进度', (i + 1) + '/' + total); + } + } +} + +function getViewRecordCount(view) { + try { + var c = view.RecordRange.Count; + if (c === undefined || c === null || c === '') return 0; + return Number(c) || 0; + } catch (e) { + return 0; + } +} + +function verifyWriteResult(sheet, expectedRows) { + try { + var view = sheet.Views(1); + try { Time.sleep(300); } catch (eSleep1) { } + var count = getViewRecordCount(view); + if (count < expectedRows) { + try { Time.sleep(800); } catch (eSleep2) { } + count = getViewRecordCount(view); + } + return { + ok: count >= expectedRows, + count: count + }; + } catch (e) { + return { + ok: false, + count: 0 + }; + } +} + +function writeRowsToSheet(sheet, fields, rows, progressStep) { + var total = rows.length; + if (total === 0) { + addLog('写入输出', 'INFO', '无数据可写入', sheet.Name); + return; + } + + var view = sheet.Views(1); + var selectors = buildFieldSelectors(fields); + var step = progressStep || 20; + var batchSize = 50; + + try { + // 某些环境下先激活再写入更稳定 + sheet.Activate(); + view.Activate(); + } catch (eActive) { } + + // 方案A: 优先使用 CreateRecords 创建记录(与你现有可用脚本保持一致) + try { + addLog('写入输出', 'INFO', '使用 CreateRecords 批量写入', sheet.Name + ' | rows=' + total); + + for (var crStart = 0; crStart < total; crStart += batchSize) { + var crEnd = crStart + batchSize; + if (crEnd > total) crEnd = total; + + var recordBatch = []; + for (var r = crStart; r < crEnd; r++) { + var oneRow = rows[r]; + var fieldsObj = {}; + for (var c = 0; c < fields.length; c++) { + fieldsObj[fields[c].name] = normalizeCellText(oneRow[c]); + } + recordBatch.push({ fields: fieldsObj }); + } + + var createRes = Application.Record.CreateRecords({ + SheetId: sheet.Id, + Records: recordBatch + }); + + if (createRes && createRes.code !== undefined && createRes.code !== 0) { + var createMsg = pickFirst(createRes, ['Message', 'message'], 'CreateRecords失败'); + throw new Error('code=' + createRes.code + ', message=' + createMsg + ', start=' + (crStart + 1)); + } + + if (crEnd % step === 0 || crEnd === total) { + addLog('写入输出', 'INFO', '写入进度', crEnd + '/' + total); + } + } + + var verifyA = verifyWriteResult(sheet, total); + if (verifyA.ok) { + addLog('写入输出', 'INFO', 'CreateRecords 写入校验通过', sheet.Name + ' | count=' + verifyA.count); + return; + } + addLog('写入输出', 'WARN', 'CreateRecords 写入后记录数不足,回退 SetValues', sheet.Name + ' | count=' + verifyA.count + ', expected=' + total); + } catch (eCreateRecords) { + addLog('写入输出', 'WARN', 'CreateRecords 失败,回退 SetValues', eCreateRecords.message); + } + + // 方案B: SetValues 批量写入 + try { + addLog('写入输出', 'INFO', '使用 SetValues 批量写入', sheet.Name + ' | rows=' + total); + + for (var start = 1; start <= total; start += batchSize) { + var end = start + batchSize - 1; + if (end > total) end = total; + + var chunk = rows.slice(start - 1, end); + var range = null; + var res = null; + + try { + range = view.RecordRange(String(start) + ':' + String(end), selectors); + res = range.SetValues(chunk, true); + } catch (eViewSet) { + // 按官方示例,兼容 Application.RecordRange 方式 + range = Application.RecordRange(String(start) + ':' + String(end), selectors); + res = range.SetValues(chunk, true); + } + + if (res && res.code !== undefined && res.code !== 0) { + var msg = pickFirst(res, ['Message', 'message'], 'SetValues失败'); + throw new Error('code=' + res.code + ', message=' + msg + ', range=' + start + ':' + end); + } + + if (end % step === 0 || end === total) { + addLog('写入输出', 'INFO', '写入进度', end + '/' + total); + } + } + + var verifyB = verifyWriteResult(sheet, total); + if (verifyB.ok) { + addLog('写入输出', 'INFO', 'SetValues 写入校验通过', sheet.Name + ' | count=' + verifyB.count); + return; + } + addLog('写入输出', 'WARN', 'SetValues 写入后记录数不足,回退逐格写入', sheet.Name + ' | count=' + verifyB.count + ', expected=' + total); + } catch (eSetValues) { + addLog('写入输出', 'WARN', 'SetValues 批量写入失败,回退逐格写入', eSetValues.message); + } + + // 方案C: 逐格写入兜底 + try { + writeRowsByCellFallback(view, rows, step); + var verifyC = verifyWriteResult(sheet, total); + if (verifyC.ok) { + addLog('写入输出', 'INFO', '逐格写入校验通过', sheet.Name + ' | count=' + verifyC.count); + return; + } + addLog('写入输出', 'ERROR', '逐格写入后记录数仍不足', sheet.Name + ' | count=' + verifyC.count + ', expected=' + total); + } catch (eFallback) { + addLog('写入输出', 'ERROR', '逐格写入失败', eFallback.message); + } +} + +function pushSchemaRow(obj) { + schemaRows.push([ + obj.runId, + obj.tableName, + obj.sheetId, + obj.fieldIndex, + obj.fieldId, + obj.fieldName, + obj.fieldType, + obj.fieldDescription, + obj.defaultVal, + obj.defaultValType, + obj.numberFormat, + obj.valueUnique, + obj.syncField, + obj.source, + obj.fullDefinitionJson, + obj.rawGetFieldsJson + ]); +} + +// ---------------------------- +// 主流程 +// ---------------------------- +console.log('======================================================'); +console.log('AirScript 完整字段定义导出 + 阶段日志落表'); +console.log('RunId: ' + runId); +console.log('======================================================'); + +addLog('初始化', 'INFO', '脚本启动', '目标表数量=' + TARGET_TABLES.length); + +var targetSheets = []; +for (var t = 0; t < TARGET_TABLES.length; t++) { + var tableName = TARGET_TABLES[t]; + var sheet = findSheetByName(tableName); + if (sheet) { + targetSheets.push(sheet); + addLog('表扫描', 'INFO', '找到目标表', tableName + ' | SheetId=' + sheet.Id); + } else { + addLog('表扫描', 'WARN', '目标表不存在', tableName); + } +} + +addLog('表扫描', 'INFO', '有效目标表统计', String(targetSheets.length)); + +for (var s = 0; s < targetSheets.length; s++) { + var currentSheet = targetSheets[s]; + var currentName = currentSheet.Name; + var currentId = currentSheet.Id; + + addLog('字段采集', 'INFO', '开始采集', currentName + ' | SheetId=' + currentId); + + var rawGetFieldsResult = null; + var rawFields = []; + var getFieldsErr = ''; + + try { + rawGetFieldsResult = Application.Field.GetFields({ SheetId: currentId }); + rawFields = extractFieldArrayFromGetFields(rawGetFieldsResult); + addLog( + '字段采集', + 'INFO', + 'GetFields 成功', + currentName + ' | fields=' + rawFields.length + ); + } catch (eGet) { + getFieldsErr = eGet.message || String(eGet); + addLog('字段采集', 'WARN', 'GetFields 失败', currentName + ' | ' + getFieldsErr); + } + + var descriptors = null; + var descriptorCount = 0; + + try { + descriptors = currentSheet.FieldDescriptors; + descriptorCount = descriptors.Count || 0; + addLog( + '字段采集', + 'INFO', + 'FieldDescriptors 可用', + currentName + ' | count=' + descriptorCount + ); + } catch (eDesc) { + addLog('字段采集', 'ERROR', 'FieldDescriptors 失败', currentName + ' | ' + eDesc.message); + } + + if (descriptorCount > 0) { + for (var i = 1; i <= descriptorCount; i++) { + try { + var fd = descriptors.Item(i); + var snap = snapshotFieldDescriptor(fd); + var rawMatched = chooseRawField(rawFields, snap, i - 1); + + var fullDefObj = { + fromFieldDescriptor: snap, + fromGetFields: rawMatched + }; + + pushSchemaRow({ + runId: runId, + tableName: currentName, + sheetId: String(currentId), + fieldIndex: String(i), + fieldId: normalizeCellText(snap.Id), + fieldName: normalizeCellText(snap.Name), + fieldType: normalizeCellText(snap.Type), + fieldDescription: normalizeCellText(snap.Description), + defaultVal: normalizeCellText(snap.DefaultVal), + defaultValType: normalizeCellText(snap.DefaultValType), + numberFormat: normalizeCellText(snap.NumberFormat), + valueUnique: normalizeCellText(snap.ValueUnique), + syncField: normalizeCellText(snap.SyncField), + source: rawMatched ? 'FieldDescriptors+GetFields' : 'FieldDescriptors', + fullDefinitionJson: normalizeCellText(fullDefObj), + rawGetFieldsJson: normalizeCellText(rawMatched) + }); + } catch (eItem) { + addLog( + '字段采集', + 'ERROR', + '读取字段描述失败', + currentName + ' | index=' + i + ' | ' + eItem.message + ); + } + } + } else if (rawFields.length > 0) { + for (var r = 0; r < rawFields.length; r++) { + var rf = rawFields[r]; + var rfId = pickFirst(rf, ['id', 'Id', 'fieldId', 'FieldId'], ''); + var rfName = pickFirst(rf, ['name', 'Name', 'fieldName', 'FieldName'], ''); + var rfType = pickFirst(rf, ['type', 'Type', 'fieldType', 'FieldType'], ''); + + pushSchemaRow({ + runId: runId, + tableName: currentName, + sheetId: String(currentId), + fieldIndex: String(r + 1), + fieldId: normalizeCellText(rfId), + fieldName: normalizeCellText(rfName), + fieldType: normalizeCellText(rfType), + fieldDescription: '', + defaultVal: '', + defaultValType: '', + numberFormat: '', + valueUnique: '', + syncField: '', + source: 'GetFields', + fullDefinitionJson: normalizeCellText(rf), + rawGetFieldsJson: normalizeCellText(rf) + }); + } + } else { + pushSchemaRow({ + runId: runId, + tableName: currentName, + sheetId: String(currentId), + fieldIndex: '0', + fieldId: '', + fieldName: '(未获取到字段定义)', + fieldType: '', + fieldDescription: getFieldsErr ? 'GetFields错误: ' + getFieldsErr : '', + defaultVal: '', + defaultValType: '', + numberFormat: '', + valueUnique: '', + syncField: '', + source: 'EMPTY', + fullDefinitionJson: '', + rawGetFieldsJson: '' + }); + } + + addLog('字段采集', 'INFO', '完成采集', currentName); +} + +addLog('汇总', 'INFO', '字段记录总数', String(schemaRows.length)); + +var schemaFieldDefs = [ + { name: '执行批次', type: 'MultiLineText' }, + { name: '所属表名', type: 'MultiLineText' }, + { name: 'SheetId', type: 'MultiLineText' }, + { name: '字段序号', type: 'MultiLineText' }, + { name: '字段Id', type: 'MultiLineText' }, + { name: '字段名称', type: 'MultiLineText' }, + { name: '字段类型', type: 'MultiLineText' }, + { name: '字段描述', type: 'MultiLineText' }, + { name: '默认值', type: 'MultiLineText' }, + { name: '默认值类型', type: 'MultiLineText' }, + { name: '数字格式', type: 'MultiLineText' }, + { name: '唯一值', type: 'MultiLineText' }, + { name: '同步字段', type: 'MultiLineText' }, + { name: '定义来源', type: 'MultiLineText' }, + { name: '字段完整定义JSON', type: 'MultiLineText' }, + { name: 'GetFields原始JSON', type: 'MultiLineText' } +]; + +var schemaSheet = ensureOutputSheet(EXPORT_SCHEMA_SHEET_NAME, schemaFieldDefs); + +addLog('写入输出', 'INFO', '开始写入字段定义表', EXPORT_SCHEMA_SHEET_NAME); +writeRowsToSheet(schemaSheet, schemaFieldDefs, schemaRows, 25); +addLog('写入输出', 'INFO', '字段定义表写入完成', EXPORT_SCHEMA_SHEET_NAME); + +// 在写日志表之前先记一条,确保它也能落表 +addLog('写入输出', 'INFO', '准备写入日志表', EXPORT_LOG_SHEET_NAME); + +var logFieldDefs = [ + { name: '执行批次', type: 'MultiLineText' }, + { name: '时间', type: 'MultiLineText' }, + { name: '阶段', type: 'MultiLineText' }, + { name: '级别', type: 'MultiLineText' }, + { name: '消息', type: 'MultiLineText' }, + { name: '明细', type: 'MultiLineText' } +]; + +var logSheet = ensureOutputSheet(EXPORT_LOG_SHEET_NAME, logFieldDefs); + +var logRowsForSheet = []; +for (var l = 0; l < logRows.length; l++) { + var lr = logRows[l]; + logRowsForSheet.push([ + lr.runId, + lr.time, + lr.stage, + lr.level, + lr.message, + lr.detail + ]); +} + +writeRowsToSheet(logSheet, logFieldDefs, logRowsForSheet, 30); + +console.log(''); +console.log('======================================================'); +console.log('导出完成'); +console.log('RunId: ' + runId); +console.log('字段定义表: ' + EXPORT_SCHEMA_SHEET_NAME + ' | 行数=' + schemaRows.length); +console.log('执行日志表: ' + EXPORT_LOG_SHEET_NAME + ' | 行数=' + logRowsForSheet.length); +console.log('======================================================'); diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维数据表格-PRD.md b/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维数据表格-PRD.md index 37d0fd5..fbfeae3 100644 --- a/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维数据表格-PRD.md +++ b/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维数据表格-PRD.md @@ -7,8 +7,8 @@ ### 项目基本信息表 <行业组人员填写> (todo: 需要能够通过项目名称搜索) 1. 项目名称 -2. 行业组人员名称 -3. 行业组人员电话 +2. 行业组接口人 +3. 行业组接口人电话 4. 省份 <下拉选择> 5. 城市 <下拉选择> 6. 部署飞服平台 <选择> @@ -92,11 +92,18 @@ 上面每个中间件都具备如下的属性 1. 是否暴露公网 -2. 公网端口 -3. 内网IP -4. 内网端口 -5. 用户名 -6. 密码 <不允许填写> +2. 公网IP<唯一> +3. 内网IP<唯一> +2. 公网端口A +4. 内网端口A +5. 公网端口B +6. 内网端口B +7. 公网端口C +8. 内网端口C +9. 公网端口D +10. 内网端口D +11. 用户名 +12. 密码 <不允许填写> ### 项目部署业务信息表 <交付部署特战队填写> (todo: 此表如何与项目进行关联) 1. 微服务名称 @@ -129,12 +136,12 @@ ├── 项目部署环境信息表(每台主机一行) ├── 项目部署网络信息表(每次部署一行) ├── 项目部署中间件信息表(每个中间件一行,共7行) - └── 项目部署业务信息表(每个微服务一行) + └── 项目部署业务信息表(每个微服务一行,不同平台的微服务不同) 同时在「项目本地化部署状态表」里对每个子表建立双向关联的反向字段,这样在部署状态表中可以直接看到这条部署关联了哪些主机、哪些中间件 。 项目部署中间件信息表 -├── 所属部署 ← 单向关联字段(→ 部署状态表),这是你的"projectID" +├── 所属部署 ← 单向关联字段(→ 部署状态表) ├── 项目名称 ← 引用字段(从部署状态表引用,只读自动填入) ├── 中间件类型 ← 单选(MySQL / Redis / RabbitMQ / EMQX / NACOS / K8S Dashboard / MINIO) ├── 是否暴露公网 diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维表格-结构.xlsx b/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维表格-结构.xlsx new file mode 100644 index 0000000..6ef6b86 Binary files /dev/null and b/18-基础架构及交付部署特战队/1-项目部署-管理/金山多维表格-结构.xlsx differ diff --git a/18-基础架构及交付部署特战队/1-项目部署-管理/项目部署-台账-排期-管理.md b/18-基础架构及交付部署特战队/1-项目部署-管理/项目部署-台账-排期-管理.md index 2d9d9d9..bb7b46d 100644 --- a/18-基础架构及交付部署特战队/1-项目部署-管理/项目部署-台账-排期-管理.md +++ b/18-基础架构及交付部署特战队/1-项目部署-管理/项目部署-台账-排期-管理.md @@ -25,4 +25,12 @@ [金山多维表格开发文档](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/dbsheet-standard) [AirScript文档](https://airsheet.wps.cn/docs/guide/summary.html) -整理得到一份可以执行落地的API脚本用于创建上述的表格 以及人工需要进行操作补充的相关说明 \ No newline at end of file +整理得到一份可以执行落地的API脚本用于创建上述的表格 以及人工需要进行操作补充的相关说明 + +请你分析,根据金山多维表格的的API文档 +[金山多维表格开发文档](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/dbsheet-standard) +[AirScript文档](https://airsheet.wps.cn/docs/guide/summary.html) + +要求完整的获取关于AirScript的相关文档,如果遇到需要递归的字段和网页 请递归查找 + +需要整理一份离线的,功能完备的,markdown格式的 airscript-spec-doc.md 文件,用于后续的开发参考 \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/0-多维表格开发文档.md b/18-基础架构及交付部署特战队/10-飞书多维表格/0-多维表格开发文档.md new file mode 100644 index 0000000..1ea6123 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/0-多维表格开发文档.md @@ -0,0 +1,39 @@ + +### V1 +你是一名优秀的飞书多维表格开发专家,你非常善于阅读并搜集在线的资料,并根据资料完成开发工作。 + +请你阅读 [飞书多维表格开发文档](https://open.feishu.cn/document/server-docs/docs/bitable-v1/bitable-overview) 将飞书多维表格的开发文档,包含所有子页面,整理成一份完整的参考文档. + +提示:飞书文档页面存在复制页面的button, 可以直接复制为Markdown格式提供给大模型参考,请熟练使用 + +注意: +1. 先拉取完整的开发文档,注意不同子页面之间的关联关系 +2. 后期我会将此部分开发文档制作为AgentSkills +3. 将完整的文档输出到 18-基础架构及交付部署特战队\10-飞书多维表格 目录下 + +### V2 +你完成的很好 + +1. 现在实现的参考文档中,存在大量的在线链接的内容,我希望的是可以完全离线使用的完整文档 +2. 请你将在线内容全部下载到本地,并整理成一份完整的参考文档 +3. 需要将Go SDK的示例代码也一并下载一份 +4. 请研究[飞书API参考文档](https://feishu.apifox.cn/) 将GolangSDK调用的使用说明 也一并写入文档中 + +请你按照上面的要求,重新生成一份完整的参考文档v2版本 + +### V3 +请你详细的阅读飞书的官方文档,完成如下要求的深度研究 +1. 飞书能够实现的功能有哪些 +2. 飞书API接口实现的功能有哪些 +3. 飞书GO SDK能够实现的功能有哪些 +4. 飞书所有的功能是否都支持API接口修改 +5. 飞书能否作为项目协同的前端页面平台 +6. 飞书免费版能否畅快的使用,不受限制 + + +### V4 +使用dds-to-skill技能,你现在需要根据 [飞书多维表格开发文档-完整参考-v2.md](18-基础架构及交付部署特战队\10-飞书多维表格\飞书多维表格开发文档-完整参考-v2.md) 为大模型制作一份可以参考使用的AgentSkills + +要求如下: +1. 输出目录为 18-基础架构及交付部署特战队\10-飞书多维表格 +2. 需要按照AgentSkills的渐进式暴露原则,实现文档的转换 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/GLOBAL-SELF-CHECK.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/GLOBAL-SELF-CHECK.md new file mode 100644 index 0000000..d5e8b23 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/GLOBAL-SELF-CHECK.md @@ -0,0 +1,20 @@ +# 全局自检结果 + +## 结构完整性 +- ✅ S1 PASS: 系统级 Skill = 1 +- ✅ S2 PASS: 模块级 Skills = 6 +- ✅ S3 PASS: 横切 Skills = 4(>=3) +- ✅ S4 PASS: 所有 Skill 含 scripts/verify.sh +- ✅ S5 PASS: 已执行 11 个 verify.sh,全部通过 + +## 内容质量 +- ✅ C1 PASS: 所有 SKILL.md < 500 行 +- ✅ C2 PASS: 所有 SKILL.md 含 Plan/Verify/Execute/Pitfalls +- ✅ C3 PASS: 所有 SKILL.md 动态注入命令 >= 2 + +## Reference 质量 +- ✅ R1 PASS: 所有 Skill reference 含 DDS-Section 与 DDS-Lines +- ✅ R2 PASS: 模块级 Skill 均含 API + 安全/依赖 + [TBD] 缺失标注文件 + +## 总计: 10 PASS / 0 FAIL + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/README.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/README.md new file mode 100644 index 0000000..1bf9000 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/README.md @@ -0,0 +1,58 @@ +# 飞书多维表格 AgentSkills(v2 离线文档转换产物) + +本套 Skills 基于 `飞书多维表格开发文档-完整参考-v2.md` 生成,遵循「渐进式暴露」: + +1. 先进入系统级 Skill 判断变更范围。 +2. 再进入对应模块级 Skill 执行实现/改造。 +3. 叠加横切 Skill 处理契约、鉴权、并发、SDK 接入。 +4. 最后下钻 `reference/` 读取可溯源设计细节(含 DDS 章节与行号)。 + +## Skill 清单(最终命名) + +### 系统级(1) +- `developing-feishu-bitable-system` + +### 模块级(6) +- `developing-bitable-app-metadata` +- `developing-bitable-table-view` +- `developing-bitable-record` +- `developing-bitable-field` +- `developing-bitable-role-member` +- `developing-bitable-event-callback` + +### 横切(4) +- `designing-bitable-contracts` +- `implementing-bitable-auth-access` +- `managing-bitable-write-concurrency` +- `implementing-bitable-go-sdk` + +## 命名候选与选择理由 + +| Skill | 候选名 | 选择 | 理由 | +|---|---|---|---| +| 系统级 | `developing-bitable-system` / `developing-feishu-bitable-system` / `developing-lark-bitable-system` | `developing-feishu-bitable-system` | 同时保留平台域(feishu)和产品域(bitable),检索命中更稳定。 | +| App | `developing-bitable-app` / `developing-bitable-app-metadata` / `developing-bitable-app-core` | `developing-bitable-app-metadata` | 文档对 App 主要是元数据与高级权限开关,`metadata` 语义更准确。 | +| Table/View | `developing-bitable-table` / `developing-bitable-view` / `developing-bitable-table-view` | `developing-bitable-table-view` | 视图严格依附数据表,合并后可减少重复规则。 | +| Record | `developing-bitable-record` / `developing-bitable-row` / `developing-bitable-record-crud` | `developing-bitable-record` | 与 OpenAPI 资源命名一致,便于映射接口。 | +| Field | `developing-bitable-field` / `developing-bitable-schema-field` / `developing-bitable-column` | `developing-bitable-field` | 与文档“字段 Field”章节一致。 | +| Role/Member | `developing-bitable-role` / `developing-bitable-role-member` / `developing-bitable-advanced-permission` | `developing-bitable-role-member` | 将角色与协作者放在同一模块,贴合高级权限操作闭环。 | +| Event/Callback | `developing-bitable-event` / `developing-bitable-event-callback` / `developing-bitable-webhook` | `developing-bitable-event-callback` | 同时覆盖事件与回调两条接入路径。 | +| 契约 | `designing-bitable-contracts` / `designing-bitable-openapi` / `managing-bitable-contracts` | `designing-bitable-contracts` | 以设计导向统一 API/错误码/资源 ID 契约。 | +| 鉴权 | `implementing-bitable-auth` / `implementing-bitable-auth-access` / `managing-bitable-token-auth` | `implementing-bitable-auth-access` | 同时包含 token 与权限模型。 | +| 并发 | `managing-bitable-concurrency` / `managing-bitable-write-concurrency` / `implementing-bitable-retry` | `managing-bitable-write-concurrency` | 明确聚焦写操作并发与幂等。 | +| Go SDK | `implementing-bitable-sdk` / `implementing-bitable-go-sdk` / `developing-bitable-sdk-integration` | `implementing-bitable-go-sdk` | 技术栈指向清晰,避免多语言混淆。 | + +## 目录约定 + +每个 Skill 目录均包含: +- `SKILL.md` +- `reference/`(按章节分层,含 `DDS-Section` + `DDS-Lines`) +- `examples/skeleton.md` +- `scripts/verify.sh` + +## 渐进式使用建议 + +1. 先读 `developing-feishu-bitable-system/SKILL.md`。 +2. 根据变更资源进入对应模块 Skill。 +3. 若涉及跨模块约束,再叠加横切 Skill。 +4. 编码或审查时仅按需展开目标 `reference/*.md`,避免一次性加载全量文档。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/SKILL.md new file mode 100644 index 0000000..f9d7b0c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/SKILL.md @@ -0,0 +1,79 @@ +--- +name: designing-bitable-contracts +description: 统一飞书多维表格 API 契约设计与审查(Guides cross-module contract design for Feishu Bitable)。包含资源 ID 规范、OpenAPI 路径方法、请求响应字段与错误码一致性。触发场景 Trigger: 新增接口、变更字段、排查上下游契约不一致、做跨模块发布评审。关键词 Keywords: contract, openapi, path, error code, app_token, table_id, bitable。 +argument-hint: " - e.g., 'record api add field', 'role api error-code align'" +allowed-tools: + - Read + - Glob + - Grep + - Bash +--- + +# Designing Bitable Contracts + +用于跨模块统一 API 契约,重点防止路径、参数、错误码与资源 ID 在不同模块实现中产生漂移。 + +## Quick Context + +```bash +# 汇总 Bitable 相关接口定义 +!`rg -n "OpenAPI Specification|/bitable/v1/apps|错误码|requestBody|responses" -S . | head -n 150` + +# 扫描资源 ID 使用位置 +!`rg -n "app_token|table_id|view_id|record_id|field_id|role_id|member_id" -S . | head -n 150` +``` + +## Plan + +### 产物清单 +- [ ] 资源 ID 与路径映射表 +- [ ] 请求/响应字段差异清单 +- [ ] 错误码冲突清单 +- [ ] 兼容性评审结论 + +### 决策点 +1. 变更是向后兼容还是破坏性变更? +2. 是否需要引入新错误码或复用现有错误码? +3. 是否影响多模块消费方(SDK、回调、下游服务)? + +## Verify + +### 资源一致性 +- [ ] 资源 ID 语义统一,见 `reference/01-resource-ids/dependencies.md` +- [ ] 路径层级与资源归属无冲突 + +### OpenAPI 一致性 +- [ ] 方法、路径、参数、响应字段对齐 `reference/02-openapi-contract/apis.md` +- [ ] 请求体可选项与默认语义明确 + +### 错误模型一致性 +- [ ] 同错误码语义一致,见 `reference/03-error-model/apis.md` +- [ ] 失败场景有明确排查建议 + +## Execute + +### 1. 建立契约基线 +1. 汇总当前模块接口矩阵。 +2. 锁定资源 ID 与路径层级。 + +### 2. 比较差异 +1. 对请求字段做新增/删除/语义变化对比。 +2. 对响应字段做兼容性对比。 +3. 对错误码做含义冲突检查。 + +### 3. 输出决策 +1. 明确兼容级别(兼容/有条件兼容/不兼容)。 +2. 给出迁移步骤与回滚策略。 + +## Pitfalls + +1. **同一资源使用多个命名**:如 token/id 混用导致歧义,见 `reference/01-resource-ids/dependencies.md`。 +2. **只改请求不改响应示例**:上下游生成代码不一致,见 `reference/02-openapi-contract/apis.md`。 +3. **错误码复用语义冲突**:排障不可控,见 `reference/03-error-model/apis.md`。 + +## Related References + +- `reference/01-resource-ids/dependencies.md` +- `reference/02-openapi-contract/apis.md` +- `reference/03-error-model/apis.md` +- `reference/04-compatibility/state-machine.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/01-resource-ids/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/01-resource-ids/dependencies.md new file mode 100644 index 0000000..d0d3aaa --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/01-resource-ids/dependencies.md @@ -0,0 +1,19 @@ +## 资源 ID 规范 + +- DDS-Section: 接入指南-参数说明 / A.1 概述 +- DDS-Lines: L399-L468, L111-L257 + +### Extract + +| 资源 | ID 字段 | +|---|---| +| App | `app_token` | +| Table | `table_id` | +| View | `view_id` | +| Record | `record_id` | +| Field | `field_id` | +| Role | `role_id` | +| Member | `member_id` | + +规则:ID 应与路径段一一对应,禁止跨资源复用。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/02-openapi-contract/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/02-openapi-contract/apis.md new file mode 100644 index 0000000..6a009b7 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/02-openapi-contract/apis.md @@ -0,0 +1,17 @@ +## OpenAPI 契约骨架 + +- DDS-Section: A.10~A.49 OpenAPI Specification +- DDS-Lines: L1938-L16470 + +### Extract + +- 路径命名统一前缀:`/bitable/v1/apps/{app_token}`。 +- 子资源按层次展开:`tables -> views/records/fields`,`roles -> members`。 +- 请求体和响应体均以标准 JSON schema 描述,含 code/msg/data 包装。 + +## 字段级审查要点 + +- 请求字段是否含示例值与必填标注。 +- 响应字段是否覆盖新增字段。 +- 分页字段 `page_token`/`has_more` 是否一致。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/03-error-model/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/03-error-model/apis.md new file mode 100644 index 0000000..be62912 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/03-error-model/apis.md @@ -0,0 +1,16 @@ +## 错误码模型 + +- DDS-Section: 各 OpenAPI 的错误码章节 +- DDS-Lines: L1957+, L2239+, L2461+, L4723+, L7594+ + +### Extract + +| 类别 | 示例 | +|---|---| +| 参数错误 | `WrongRequestJson`, `WrongRequestBody`, `WrongFieldId` | +| 资源错误 | `WrongBaseToken`, `app_token 不存在` | +| 并发/处理冲突 | `OperationTypeError`、并发写限制 | +| 幂等冲突 | `client token and try again` | + +要求:同错误码在不同模块中保持相同语义与排查动作。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/04-compatibility/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/04-compatibility/state-machine.md new file mode 100644 index 0000000..b9467d1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/reference/04-compatibility/state-machine.md @@ -0,0 +1,15 @@ +## 版本与兼容策略 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未给出正式的 API 版本升级策略(deprecate 生命周期、灰度窗口、双写方案)。 + +### 最小补充信息清单 + +1. 向后兼容判定标准 +2. 破坏性变更发布流程 +3. 旧版本下线时间线 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/designing-bitable-contracts/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/SKILL.md new file mode 100644 index 0000000..6d6c3eb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/SKILL.md @@ -0,0 +1,82 @@ +--- +name: developing-bitable-app-metadata +description: 指导飞书多维表格 App 元数据模块开发(Guides Bitable app metadata module development)。包含获取/更新元数据、高级权限开关、参数与错误码校验。触发场景 Trigger: 新增或修改 app 级配置、切换 advanced permission、排查 app_token 级接口失败。关键词 Keywords: bitable, app, metadata, app_token, advanced permission, 高级权限。 +argument-hint: " - e.g., 'get metadata appbxxx', 'update app name+permission appbxxx'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable App Metadata + +用于处理 `app_token` 级别能力:读取/更新多维表格元数据与高级权限开关,确保调用身份、前置权限、错误码处理一致。 + +## Quick Context + +```bash +# 定位 app 级接口定义与调用处 +!`rg -n "bitable/v1/apps/\{app_token\}|app/update|app/get" -S . | head -n 80` + +# 定位高级权限相关逻辑 +!`rg -n "advanced.*permission|roles|OperationTypeError|app_token" -S . | head -n 80` +``` + +## Plan + +### 产物清单 +- [ ] App 元数据读取与更新调用点 +- [ ] 参数映射(`app_token`, `name`, `is_advanced`) +- [ ] 错误码与重试策略 +- [ ] 权限前置检查 + +### 决策点 +1. 本次更新是仅改名称,还是同时改高级权限开关? +2. 是否接受“非原子更新”带来的部分成功状态? +3. 调用身份选择用户态还是应用态 token? + +## Verify + +### API 契约 +- [ ] 路径与方法与 `reference/02-app-openapi/apis.md` 一致 +- [ ] 请求体字段只包含本次所需字段,避免误改 + +### 权限与鉴权 +- [ ] token 身份与权限范围匹配,见 `reference/03-security/security-model.md` +- [ ] 高级权限开关后续 Role/Member 流程已准备 + +### 风险控制 +- [ ] 已处理接口“先改名后开关权限”的部分成功场景 +- [ ] 对 `app_token` 错误、无访问权限、未开启高级权限错误有明确分支 + +## Execute + +### 1. 读取当前状态 +1. 调用 `GET /bitable/v1/apps/{app_token}`,确认当前名称与权限开关。 +2. 记录变更前快照,作为回滚基线。 + +### 2. 执行更新 +1. 调用 `PUT /bitable/v1/apps/{app_token}`。 +2. 若同时变更多项,先按接口语义评估“部分成功”影响。 +3. 对已知可重试错误(如权限生效延迟)实施有限重试。 + +### 3. 验证结果 +1. 再次读取元数据核对结果。 +2. 若开启高级权限,立即验证 Role/Member 接口是否可用。 + +## Pitfalls + +1. **把元数据更新当作原子事务**:接口本身可能部分成功,先读 `reference/02-app-openapi/apis.md`。 +2. **开启高级权限后立即操作角色失败**:存在生效延迟,见 `reference/03-security/security-model.md`。 +3. **调用身份不匹配**:用户态与应用态 token 混用会造成权限异常,见 `reference/03-security/security-model.md`。 +4. **遗漏 app_token 来源校验**:URL/块信息提取错误会导致全链路失败,见 `reference/01-resource-overview/dependencies.md`。 + +## Related References + +- `reference/01-resource-overview/dependencies.md` +- `reference/02-app-openapi/apis.md` +- `reference/03-security/security-model.md` +- `reference/04-db-schema/db-schema.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/01-resource-overview/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/01-resource-overview/dependencies.md new file mode 100644 index 0000000..2e33498 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/01-resource-overview/dependencies.md @@ -0,0 +1,22 @@ +## App 资源定位与依赖 + +- DDS-Section: 资源:多维表格应用 App / 接入指南-参数说明 app_token +- DDS-Lines: L111-L128, L399-L423 + +### Extract + +| 项 | 内容 | +|---|---| +| 主标识 | `app_token` | +| 获取方式 | 多维表格 URL、文档 block token 拆分、相关 API 返回 | +| 下游依赖 | Table/View/Record/Field/Role/Member 均依赖 `app_token` | + +## 调用链路 + +- DDS-Section: 接入指南-内容 +- DDS-Lines: L294-L303 + +### Extract + +`App -> Table -> (View / Record / Field)`,以及 `App -> Role -> Member`。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/02-app-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/02-app-openapi/apis.md new file mode 100644 index 0000000..6b8fa7c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/02-app-openapi/apis.md @@ -0,0 +1,31 @@ +## 获取多维表格元数据 + +- DDS-Section: A.10 获取多维表格元数据 +- DDS-Lines: L1932-L2205 + +### Extract + +| 方法 | 路径 | 关键参数 | +|---|---|---| +| GET | `/bitable/v1/apps/{app_token}` | `app_token` | + +关键约束: +- 支持 20 QPS(以接口描述为准) +- 错误码含 `WrongBaseToken`、`OperationTypeError` 等 + +## 更新多维表格元数据 + +- DDS-Section: A.11 更新多维表格元数据 +- DDS-Lines: L2206-L2430 + +### Extract + +| 方法 | 路径 | 请求体关键字段 | +|---|---|---| +| PUT | `/bitable/v1/apps/{app_token}` | `name`, `is_advanced` | + +关键约束: +- 接口非原子:先改名,后切换高级权限 +- 写接口常见 10 QPS,且不建议并发写 +- 高级权限开关对后续 Role/Member 接口可用性有直接影响 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/03-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/03-security/security-model.md new file mode 100644 index 0000000..a8e3394 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/03-security/security-model.md @@ -0,0 +1,23 @@ +## token 与访问身份 + +- DDS-Section: 接入指南-鉴权 +- DDS-Lines: L311-L371 + +### Extract + +| 方式 | 适用 | +|---|---| +| `user_access_token` | 用户身份调用 | +| `tenant_access_token` | 应用身份调用 | + +## 高级权限开关前置 + +- DDS-Section: A.7 概述 / A.11 更新多维表格元数据 +- DDS-Lines: L1547-L1561, L2229-L2233, L2286-L2289 + +### Extract + +- 飞书文档/飞书表格/知识库中的多维表格不支持开启高级权限。 +- 开启高级权限存在生效延迟,可能返回 `OperationTypeError`。 +- 发生无访问权限时,应检查高级权限设置中是否为应用主体授权。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/04-db-schema/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/04-db-schema/db-schema.md new file mode 100644 index 0000000..b6711bd --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/reference/04-db-schema/db-schema.md @@ -0,0 +1,15 @@ +## 服务端持久化结构 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未提供 App 元数据在业务系统侧的数据库结构。 + +### 最小补充信息清单 + +1. App 元数据缓存表是否存在(字段与 TTL) +2. 高级权限开关状态是否持久化本地 +3. App 配置变更的审计日志模型 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-app-metadata/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/SKILL.md new file mode 100644 index 0000000..26fc383 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/SKILL.md @@ -0,0 +1,87 @@ +--- +name: developing-bitable-event-callback +description: 指导飞书多维表格事件与回调模块开发(Guides Bitable event and callback integration development)。包含事件类型、长连接/HTTP 回调模式、验签解密参数、3 秒响应与重推去重策略。触发场景 Trigger: 新增事件订阅、接入回调服务、排查重复推送与签名校验失败。关键词 Keywords: event, callback, websocket, webhook, verificationToken, eventEncryptKey, bitable。 +argument-hint: " - e.g., 'websocket bitable_record_changed', 'http callback card action'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable Event & Callback + +用于搭建与维护飞书事件/回调接入通道,统一消息投递语义、幂等消费、验签解密配置与故障处理。 + +## Quick Context + +```bash +# 定位事件处理器、回调路由与 SDK dispatcher +!`rg -n "EventDispatcher|OnP2|OnCustomizedEvent|webhook/event|callback" -S . | head -n 120` + +# 定位 3 秒响应、重推、去重逻辑 +!`rg -n "3 秒|重推|event_id|idempot|retry|verificationToken|eventEncryptKey" -S . | head -n 120` +``` + +## Plan + +### 产物清单 +- [ ] 事件订阅清单与处理器映射 +- [ ] 回调模式(长连接/HTTP)决策 +- [ ] 验签解密配置与密钥管理 +- [ ] 重推去重与失败告警策略 + +### 决策点 +1. 采用长连接模式还是 HTTP 回调模式? +2. 是否开启加密策略(需要 verificationToken/eventEncryptKey)? +3. 幂等去重键是否统一为 `event_id`? + +## Verify + +### 事件契约 +- [ ] 事件类型与字段对齐 `reference/01-event-types/events-topics.md` +- [ ] 处理器注册方法与事件版本匹配(v1/v2) + +### 接入模式 +- [ ] 模式选择与网络前置条件对齐 `reference/02-callback-modes/dependencies.md` +- [ ] HTTP 模式已提供稳定回调地址与快速响应路径 + +### 安全与语义 +- [ ] 验签/解密参数配置对齐 `reference/03-security/security-model.md` +- [ ] 3 秒响应与重推语义对齐 `reference/04-delivery-semantics/state-machine.md` + +## Execute + +### 1. 建立接入通道 +1. 长连接模式:初始化 SDK ws client 并注册 dispatcher。 +2. HTTP 模式:暴露 `/webhook/event` 路由并接入 handler。 + +### 2. 注册事件处理器 +1. 按事件版本选择 `OnCustomizedEvent` 或 `OnP2*` 方法。 +2. 在处理器内抽取 `event_id`, `tenant_key`, 资源 ID。 + +### 3. 落地幂等与超时控制 +1. 处理链路控制在 3 秒内返回 ACK。 +2. 业务处理异步化,核心字段入队。 +3. 以 `event_id` 去重,避免重推重复消费。 + +### 4. 异常处理 +1. 验签/解密失败:快速拒绝并记录上下文。 +2. 下游不可用:入队重试并上报告警。 + +## Pitfalls + +1. **使用错误的事件版本处理器**:v1/v2 结构不同,见 `reference/01-event-types/events-topics.md`。 +2. **处理超时超过 3 秒**:平台会重推,见 `reference/04-delivery-semantics/state-machine.md`。 +3. **开启加密后仍传空密钥**:会导致解密失败,见 `reference/03-security/security-model.md`。 +4. **长连接当广播使用**:实际是集群随机分发,见 `reference/02-callback-modes/dependencies.md`。 + +## Related References + +- `reference/01-event-types/events-topics.md` +- `reference/02-callback-modes/dependencies.md` +- `reference/03-security/security-model.md` +- `reference/04-delivery-semantics/state-machine.md` +- `reference/05-db-schema/db-schema.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/01-event-types/events-topics.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/01-event-types/events-topics.md new file mode 100644 index 0000000..6a3c250 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/01-event-types/events-topics.md @@ -0,0 +1,14 @@ +## Bitable 事件清单 + +- DDS-Section: A.8 多维表格字段变更 / A.9 多维表格记录变更 +- DDS-Lines: L1599-L1712, L1815-L1915 + +### Extract + +| 事件类型 | 场景 | 关键字段 | +|---|---|---| +| `drive.file.bitable_field_changed_v1` | 字段变更 | `event_id`, `event_type`, `table_id`, `field_id` | +| `drive.file.bitable_record_changed_v1` | 记录变更 | `event_id`, `event_type`, `table_id`, `record_id` | + +字段:`tenant_key`, `token`, `subscriber_id_list` 需一并保留用于追踪与授权判定。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/02-callback-modes/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/02-callback-modes/dependencies.md new file mode 100644 index 0000000..5553064 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/02-callback-modes/dependencies.md @@ -0,0 +1,21 @@ +## 回调接入模式 + +- DDS-Section: 3.5 事件与回调处理 / B.4 处理事件 / B.5 处理回调 +- DDS-Lines: L86-L92, L16849-L17083, L17147-L17397 + +### Extract + +| 模式 | 特点 | 前置条件 | +|---|---|---| +| 长连接(WebSocket) | 接入快、免内网穿透、集群非广播 | 运行环境可访问公网 | +| HTTP 回调 | 传统 webhook,平台主动 POST | 需要公网可达地址 | + +## 框架集成 + +- DDS-Section: B.4/B.5 示例代码 +- DDS-Lines: L17028-L17081, L17358-L17397 + +### Extract + +支持原生 HTTP、Gin、Hertz 三类接入方式。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/03-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/03-security/security-model.md new file mode 100644 index 0000000..a8a8661 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/03-security/security-model.md @@ -0,0 +1,14 @@ +## 验签与解密配置 + +- DDS-Section: B.4 处理事件 / B.5 处理回调 +- DDS-Lines: L16980-L17018, L17294-L17316 + +### Extract + +| 参数 | 说明 | +|---|---| +| `verificationToken` | 用于签名验证 | +| `eventEncryptKey` | 用于消息解密 | + +若在开发者后台启用加密策略,则必须传递上述参数。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/04-delivery-semantics/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/04-delivery-semantics/state-machine.md new file mode 100644 index 0000000..61f858d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/04-delivery-semantics/state-machine.md @@ -0,0 +1,16 @@ +## 投递语义状态流 + +- DDS-Section: 事件/回调处理说明 / FAQ +- DDS-Lines: L89, L16871, L17196, L18207-L18209 + +### Extract + +```text +RECEIVED -> ACK(<3s) -> DONE +RECEIVED -> TIMEOUT(>=3s) -> RETRY_PUSH -> DEDUPE_BY_EVENT_ID -> DONE +``` + +规则: +- 必须在 3 秒内完成 ACK。 +- 超时会触发重推,消费侧必须幂等。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/05-db-schema/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/05-db-schema/db-schema.md new file mode 100644 index 0000000..07ae26f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/reference/05-db-schema/db-schema.md @@ -0,0 +1,15 @@ +## 事件存储结构 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未给出事件落库模型(去重表、死信表、重试表)。 + +### 最小补充信息清单 + +1. `event_id` 去重存储 TTL +2. 失败事件重试与死信策略 +3. 事件审计字段定义 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-event-callback/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/SKILL.md new file mode 100644 index 0000000..6ff31a2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/SKILL.md @@ -0,0 +1,86 @@ +--- +name: developing-bitable-field +description: 指导飞书多维表格 Field 模块开发(Guides Bitable field module development)。包含字段 CRUD、字段类型 property 配置、全量更新语义、字段变更事件处理。触发场景 Trigger: 新增/更新/删除字段、扩展字段类型配置、排查 field_id 与 property 不匹配问题。关键词 Keywords: field, field_id, property, option, relation, bitable。 +argument-hint: " - e.g., 'create field appbxxx tblxxx', 'update field property appbxxx tblxxx fldxxx'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable Field + +用于字段资源开发:字段列表与增删改、字段类型 `property` 配置、全量更新风险控制,以及字段变更事件消费。 + +## Quick Context + +```bash +# 定位字段 API 与字段类型处理 +!`rg -n "app-table-field|fields/\{field_id\}|property|options|table_id" -S . | head -n 120` + +# 定位字段事件与幂等逻辑 +!`rg -n "bitable_field_changed|field_changed|client_token|幂等" -S . | head -n 100` +``` + +## Plan + +### 产物清单 +- [ ] Field CRUD 调用封装 +- [ ] 各字段类型 `property` 映射 +- [ ] 更新语义防护(全量覆盖) +- [ ] 字段变更事件消费链路 + +### 决策点 +1. 本次是新增字段还是全量更新字段? +2. 是否涉及关联字段(单向/双向)与跨表依赖? +3. 字段变更是否需要同步下游读写映射? + +## Verify + +### 契约与结构 +- [ ] API 路径、方法对齐 `reference/01-field-openapi/apis.md` +- [ ] 字段类型与 `property` 结构对齐 `reference/02-field-types/db-schema.md` + +### 事件与一致性 +- [ ] 字段变更事件字段对齐 `reference/03-field-events/events-topics.md` +- [ ] 更新后已验证字段列表与读写兼容 + +### 权限 +- [ ] token 与权限范围对齐 `reference/04-security/security-model.md` + +## Execute + +### 1. 字段读取 +1. 先 `list fields` 获取当前字段与类型。 +2. 基于目标类型准备 `property` 请求体。 + +### 2. 字段写操作 +1. 新增字段:调用 `create`,最小化初始属性。 +2. 更新字段:调用 `update` 前先合并旧属性,避免误删。 +3. 删除字段:确认下游表达式/关联/报表依赖后执行。 + +### 3. 关联字段处理 +1. 单向/双向关联字段需显式绑定目标 `table_id`。 +2. 双向关联应检查返回的反向字段信息。 + +### 4. 事件消费 +1. 消费 `bitable_field_changed`。 +2. 以 `event_id` 去重,刷新本地字段缓存。 + +## Pitfalls + +1. **把字段更新当成增量 patch**:接口是全量更新,易误删旧选项,见 `reference/02-field-types/db-schema.md`。 +2. **关联字段只改一侧**:双向关联会产生不一致,见 `reference/02-field-types/db-schema.md`。 +3. **删字段前未清理筛选或公式依赖**:可能导致查询失败,先查 `reference/01-field-openapi/apis.md`。 +4. **字段变更事件重复消费**:需按 event_id 去重,见 `reference/03-field-events/events-topics.md`。 + +## Related References + +- `reference/01-field-openapi/apis.md` +- `reference/02-field-types/db-schema.md` +- `reference/03-field-events/events-topics.md` +- `reference/04-security/security-model.md` +- `reference/05-state-machine/state-machine.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/01-field-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/01-field-openapi/apis.md new file mode 100644 index 0000000..d3007fe --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/01-field-openapi/apis.md @@ -0,0 +1,18 @@ +## Field API 矩阵 + +- DDS-Section: A.37~A.40(列出/新增/更新/删除字段) +- DDS-Lines: L12086-L13934 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields` | 列出字段 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields` | 新增字段 | +| PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}` | 更新字段 | +| DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}` | 删除字段 | + +约束: +- 写接口不建议并发。 +- 常见写接口频控 10 QPS。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/02-field-types/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/02-field-types/db-schema.md new file mode 100644 index 0000000..5b2c8dc --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/02-field-types/db-schema.md @@ -0,0 +1,39 @@ +## 字段基础结构 + +- DDS-Section: A.3 数据结构 / A.5 字段编辑指南 +- DDS-Lines: L571-L580, L719-L738 + +### Extract + +| 字段 | 类型 | 说明 | +|---|---|---| +| `field_id` | string | 字段 ID | +| `field_name` | string | 字段名 | +| `type` | int | 字段类型编码 | +| `property` | object | 类型相关属性 | + +## 关键类型 property + +- DDS-Section: A.5 字段编辑指南(数字、单选/多选、日期、人员、关联、公式、自动编号) +- DDS-Lines: L738-L1344 + +### Extract + +| 类型 | 关键 property | +|---|---| +| 单选/多选 | `options[]` | +| 单向/双向关联 | `table_id`, `table_name`, `back_field_*` | +| 自动编号 | `type`, `options[]`, `rule_option_type` | + +更新语义: +- 字段更新为全量更新,`property` 会被完全覆盖。 + +## DB Schema + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档无后端数据库字段字典表定义(字段元数据持久化)。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/03-field-events/events-topics.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/03-field-events/events-topics.md new file mode 100644 index 0000000..093eed6 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/03-field-events/events-topics.md @@ -0,0 +1,21 @@ +## 字段变更事件 + +- DDS-Section: A.8 多维表格字段变更 +- DDS-Lines: L1595-L1712 + +### Extract + +| 事件类型 | 关键字段 | +|---|---| +| `drive.file.bitable_field_changed_v1` | `event_id`, `event_type`, `tenant_key`, `table_id`, `field_id` | + +## 消费策略 + +- DDS-Section: 事件回调说明 +- DDS-Lines: L89, L18209 + +### Extract + +- 3 秒内响应,否则重推。 +- 建议 `event_id` 去重 + 字段缓存增量刷新。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/04-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/04-security/security-model.md new file mode 100644 index 0000000..edc72c5 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/04-security/security-model.md @@ -0,0 +1,13 @@ +## 字段接口权限模型 + +- DDS-Section: 接入指南-鉴权 / 字段相关 OpenAPI security +- DDS-Lines: L311-L371, L12108+, L12678+, L13147+ + +### Extract + +| 项 | 说明 | +|---|---| +| token | 支持 tenant/user 两种调用身份 | +| 高级权限影响 | 部分无访问权限由高级权限策略导致 | +| 用户标识字段 | 某些字段(如人员)涉及 user_id 权限要求 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/05-state-machine/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/05-state-machine/state-machine.md new file mode 100644 index 0000000..7c9baab --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/reference/05-state-machine/state-machine.md @@ -0,0 +1,15 @@ +## 字段状态机 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未定义字段生命周期状态机(draft/active/deprecated 等)。 + +### 最小补充信息清单 + +1. 字段启用/停用状态定义 +2. 变更审批与回滚流程 +3. 对历史记录的兼容策略 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-field/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/SKILL.md new file mode 100644 index 0000000..2cef4a7 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/SKILL.md @@ -0,0 +1,88 @@ +--- +name: developing-bitable-record +description: 指导飞书多维表格 Record 模块开发(Guides Bitable record module development)。包含记录 CRUD、批量写入、筛选表达式、附件字段协同与变更事件消费。触发场景 Trigger: 新增/更新/删除记录、批量写入、按条件检索、排查 record_id 或 fields 映射问题。关键词 Keywords: record, fields, batch_update, filter, file_token, bitable。 +argument-hint: " - e.g., 'batch_update appbxxx tblxxx', 'get record appbxxx tblxxx recxxx'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable Record + +用于记录资源生命周期开发:单条与批量 CRUD、`fields` 结构映射、筛选表达式、附件字段联动与记录变更事件处理。 + +## Quick Context + +```bash +# 定位记录接口与批量操作 +!`rg -n "app-table-record|records/batch_|/records/\{record_id\}|filter" -S . | head -n 100` + +# 定位幂等键、重试与附件 file_token 处理 +!`rg -n "client_token|幂等|file_token|batch_get_tmp_download_url|OperationTypeError" -S . | head -n 100` +``` + +## Plan + +### 产物清单 +- [ ] 记录 CRUD 与批量接口封装 +- [ ] `fields` 映射层(字段类型到值结构) +- [ ] 幂等与重试控制 +- [ ] 记录变更事件消费逻辑 + +### 决策点 +1. 写入是单条还是批量(最多 500 条)? +2. 是否需要 `client_token` 幂等保护? +3. 是否要同时处理附件上传/下载链路? + +## Verify + +### API 与参数 +- [ ] 路径、方法、分页参数与 `reference/01-record-openapi/apis.md` 对齐 +- [ ] `fields` 结构映射与 `reference/02-record-structure/db-schema.md` 对齐 + +### 事件与幂等 +- [ ] 记录变更事件消费字段对齐 `reference/03-events/events-topics.md` +- [ ] 写接口幂等与重试策略明确(含 UUID client_token) + +### 安全与权限 +- [ ] 鉴权模式、字段级敏感信息权限对齐 `reference/04-security/security-model.md` + +## Execute + +### 1. 读取与检索 +1. 先 `list/get` 获取基线数据和分页状态。 +2. 按需增加筛选表达式,避免全量扫描。 + +### 2. 写入与批量 +1. 单条场景使用 `create/update/delete`。 +2. 批量场景使用 `batch_create/batch_update/batch_delete`,每次不超过 500。 +3. 对写请求设置串行化策略,必要时附 `client_token`。 + +### 3. 附件协同 +1. 先上传素材拿到 `file_token`。 +2. 再写入记录附件字段。 +3. 下载时先从记录读取 `file_token` 再调用下载接口。 + +### 4. 事件消费 +1. 处理 `bitable_record_changed` 事件。 +2. 使用 `event_id` 去重,避免超时重推导致重复处理。 + +## Pitfalls + +1. **批量写超出上限**:单次最多 500 条,见 `reference/01-record-openapi/apis.md`。 +2. **fields 结构硬编码错误**:不同字段类型值结构不同,见 `reference/02-record-structure/db-schema.md`。 +3. **未使用幂等键导致重复写入**:重试场景可能产生重复副作用,见 `reference/01-record-openapi/apis.md`。 +4. **附件流程顺序错误**:必须先拿 file_token 再写记录,见 `reference/02-record-structure/db-schema.md`。 +5. **事件重复消费**:3 秒超时会重推,见 `reference/03-events/events-topics.md`。 + +## Related References + +- `reference/01-record-openapi/apis.md` +- `reference/02-record-structure/db-schema.md` +- `reference/03-events/events-topics.md` +- `reference/04-security/security-model.md` +- `reference/05-state-machine/state-machine.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/01-record-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/01-record-openapi/apis.md new file mode 100644 index 0000000..338669b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/01-record-openapi/apis.md @@ -0,0 +1,23 @@ +## Record API 矩阵 + +- DDS-Section: A.29~A.36(检索/列出/新增/更新/删除/批量) +- DDS-Lines: L7926-L12085 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 检索记录 | +| GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/records` | 列出记录 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records` | 新增记录 | +| PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 更新记录 | +| DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 删除记录 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create` | 批量新增 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update` | 批量更新 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_delete` | 批量删除 | + +关键约束: +- 批量接口单次最多 500。 +- 写接口不建议并发。 +- 部分批量接口支持 `client_token` 幂等。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/02-record-structure/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/02-record-structure/db-schema.md new file mode 100644 index 0000000..c945789 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/02-record-structure/db-schema.md @@ -0,0 +1,34 @@ +## 记录数据结构 + +- DDS-Section: A.3 数据结构(记录/fields/value) +- DDS-Lines: L475-L571 + +### Extract + +| 字段 | 类型 | 说明 | +|---|---|---| +| `record_id` | string | 记录唯一标识 | +| `fields` | map | 字段名到值的映射 | + +`fields` 值结构按字段类型变化(文本、数字、人员、附件、关联等)。 + +## 附件字段协同 + +- DDS-Section: A.6 附件字段说明 +- DDS-Lines: L1370-L1534 + +### Extract + +1. 先调用上传素材接口获取 `file_token`。 +2. 再通过记录写接口将附件写入字段。 +3. 下载时先通过记录读取 `file_token`,再调用下载接口。 + +## 本地 DB Schema + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未给出记录在业务系统持久化时的表结构与索引。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/03-events/events-topics.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/03-events/events-topics.md new file mode 100644 index 0000000..4122919 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/03-events/events-topics.md @@ -0,0 +1,23 @@ +## 记录变更事件 + +- DDS-Section: A.9 多维表格记录变更 +- DDS-Lines: L1811-L1915 + +### Extract + +| 事件 | 说明 | +|---|---| +| `drive.file.bitable_record_changed_v1` | 记录变更事件 | + +关键字段:`event_id`, `event_type`, `tenant_key`, `table_id`, `record_id`。 + +## 投递语义 + +- DDS-Section: 事件与回调处理说明 +- DDS-Lines: L89, L18209 + +### Extract + +- 接收端需在 3 秒内响应,否则重推。 +- 消费端需做基于 `event_id` 的幂等去重。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/04-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/04-security/security-model.md new file mode 100644 index 0000000..fbc5ffb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/04-security/security-model.md @@ -0,0 +1,13 @@ +## Record 接口鉴权 + +- DDS-Section: 接入指南-鉴权 / 记录 API security 声明 +- DDS-Lines: L311-L371, L8529+, L9268+, L9842+ + +### Extract + +| 维度 | 说明 | +|---|---| +| token | `tenant_access_token` 或 `user_access_token` | +| 权限失败 | 高级权限或文档协作者权限未覆盖时会拒绝 | +| ID 字段 | `app_token` + `table_id` + `record_id` 需一致来源 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/05-state-machine/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/05-state-machine/state-machine.md new file mode 100644 index 0000000..4f6e828 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/reference/05-state-machine/state-machine.md @@ -0,0 +1,15 @@ +## 状态机定义 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未定义 Record 业务状态机(状态枚举、转移守卫、补偿动作)。 + +### 最小补充信息清单 + +1. 记录业务状态集合(如 draft/active/archived) +2. 转移触发条件与角色权限 +3. 转移失败补偿策略 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-record/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/SKILL.md new file mode 100644 index 0000000..d34e19d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/SKILL.md @@ -0,0 +1,86 @@ +--- +name: developing-bitable-role-member +description: 指导飞书多维表格高级权限 Role/Member 模块开发(Guides Bitable advanced permission role/member development)。包含角色管理、协作者管理、前置开关检查与权限联动。触发场景 Trigger: 配置高级权限角色、批量增删协作者、排查 role_id/member_id 相关鉴权失败。关键词 Keywords: role, member, advanced permission, role_id, member_id, bitable。 +argument-hint: " - e.g., 'create role appbxxx', 'add members appbxxx rolxxx'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable Role & Member + +用于高级权限域开发:角色(Role)与协作者(Member)的增删改查,及其与元数据开关、文档权限的联动处理。 + +## Quick Context + +```bash +# 定位角色与协作者 API +!`rg -n "app-role|roles/\{role_id\}|role-member|members" -S . | head -n 120` + +# 定位高级权限前置与无权限错误处理 +!`rg -n "is_advanced|OperationTypeError|无访问权限|permission-member" -S . | head -n 100` +``` + +## Plan + +### 产物清单 +- [ ] Role API 封装 +- [ ] Member API 封装(含批量) +- [ ] 高级权限开关前置检查 +- [ ] 权限联动处理(文档权限) + +### 决策点 +1. 当前 app 是否已开启高级权限? +2. 是否需要同时同步云文档协作者权限? +3. 成员操作是否采用批量接口? + +## Verify + +### API 与参数 +- [ ] 角色接口对齐 `reference/01-role-openapi/apis.md` +- [ ] 协作者接口对齐 `reference/02-member-openapi/apis.md` + +### 前置与权限 +- [ ] 开关前置、延迟生效、无权限分支对齐 `reference/03-security/security-model.md` +- [ ] 与文档权限联动策略对齐 `reference/04-dependencies/dependencies.md` + +### 风险控制 +- [ ] 批量操作有容量与失败处理策略 +- [ ] 删除角色前已确认成员迁移或清理方案 + +## Execute + +### 1. 前置检查 +1. 调用 app 元数据接口确认高级权限已开启。 +2. 若未开启,先走 app metadata 更新流程。 + +### 2. 角色管理 +1. `list/create/update/delete role` 按资源策略执行。 +2. 变更后回读角色详情,校验权限范围。 + +### 3. 协作者管理 +1. 通过 `list/create/delete` 或批量接口维护成员。 +2. 视场景同步云文档权限,避免“高级权限已加但文档无权限”。 + +### 4. 错误恢复 +1. 对延迟生效错误(`OperationTypeError`)实施短周期重试。 +2. 对权限缺失错误直接中止并返回修复建议。 + +## Pitfalls + +1. **未开启高级权限就调用 Role/Member**:必然失败,见 `reference/03-security/security-model.md`。 +2. **只加高级权限不加文档权限**:用户仍可能不可访问,见 `reference/04-dependencies/dependencies.md`。 +3. **角色删除前未迁移成员**:造成权限漂移,需先清理成员,见 `reference/02-member-openapi/apis.md`。 +4. **忽略开启延迟**:开关后立即调用可能报错,见 `reference/03-security/security-model.md`。 + +## Related References + +- `reference/01-role-openapi/apis.md` +- `reference/02-member-openapi/apis.md` +- `reference/03-security/security-model.md` +- `reference/04-dependencies/dependencies.md` +- `reference/05-db-schema/db-schema.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/01-role-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/01-role-openapi/apis.md new file mode 100644 index 0000000..85ac239 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/01-role-openapi/apis.md @@ -0,0 +1,18 @@ +## Role API 矩阵 + +- DDS-Section: A.41~A.44(列出/新增/删除/更新自定义角色) +- DDS-Lines: L13935-L15372 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| GET | `/bitable/v1/apps/{app_token}/roles` | 列出角色 | +| POST | `/bitable/v1/apps/{app_token}/roles/{role_id}` | 新增角色 | +| DELETE | `/bitable/v1/apps/{app_token}/roles/{role_id}` | 删除角色 | +| PUT | `/bitable/v1/apps/{app_token}/roles/{role_id}` | 更新角色 | + +约束: +- 角色接口依赖高级权限开启。 +- 写操作建议串行处理。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/02-member-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/02-member-openapi/apis.md new file mode 100644 index 0000000..7045da5 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/02-member-openapi/apis.md @@ -0,0 +1,15 @@ +## Member API 矩阵 + +- DDS-Section: A.45~A.49(批量删/批量增/列出/新增/删除协作者) +- DDS-Lines: L15373-L16470 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_delete` | 批量删除协作者 | +| POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_create` | 批量新增协作者 | +| GET | `/bitable/v1/apps/{app_token}/roles/{role_id}/members` | 列出协作者 | +| POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members` | 新增协作者 | +| DELETE | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/{member_id}` | 删除协作者 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/03-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/03-security/security-model.md new file mode 100644 index 0000000..d1c31e2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/03-security/security-model.md @@ -0,0 +1,13 @@ +## 高级权限前置与异常 + +- DDS-Section: A.7 概述 / A.11 更新元数据 +- DDS-Lines: L1547-L1565, L2229-L2233, L2286-L2289 + +### Extract + +| 规则 | 说明 | +|---|---| +| 开关前置 | Role/Member 调用前必须开启高级权限 | +| 生效延迟 | 开启后短时可能报 `OperationTypeError` | +| 无权限 | 需在高级权限中加入包含应用的群并授予读写 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/04-dependencies/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/04-dependencies/dependencies.md new file mode 100644 index 0000000..01a663d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/04-dependencies/dependencies.md @@ -0,0 +1,19 @@ +## 权限联动依赖 + +- DDS-Section: A.7 概述 +- DDS-Lines: L1559-L1561 + +### Extract + +- 高级权限协作者与云文档协作者是两套身份体系。 +- 新增高级权限协作者后,建议通过 drive 权限接口同步文档权限。 + +## 上下游依赖 + +- DDS-Section: 接入指南-内容 +- DDS-Lines: L294-L303 + +### Extract + +`App(is_advanced=true) -> Role -> Member`。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/05-db-schema/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/05-db-schema/db-schema.md new file mode 100644 index 0000000..44b03c1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/reference/05-db-schema/db-schema.md @@ -0,0 +1,15 @@ +## 权限域数据库结构 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未描述 Role/Member 在业务侧持久化结构与审计表。 + +### 最小补充信息清单 + +1. 角色权限项结构与版本字段 +2. 成员-角色关系表唯一键 +3. 权限变更审计日志表 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-role-member/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/SKILL.md new file mode 100644 index 0000000..e72a1e6 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/SKILL.md @@ -0,0 +1,83 @@ +--- +name: developing-bitable-table-view +description: 指导飞书多维表格 Table 与 View 模块开发(Guides Bitable table and view module development)。包含数据表管理、视图管理、分页与错误处理、写接口并发约束。触发场景 Trigger: 新增/删除数据表、创建/删除视图、调整视图属性、排查 table_id/view_id 相关错误。关键词 Keywords: table, view, table_id, view_id, bitable, openapi。 +argument-hint: " - e.g., 'create table appbxxx', 'delete view tblxxx vewxxx'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Developing Bitable Table & View + +聚焦 `table_id` 与 `view_id` 资源生命周期,包括列表、创建、删除、更新,以及上游 App 与下游 Record/Field 的依赖影响。 + +## Quick Context + +```bash +# 定位表和视图相关接口 +!`rg -n "app-table|tables/\{table_id\}|views|app-table-view" -S . | head -n 100` + +# 定位写接口并发与限流防护逻辑 +!`rg -n "QPS|batch|并发|OperationTypeError|retry|client_token" -S . | head -n 80` +``` + +## Plan + +### 产物清单 +- [ ] Table API 调用点与参数封装 +- [ ] View API 调用点与参数封装 +- [ ] 分页遍历/幂等/重试策略 +- [ ] 资源删除后的下游影响评估 + +### 决策点 +1. 是否需要批量建表/删表能力? +2. 视图变更是否影响既有筛选与展示语义? +3. 是否有并发写风险(同 app 同时发多个写请求)? + +## Verify + +### API 对齐 +- [ ] Table 接口路径与方法对齐 `reference/02-table-openapi/apis.md` +- [ ] View 接口路径与方法对齐 `reference/03-view-openapi/apis.md` + +### 约束检查 +- [ ] QPS、并发写限制已按 `reference/02-table-openapi/apis.md` 与 `reference/03-view-openapi/apis.md` 落地 +- [ ] 删除类操作前已验证依赖关系(Record/Field/业务视图) + +### 安全检查 +- [ ] token 模式与权限范围匹配,见 `reference/04-security/security-model.md` + +## Execute + +### 1. 数据表操作 +1. 先 `list tables` 确认目标是否已存在。 +2. 执行 `create / batch_create / delete / batch_delete`。 +3. 对写请求串行化,避免同 app 并发写。 + +### 2. 视图操作 +1. 先 `list views` 获取目标 `view_id`。 +2. 执行 `create / update / delete / get`。 +3. 修改后做一次读取回放,确认属性生效。 + +### 3. 失败处理 +1. 对参数类错误立即失败并回传上下文。 +2. 对可恢复错误(冲突、短暂不可用)使用有限重试。 + +## Pitfalls + +1. **删除表前未处理下游依赖**:Record/Field/业务配置悬空,先看 `reference/01-resource-model/dependencies.md`。 +2. **同一 app 并发写表/视图**:会触发并发写限制,先看 `reference/02-table-openapi/apis.md`。 +3. **view_id 获取方式错误**:不同形态下取值路径不同,先看 `reference/01-resource-model/dependencies.md`。 +4. **分页处理缺失**:list 接口有 `page_token`,漏处理会丢数据,见 `reference/02-table-openapi/apis.md`。 + +## Related References + +- `reference/01-resource-model/dependencies.md` +- `reference/02-table-openapi/apis.md` +- `reference/03-view-openapi/apis.md` +- `reference/04-security/security-model.md` +- `reference/05-db-schema/db-schema.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/01-resource-model/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/01-resource-model/dependencies.md new file mode 100644 index 0000000..6f80160 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/01-resource-model/dependencies.md @@ -0,0 +1,16 @@ +## 资源关系 + +- DDS-Section: 资源:数据表 Table / 资源:视图 View / 接入指南-参数说明 +- DDS-Lines: L130-L170, L442-L452 + +### Extract + +| 资源 | 标识 | 关系 | +|---|---|---| +| Table | `table_id` | 归属 `app_token` | +| View | `view_id` | 归属 `table_id` | + +获取建议: +- `table_id` 可通过列出数据表接口获取。 +- `view_id` 可通过列出视图接口获取(部分场景不可直接从 doc block 得到)。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/02-table-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/02-table-openapi/apis.md new file mode 100644 index 0000000..3a1cbea --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/02-table-openapi/apis.md @@ -0,0 +1,20 @@ +## 数据表接口矩阵 + +- DDS-Section: A.12~A.17(更新/列出/新增/批量新增/删除/批量删除数据表) +- DDS-Lines: L2431-L4013 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}` | 更新数据表 | +| GET | `/bitable/v1/apps/{app_token}/tables` | 列出数据表 | +| POST | `/bitable/v1/apps/{app_token}/tables` | 新增数据表 | +| POST | `/bitable/v1/apps/{app_token}/tables/batch_create` | 批量新增 | +| DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}` | 删除数据表 | +| POST | `/bitable/v1/apps/{app_token}/tables/batch_delete` | 批量删除 | + +约束: +- 写接口常见 10 QPS;读接口常见 20 QPS。 +- 不支持并发写接口。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/03-view-openapi/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/03-view-openapi/apis.md new file mode 100644 index 0000000..0ec5aae --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/03-view-openapi/apis.md @@ -0,0 +1,19 @@ +## 视图接口矩阵 + +- DDS-Section: A.20~A.24(更新/检索/列出/新增/删除视图) +- DDS-Lines: L4700-L6501 + +### Extract + +| 方法 | 路径 | 说明 | +|---|---|---| +| PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 更新视图 | +| GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 检索视图 | +| GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/views` | 列出视图 | +| POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/views` | 新增视图 | +| DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 删除视图 | + +约束: +- 写接口不建议并发。 +- 出现计算超时类错误时可按文档建议重试。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/04-security/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/04-security/security-model.md new file mode 100644 index 0000000..6c0ebe8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/04-security/security-model.md @@ -0,0 +1,13 @@ +## 鉴权与权限 + +- DDS-Section: 接入指南-鉴权 / 各接口 security 定义 +- DDS-Lines: L311-L371, L2458+, L5575+ + +### Extract + +| 维度 | 说明 | +|---|---| +| token 类型 | `tenant_access_token` / `user_access_token` | +| 权限异常 | 无访问权限常见于高级权限配置未覆盖应用主体 | +| 额外要求 | 商店应用场景需关注 `tenant_key` | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/05-db-schema/db-schema.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/05-db-schema/db-schema.md new file mode 100644 index 0000000..f326a1c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/reference/05-db-schema/db-schema.md @@ -0,0 +1,15 @@ +## 本地持久化结构 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未提供 Table/View 在业务系统落地时的数据库结构定义。 + +### 最小补充信息清单 + +1. 表视图缓存模型(主键、唯一键) +2. 软删除或硬删除策略 +3. 变更审计字段与索引 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-bitable-table-view/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/SKILL.md new file mode 100644 index 0000000..3f05779 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/SKILL.md @@ -0,0 +1,114 @@ +--- +name: developing-feishu-bitable-system +description: 指导飞书多维表格系统级开发与跨模块一致性(Guides system-level development for Feishu Bitable)。包含模块边界、全局约束、鉴权模型、事件交付和变更路由。触发场景 Trigger: 跨模块改造、资源模型调整、接口策略统一、事件接入方案选择。关键词 Keywords: feishu, bitable, system, architecture, app, table, record, field, role, event, callback。 +argument-hint: " - e.g., 'record+field add batch update', 'role enable advanced permission'" +allowed-tools: + - Read + - Glob + - Grep + - Bash +--- + +# Developing Feishu Bitable System + +用于统一飞书多维表格的系统级决策:先判定变更影响域,再路由到对应模块 Skill,并叠加横切约束(契约、鉴权、并发、SDK)。 + +## Quick Context + +```bash +# 扫描仓库中的 Bitable 资源路径与调用热点 +!`rg -n "bitable/v1/apps|tables|views|records|fields|roles|members" -S . | head -n 80` + +# 扫描鉴权与事件接入相关实现 +!`rg -n "WithUserAccessToken|WithTenantAccessToken|WithTenantKey|EventDispatcher|verificationToken|eventEncryptKey" -S . | head -n 80` +``` + +## Architecture Overview + +```text +Client/Job + -> App Metadata + -> Table/View + -> Record + -> Field + -> Role/Member (advanced permission) + -> Event/Callback Inbound +Cross-cut: Contracts / Auth / Write-Concurrency / Go SDK +``` + +## Module Registry + +| 模块 | 职责 | 对应 Skill | +|---|---|---| +| App Metadata | app 元数据与高级权限开关 | `developing-bitable-app-metadata` | +| Table & View | 数据表与视图管理 | `developing-bitable-table-view` | +| Record | 记录 CRUD 与批量操作 | `developing-bitable-record` | +| Field | 字段定义、类型与属性变更 | `developing-bitable-field` | +| Role & Member | 高级权限角色与协作者 | `developing-bitable-role-member` | +| Event & Callback | 事件订阅、回调处理、3 秒响应约束 | `developing-bitable-event-callback` | + +## Plan + +### 产物清单 +- [ ] 变更影响模块清单(主模块 + 受影响模块) +- [ ] 需要叠加的横切 Skill 清单 +- [ ] 契约变更面(路径/字段/错误码/权限) +- [ ] 风险与回滚点(重点是写并发和幂等) + +### 决策点 +1. 变更是否跨越两个及以上资源模块? +2. 是否触及写接口(需执行串行化与幂等策略)? +3. 是否涉及高级权限开关或角色策略? +4. 是否需要事件/回调通道而非轮询读取? + +## Verify + +### 架构边界 +- [ ] 变更只在目标模块内落地,跨模块依赖已在 `reference/01-architecture-overview/dependencies.md` 对齐 +- [ ] 新增能力没有绕过 App/Table 资源层级 + +### 全局约束 +- [ ] QPS 与批量上限已对齐 `reference/02-global-constraints/apis.md` +- [ ] 写接口并发冲突风险已评估并规避(串行或幂等键) + +### 安全与权限 +- [ ] token 模式与调用身份已对齐 `reference/03-auth-and-permissions/security-model.md` +- [ ] 高级权限开启前置条件与延迟影响已覆盖 + +### 事件与回调 +- [ ] 事件订阅/回调路径满足 3 秒响应约束,见 `reference/04-event-delivery/events-topics.md` + +## Execute + +### 1. 识别变更类型 +1. 标注主资源:`app/table/view/record/field/role/member/event`。 +2. 判断是否含写操作:`create/update/delete/batch_*`。 +3. 判断是否含权限变化:高级权限开关、角色或协作者变更。 + +### 2. 路由到模块 Skill +1. 单模块改动:直接进入对应模块 Skill。 +2. 跨模块改动:按调用链顺序执行(上游契约先变更、下游消费后变更)。 +3. 若涉及 SDK 接入方式或调用风格,叠加 `implementing-bitable-go-sdk`。 + +### 3. 叠加横切校验 +1. 契约:执行 `designing-bitable-contracts` 检查路径、参数、错误码。 +2. 鉴权:执行 `implementing-bitable-auth-access` 检查 token 与权限。 +3. 并发:执行 `managing-bitable-write-concurrency` 检查 QPS、幂等、重试。 + +### 4. 输出变更包 +1. 给出变更影响矩阵(模块 × 接口 × 权限 × 风险)。 +2. 明确灰度步骤与回滚触发条件。 + +## Pitfalls + +1. **把 Role/Member 当作普通 CRUD 资源处理**:高级权限开关未完成时直接调用会失败,先查 `reference/03-auth-and-permissions/security-model.md`。 +2. **多写接口并发提交**:文档明确不支持并发写接口,需先查 `reference/02-global-constraints/apis.md`。 +3. **事件通道没有 3 秒响应保障**:会触发重推与重复消费,先查 `reference/04-event-delivery/events-topics.md`。 +4. **跨模块修改只改调用方不改契约源**:导致路径或字段漂移,先对照 `reference/01-architecture-overview/dependencies.md`。 + +## Related References + +- `reference/01-architecture-overview/dependencies.md`:资源层次、模块依赖、调用链 +- `reference/02-global-constraints/apis.md`:QPS、批量上限、写并发、幂等约束 +- `reference/03-auth-and-permissions/security-model.md`:token 模型与高级权限前置条件 +- `reference/04-event-delivery/events-topics.md`:事件体、回调模式、重推约束 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/01-architecture-overview/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/01-architecture-overview/dependencies.md new file mode 100644 index 0000000..10d9e6a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/01-architecture-overview/dependencies.md @@ -0,0 +1,30 @@ +## 资源分层与模块边界 + +- DDS-Section: A.1 概述 / A.2 接入指南(形态、内容) +- DDS-Lines: L111-L257, L272-L303 + +### Extract + +| 层级 | 资源 | 核心标识 | 说明 | +|---|---|---|---| +| L1 | App | `app_token` | 多维表格应用根资源 | +| L2 | Table | `table_id` | App 下的数据容器 | +| L2 | Role | `role_id` | App 下高级权限角色 | +| L3 | View | `view_id` | Table 下视图 | +| L3 | Record | `record_id` | Table 下记录 | +| L3 | Field | `field_id` | Table 下字段 | +| L3 | Member | `member_id` | Role 下协作者 | + +## 跨模块依赖链路 + +- DDS-Section: A.2 接入指南 / A.6 附件字段说明 / A.7 高级权限概述 +- DDS-Lines: L302-L303, L1410-L1534, L1547-L1588 + +### Extract + +| 源模块 | 目标模块 | 协议/接口 | 依赖说明 | +|---|---|---|---| +| Record | Drive Media | upload/download API | 附件字段依赖 file_token | +| RoleMember | Drive Permission | permission-member/create | 高级权限协作者建议同步文档权限 | +| EventCallback | 业务模块 | WebSocket/HTTP callback | 事件回调驱动记录或字段消费逻辑 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/02-global-constraints/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/02-global-constraints/apis.md new file mode 100644 index 0000000..57fad43 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/02-global-constraints/apis.md @@ -0,0 +1,38 @@ +## 全局频控与批量约束 + +- DDS-Section: 接入指南-限制 / 各 OpenAPI Specification 描述 +- DDS-Lines: L377-L384, L1954+, L2233+, L2635+, L8529+, L10629+ + +### Extract + +| 规则 | 约束 | +|---|---| +| QPS | 多数读接口 20 QPS,写接口常见 10 QPS(以具体接口描述为准) | +| 批量记录操作 | 单次最多 500 条(batch create/update/delete) | +| 批量结果 | 接口语义为整体成功或失败,不提供部分成功结果 | + +## 写并发与幂等 + +- DDS-Section: 接入指南注意事项 / 各接口错误码说明 +- DDS-Lines: L309, L2067+, L3050+, L3339+, L9483+, L10847+, L12965+ + +### Extract + +| 规则 | 说明 | +|---|---| +| 写并发 | 同一多维表格不建议并发调用写接口 | +| 幂等键 | 部分写接口支持 `client_token`,要求 UUID 格式 | +| 幂等冲突 | 发生冲突时需重生成幂等键再重试 | + +## DB Schema + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未给出服务端数据库表结构、索引、迁移策略。若需要落地后端存储,请补充: +1. 业务表与映射表 DDL +2. 索引与唯一键策略 +3. 迁移与回滚方案 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/03-auth-and-permissions/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/03-auth-and-permissions/security-model.md new file mode 100644 index 0000000..e574e5e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/03-auth-and-permissions/security-model.md @@ -0,0 +1,27 @@ +## token 鉴权模型 + +- DDS-Section: 接入指南-鉴权 / Golang SDK 调用说明 +- DDS-Lines: L311-L371, L39-L41, L67-L69, L16503 + +### Extract + +| 身份 | token | 说明 | +|---|---|---| +| 用户身份 | `user_access_token` | 用户态调用,刷新后旧 token 失效 | +| 应用身份 | `tenant_access_token` | 应用态调用,SDK 可托管生命周期 | +| 商店应用补充 | `tenant_key` | ISV 场景调用需显式传入 | + +## 高级权限模型 + +- DDS-Section: A.7 概述 / 更新多维表格元数据 +- DDS-Lines: L1547-L1565, L2226-L2233, L2286-L2289 + +### Extract + +| 规则 | 说明 | +|---|---| +| 开启前置 | 调用 Role/Member 接口前需先开启高级权限 | +| 延迟生效 | 开启后短时间可能返回 `OperationTypeError`,需重试 | +| 权限联动 | 高级权限协作者与云文档协作者不同,必要时同步文档权限 | +| 非原子更新 | 更新元数据接口先改名称再开关权限,可能部分成功 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/04-event-delivery/events-topics.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/04-event-delivery/events-topics.md new file mode 100644 index 0000000..44a8f92 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/reference/04-event-delivery/events-topics.md @@ -0,0 +1,38 @@ +## Bitable 事件定义 + +- DDS-Section: A.8 多维表格字段变更 / A.9 多维表格记录变更 +- DDS-Lines: L1599-L1712, L1815-L1915 + +### Extract + +| 事件类型 | 关键字段 | +|---|---| +| `drive.file.bitable_field_changed_v1` | `event_id`, `event_type`, `tenant_key`, `table_id`, `field_id` | +| `drive.file.bitable_record_changed_v1` | `event_id`, `event_type`, `tenant_key`, `table_id`, `record_id` | + +## 回调交付约束 + +- DDS-Section: Golang SDK-处理事件 / 处理回调 +- DDS-Lines: L89, L16853-L16873, L17196-L17263, L18209 + +### Extract + +| 约束 | 说明 | +|---|---| +| 响应时限 | 接收端需在 3 秒内响应,否则会触发重推 | +| 长连接模式 | SDK 支持 WebSocket 长连接;集群模式非广播 | +| HTTP 回调模式 | 需公网地址,接收 POST 推送 | +| 验签/解密 | 若启用加密策略需提供 `verificationToken` 与 `eventEncryptKey` | + +## 消费幂等 + +- DDS-Section: 事件与回调说明 +- DDS-Lines: L1706, L1846, L18209 + +### Extract + +| 建议 | 原因 | +|---|---| +| 以 `event_id` 做去重 | 重推场景下避免重复处理 | +| 记录 `tenant_key + resource_id` | 多租户隔离与重放定位 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/developing-feishu-bitable-system/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/SKILL.md new file mode 100644 index 0000000..a3b8982 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/SKILL.md @@ -0,0 +1,84 @@ +--- +name: implementing-bitable-auth-access +description: 指导飞书多维表格鉴权与访问控制实现(Guides authentication and access control for Feishu Bitable)。包含 tenant/user token 选择、商店应用 tenant_key、高级权限开关与协作者联动。触发场景 Trigger: 鉴权失败排查、身份模式切换、权限策略改造、Role/Member 接口不可用问题。关键词 Keywords: auth, access, tenant_access_token, user_access_token, tenant_key, advanced permission。 +argument-hint: " - e.g., 'tenant token app-level api', 'role-member no-permission'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Implementing Bitable Auth & Access + +用于统一 Bitable 的鉴权和权限控制实现,确保调用身份、token 生命周期和高级权限策略在跨模块场景下保持一致。 + +## Quick Context + +```bash +# 扫描 token 与身份调用代码 +!`rg -n "WithUserAccessToken|WithTenantAccessToken|WithTenantKey|tenant_access_token|user_access_token" -S . | head -n 120` + +# 扫描高级权限开关与无权限处理 +!`rg -n "is_advanced|OperationTypeError|无访问权限|roles|members" -S . | head -n 120` +``` + +## Plan + +### 产物清单 +- [ ] 身份模式选择矩阵(user/tenant) +- [ ] token 获取、刷新、缓存策略 +- [ ] 高级权限前置校验 +- [ ] 权限异常处理流程 + +### 决策点 +1. 场景是否必须用户身份(user token)? +2. 是否为商店应用,需要补 `tenant_key`? +3. 是否涉及高级权限域(Role/Member)? + +## Verify + +### token 模型 +- [ ] token 类型选择与接口权限匹配,见 `reference/01-token-model/security-model.md` +- [ ] user token 刷新后旧 token 失效逻辑已处理 + +### 高级权限 +- [ ] app 高级权限开关前置检查已落地,见 `reference/02-advanced-permission/security-model.md` +- [ ] Role/Member 与文档协作者权限联动策略已覆盖 + +### SDK 选项 +- [ ] SDK 请求级 auth 选项使用正确,见 `reference/03-sdk-auth-options/dependencies.md` + +## Execute + +### 1. 身份选择 +1. 先按接口需求判断 user/tenant 身份。 +2. 商店应用场景补传 `tenant_key`。 + +### 2. token 生命周期 +1. tenant token 优先使用 SDK 托管缓存。 +2. user token 自建刷新与失效处理。 + +### 3. 权限联动 +1. 高级权限接口前确认 `is_advanced=true`。 +2. 必要时同步云文档权限协作者。 + +### 4. 错误收敛 +1. 将鉴权失败细分为:身份不匹配、token 失效、权限未开通。 +2. 每类返回明确修复动作。 + +## Pitfalls + +1. **把 user token 当 tenant token 用**:调用语义错误,见 `reference/01-token-model/security-model.md`。 +2. **商店应用漏传 tenant_key**:跨租户调用失败,见 `reference/03-sdk-auth-options/dependencies.md`。 +3. **高级权限未开启就调角色接口**:直接失败,见 `reference/02-advanced-permission/security-model.md`。 +4. **只配高级权限不配文档权限**:用户仍无访问权,见 `reference/02-advanced-permission/security-model.md`。 + +## Related References + +- `reference/01-token-model/security-model.md` +- `reference/02-advanced-permission/security-model.md` +- `reference/03-sdk-auth-options/dependencies.md` +- `reference/04-session-lifecycle/state-machine.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/01-token-model/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/01-token-model/security-model.md new file mode 100644 index 0000000..224e69e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/01-token-model/security-model.md @@ -0,0 +1,17 @@ +## 身份与 token 模型 + +- DDS-Section: 接入指南-鉴权 +- DDS-Lines: L311-L371 + +### Extract + +| 身份 | token | 语义 | +|---|---|---| +| 用户身份 | `user_access_token` | 刷新后旧 token 失效 | +| 应用身份 | `tenant_access_token` | 有效期 2 小时,可刷新并短时新旧并存 | + +## token 选择建议 + +- 用户行为归因场景优先 user token。 +- 平台级批处理场景优先 tenant token。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/02-advanced-permission/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/02-advanced-permission/security-model.md new file mode 100644 index 0000000..620d587 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/02-advanced-permission/security-model.md @@ -0,0 +1,13 @@ +## 高级权限访问模型 + +- DDS-Section: A.7 概述 / A.11 更新元数据 +- DDS-Lines: L1547-L1561, L2229-L2233, L2286-L2289 + +### Extract + +| 规则 | 说明 | +|---|---| +| 前置开关 | `is_advanced` 未开启时 Role/Member 不可用 | +| 生效延迟 | 开启后可能短时返回 `OperationTypeError` | +| 权限联动 | 高级权限协作者与文档协作者是两套体系 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/03-sdk-auth-options/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/03-sdk-auth-options/dependencies.md new file mode 100644 index 0000000..d1a8e2e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/03-sdk-auth-options/dependencies.md @@ -0,0 +1,16 @@ +## SDK 鉴权选项 + +- DDS-Section: 3.3 请求级选项 / B.3 调用服务端 API +- DDS-Lines: L65-L72, L16706-L16722 + +### Extract + +| 选项 | 用途 | +|---|---| +| `WithUserAccessToken(...)` | 用户态调用 | +| `WithTenantAccessToken(...)` | 手动传租户 token | +| `WithTenantKey(...)` | 商店应用指定租户 | +| `WithHeaders(...)` | 透传自定义头 | + +SDK 可托管 tenant token 生命周期,但不托管 user token 生命周期。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/04-session-lifecycle/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/04-session-lifecycle/state-machine.md new file mode 100644 index 0000000..2de889e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/reference/04-session-lifecycle/state-machine.md @@ -0,0 +1,15 @@ +## 会话/令牌状态机 + +- DDS-Section: 全文 +- DDS-Lines: L1-L18211 + +### Extract + +[TBD] 文档未给出统一的 token 状态机与失效传播规范。 + +### 最小补充信息清单 + +1. user token 刷新触发条件与缓存失效策略 +2. tenant token 刷新提前量与失败降级策略 +3. 多实例 token 缓存一致性策略 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-auth-access/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/SKILL.md new file mode 100644 index 0000000..f216442 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/SKILL.md @@ -0,0 +1,86 @@ +--- +name: implementing-bitable-go-sdk +description: 指导飞书多维表格 Go SDK 集成实现(Guides Feishu Bitable integration with Go SDK)。包含 Client 初始化、强类型 API 调用、raw API 兜底、事件/回调接入与请求级选项。触发场景 Trigger: 新接入 Go SDK、补齐未封装 API、接入事件回调、排查 SDK 调用失败。关键词 Keywords: go sdk, larksuite, bitable v1, client.Do, dispatcher, websocket。 +argument-hint: " - e.g., 'typed call list records', 'raw call unsupported api', 'event websocket setup'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Implementing Bitable Go SDK + +用于建立 Go SDK 的统一调用与接入模式,覆盖初始化、API 访问、事件回调与未封装接口兜底。 + +## Quick Context + +```bash +# 扫描 Go SDK 初始化与调用方式 +!`rg -n "lark.NewClient|client\.Bitable\.V1|client\.Do\(|WithUserAccessToken|WithTenantKey" -S . | head -n 150` + +# 扫描事件回调 dispatcher 与路由 +!`rg -n "dispatcher\.NewEventDispatcher|OnP2|OnCustomizedEvent|webhook/event" -S . | head -n 150` +``` + +## Plan + +### 产物清单 +- [ ] SDK Client 初始化模板 +- [ ] 强类型 API 调用模板 +- [ ] Raw API 调用兜底模板 +- [ ] 事件/回调接入模板 + +### 决策点 +1. 目标接口是否有 SDK 强类型方法? +2. 身份调用是否需要 user token 或 tenant key? +3. 事件接入选长连接还是 HTTP 回调? + +## Verify + +### SDK 初始化 +- [ ] 初始化参数与缓存策略对齐 `reference/01-sdk-bootstrap/dependencies.md` +- [ ] 请求级选项使用正确 + +### API 调用策略 +- [ ] 强类型调用优先,兜底 raw 调用,见 `reference/02-typed-vs-raw/apis.md` +- [ ] 失败分支统一输出 code/msg/logid + +### 事件回调 +- [ ] dispatcher 注册方式与模式选择对齐 `reference/03-event-callback/events-topics.md` +- [ ] 验签解密参数对齐 `reference/04-auth/security-model.md` + +## Execute + +### 1. 初始化 Client +1. 使用 `lark.NewClient(appId, appSecret, ...)`。 +2. 按场景配置 token cache、tenant key、请求超时。 + +### 2. 强类型 API 调用 +1. 使用 `client.Bitable.V1..`。 +2. 统一封装 `resp.Success()` 与错误输出。 + +### 3. Raw API 兜底 +1. 对未封装或历史版本接口使用 `client.Do()`。 +2. 明确 HTTP 方法、路径、path/query/body 参数。 + +### 4. 事件与回调 +1. 使用 dispatcher 注册处理器。 +2. 根据接入模式挂接 ws 或 HTTP handler。 +3. 控制 3 秒内应答并落地幂等去重。 + +## Pitfalls + +1. **所有接口都走 raw 调用**:失去类型安全与可维护性,见 `reference/02-typed-vs-raw/apis.md`。 +2. **user/tenant token 混用**:会触发权限异常,见 `reference/04-auth/security-model.md`。 +3. **事件处理器注册版本不匹配**:导致解析失败,见 `reference/03-event-callback/events-topics.md`。 +4. **忽略 logid 输出**:线上排障困难,见 `reference/02-typed-vs-raw/apis.md`。 + +## Related References + +- `reference/01-sdk-bootstrap/dependencies.md` +- `reference/02-typed-vs-raw/apis.md` +- `reference/03-event-callback/events-topics.md` +- `reference/04-auth/security-model.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/01-sdk-bootstrap/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/01-sdk-bootstrap/dependencies.md new file mode 100644 index 0000000..3d9bbdf --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/01-sdk-bootstrap/dependencies.md @@ -0,0 +1,15 @@ +## SDK 初始化与能力 + +- DDS-Section: 3.1 安装与初始化 / B.1 服务端 SDK / B.2 开发前准备 +- DDS-Lines: L25-L41, L16479-L16520, L16572-L16580 + +### Extract + +| 项 | 内容 | +|---|---| +| 安装 | `go get -u github.com/larksuite/oapi-sdk-go/v3@latest` | +| 初始化 | `lark.NewClient(appID, appSecret, ...)` | +| token 托管 | SDK 可托管 tenant token 生命周期 | + +扩展:支持自定义缓存、超时与 HTTP Client。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/02-typed-vs-raw/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/02-typed-vs-raw/apis.md new file mode 100644 index 0000000..1e96534 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/02-typed-vs-raw/apis.md @@ -0,0 +1,14 @@ +## 强类型调用与 raw 兜底 + +- DDS-Section: 3.2 Bitable v1 调用范式 / 3.4 历史或未封装 API 原生调用 / B.3 调用服务端 API +- DDS-Lines: L43-L63, L72-L84, L16594-L16820 + +### Extract + +| 模式 | 方式 | 适用 | +|---|---|---| +| 强类型 | `client.Bitable.V1..` | 常规已封装接口 | +| Raw | `client.Do(context, ApiReq{...})` | 历史版本/未封装接口 | + +统一错误处理建议:输出 `code + msg + request/log id`。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/03-event-callback/events-topics.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/03-event-callback/events-topics.md new file mode 100644 index 0000000..91d9499 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/03-event-callback/events-topics.md @@ -0,0 +1,15 @@ +## SDK 事件与回调接入 + +- DDS-Section: 3.5 事件与回调处理 / B.4 / B.5 +- DDS-Lines: L86-L92, L16843-L17397 + +### Extract + +| 能力 | 说明 | +|---|---| +| Event Dispatcher | `dispatcher.NewEventDispatcher` 注册事件处理器 | +| 长连接模式 | SDK 提供 WebSocket 通道接收事件/回调 | +| HTTP 模式 | 可集成原生 HTTP/Gin/Hertz | + +注意:长连接是集群分发,不是广播。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/04-auth/security-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/04-auth/security-model.md new file mode 100644 index 0000000..8e15838 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/reference/04-auth/security-model.md @@ -0,0 +1,14 @@ +## SDK 鉴权选项 + +- DDS-Section: 3.3 请求级选项 / B.3 请求选项 +- DDS-Lines: L65-L72, L16706-L16722 + +### Extract + +| 选项 | 用途 | +|---|---| +| `WithUserAccessToken` | 用户态请求 | +| `WithTenantAccessToken` | 应用态请求 | +| `WithTenantKey` | 商店应用租户隔离 | +| `WithHeaders` | 自定义请求头 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/implementing-bitable-go-sdk/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/SKILL.md new file mode 100644 index 0000000..71271d9 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/SKILL.md @@ -0,0 +1,85 @@ +--- +name: managing-bitable-write-concurrency +description: 指导飞书多维表格写并发与可靠性治理(Guides write concurrency and reliability management for Feishu Bitable)。包含 QPS 限制、同资源串行写、幂等键策略、超时重试与失败回退。触发场景 Trigger: 批量写入优化、并发写冲突排查、重试机制设计、高频任务稳定性治理。关键词 Keywords: concurrency, qps, idempotency, client_token, retry, batch, bitable。 +argument-hint: " - e.g., 'records/batch_update high-throughput', 'fields/update conflict-fix'" +allowed-tools: + - Read + - Write + - Edit + - Glob + - Grep + - Bash +--- + +# Managing Bitable Write Concurrency + +用于治理 Bitable 写路径的稳定性:限流、串行化、幂等、重试和回滚,避免在高频调用时出现冲突或重复写。 + +## Quick Context + +```bash +# 扫描写接口与批量调用点 +!`rg -n "create|update|delete|batch_create|batch_update|batch_delete|client_token" -S . | head -n 150` + +# 扫描并发冲突、频控、重试逻辑 +!`rg -n "QPS|并发|OperationTypeError|retry|timeout|backoff|idempot" -S . | head -n 150` +``` + +## Plan + +### 产物清单 +- [ ] 写接口分类与容量画像 +- [ ] 串行化/限流策略 +- [ ] 幂等键策略 +- [ ] 重试与失败回退方案 + +### 决策点 +1. 哪些接口必须串行(同 app/table)? +2. 哪些接口必须携带 `client_token`? +3. 哪些错误可重试、重试上限是多少? + +## Verify + +### 限流与容量 +- [ ] QPS 与批量上限对齐 `reference/01-qps-limits/apis.md` +- [ ] 批量接口单次容量未超过文档约束 + +### 冲突与幂等 +- [ ] 同资源写请求串行化,见 `reference/02-write-conflict/state-machine.md` +- [ ] 幂等键规则与冲突处理对齐 `reference/03-idempotency/apis.md` + +### 重试策略 +- [ ] 重试只用于可恢复错误,见 `reference/04-retry-policy/dependencies.md` +- [ ] 不可恢复错误直接失败并回传定位信息 + +## Execute + +### 1. 写路径分层 +1. 按资源拆分写队列:app/table/record/field/role。 +2. 同队列内串行,跨队列受全局限流控制。 + +### 2. 幂等落地 +1. 对支持幂等的接口统一生成 UUID `client_token`。 +2. 幂等冲突时不盲目重放,先刷新 token 再重试。 + +### 3. 重试与退避 +1. 可重试错误采用指数退避 + 上限次数。 +2. 达到上限后进入人工排查通道。 + +### 4. 观测与告警 +1. 记录冲突率、重试率、最终失败率。 +2. 关键阈值越界时触发告警。 + +## Pitfalls + +1. **把所有写接口并发放开**:同资源并发写会触发冲突,见 `reference/02-write-conflict/state-machine.md`。 +2. **幂等键格式不规范**:非 UUID 会直接失败,见 `reference/03-idempotency/apis.md`。 +3. **把不可恢复错误也重试**:放大故障面,见 `reference/04-retry-policy/dependencies.md`。 +4. **批量写超限**:单次超过 500 条会失败,见 `reference/01-qps-limits/apis.md`。 + +## Related References + +- `reference/01-qps-limits/apis.md` +- `reference/02-write-conflict/state-machine.md` +- `reference/03-idempotency/apis.md` +- `reference/04-retry-policy/dependencies.md` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/examples/skeleton.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/examples/skeleton.md new file mode 100644 index 0000000..7cdd60b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/examples/skeleton.md @@ -0,0 +1,4 @@ +# Skeleton Example + +- 仅提供调用骨架,不包含完整业务实现。 +- 实际编码前先对照 `reference/` 校验参数、权限、错误码与频控限制。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/01-qps-limits/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/01-qps-limits/apis.md new file mode 100644 index 0000000..9d18e3e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/01-qps-limits/apis.md @@ -0,0 +1,15 @@ +## 接口频控与批量上限 + +- DDS-Section: 接入指南-限制 / 各 OpenAPI 描述 +- DDS-Lines: L377-L384, L1954+, L2233+, L8529+, L10629+, L11217+ + +### Extract + +| 维度 | 约束 | +|---|---| +| 读接口 QPS | 常见 20 QPS | +| 写接口 QPS | 常见 10 QPS | +| 批量写 | 单次最多 500 条记录 | + +说明:具体值以目标接口章节为准。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/02-write-conflict/state-machine.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/02-write-conflict/state-machine.md new file mode 100644 index 0000000..8913937 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/02-write-conflict/state-machine.md @@ -0,0 +1,15 @@ +## 写冲突状态流 + +- DDS-Section: 接入指南注意事项 / 各 API 错误码 +- DDS-Lines: L309, L2067+, L3050+, L3339+ + +### Extract + +```text +READY -> WRITE_REQUEST +WRITE_REQUEST + parallel_same_resource -> CONFLICT(OperationTypeError) +WRITE_REQUEST + serialized -> SUCCESS +``` + +策略:同 app(更细可到 table)写请求串行化。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/03-idempotency/apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/03-idempotency/apis.md new file mode 100644 index 0000000..082e25d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/03-idempotency/apis.md @@ -0,0 +1,15 @@ +## 幂等键规则 + +- DDS-Section: 记录/字段批量写相关错误码与参数 +- DDS-Lines: L9343, L9483, L10707, L10847, L10893, L12777, L12965, L13005 + +### Extract + +| 规则 | 说明 | +|---|---| +| key 字段 | `client_token` | +| 格式 | 标准 UUID | +| 冲突处理 | 重新生成幂等键后重试 | + +不满足格式会返回幂等键格式错误。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/04-retry-policy/dependencies.md b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/04-retry-policy/dependencies.md new file mode 100644 index 0000000..7b4732b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/reference/04-retry-policy/dependencies.md @@ -0,0 +1,14 @@ +## 重试策略依赖 + +- DDS-Section: 接口错误说明 / 事件重推说明 +- DDS-Lines: L3654, L3913, L4896, L5356, L5734, L6058, L18209 + +### Extract + +| 错误类型 | 建议 | +|---|---| +| 服务器计算超时 | 可有限重试 | +| 并发写冲突 | 串行化后重试 | +| 参数/权限错误 | 不重试,直接修正 | +| 回调超时重推 | 消费端按 event_id 去重 | + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/scripts/verify.sh new file mode 100644 index 0000000..86db03f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/managing-bitable-write-concurrency/scripts/verify.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# verify.sh - skill structure/content quick validation +set -e +PASS=0 +FAIL=0 + +pass() { + echo "PASS: $1" + PASS=$((PASS+1)) +} + +fail() { + echo "FAIL: $1" + FAIL=$((FAIL+1)) +} + +check_cmd() { + local desc="$1" + shift + if "$@"; then + pass "$desc" + else + fail "$desc" + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +check_cmd "SKILL.md exists" test -f "$SKILL_DIR/SKILL.md" +check_cmd "reference dir exists" test -d "$SKILL_DIR/reference" + +line_count=$(wc -l < "$SKILL_DIR/SKILL.md") +if [ "$line_count" -lt 500 ]; then + pass "SKILL.md < 500 lines" +else + fail "SKILL.md < 500 lines" +fi + +check_cmd "has Plan" grep -q '^## Plan' "$SKILL_DIR/SKILL.md" +check_cmd "has Verify" grep -q '^## Verify' "$SKILL_DIR/SKILL.md" +check_cmd "has Execute" grep -q '^## Execute' "$SKILL_DIR/SKILL.md" +check_cmd "has Pitfalls" grep -q '^## Pitfalls' "$SKILL_DIR/SKILL.md" +check_cmd "reference has DDS-Section" grep -rq 'DDS-Section:' "$SKILL_DIR/reference" +check_cmd "reference has DDS-Lines" grep -rq 'DDS-Lines:' "$SKILL_DIR/reference" + +echo "RESULT: $PASS PASS / $FAIL FAIL" +[ $FAIL -eq 0 ] \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/self-check.json b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/self-check.json new file mode 100644 index 0000000..c5c6b3f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/agent-skills-feishu-bitable-v2-shit/self-check.json @@ -0,0 +1,134 @@ +[ + { + "Skill": "designing-bitable-contracts", + "Lines": 79, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 4, + "DDSLines": 4 + }, + { + "Skill": "developing-bitable-app-metadata", + "Lines": 82, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 7, + "DDSLines": 7 + }, + { + "Skill": "developing-bitable-event-callback", + "Lines": 87, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 6, + "DDSLines": 6 + }, + { + "Skill": "developing-bitable-field", + "Lines": 86, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 8, + "DDSLines": 8 + }, + { + "Skill": "developing-bitable-record", + "Lines": 88, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 8, + "DDSLines": 8 + }, + { + "Skill": "developing-bitable-role-member", + "Lines": 86, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 6, + "DDSLines": 6 + }, + { + "Skill": "developing-bitable-table-view", + "Lines": 83, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 5, + "DDSLines": 5 + }, + { + "Skill": "developing-feishu-bitable-system", + "Lines": 114, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 10, + "DDSLines": 10 + }, + { + "Skill": "implementing-bitable-auth-access", + "Lines": 84, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 4, + "DDSLines": 4 + }, + { + "Skill": "implementing-bitable-go-sdk", + "Lines": 86, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 4, + "DDSLines": 4 + }, + { + "Skill": "managing-bitable-write-concurrency", + "Lines": 85, + "VerifyExists": true, + "HasPlan": true, + "HasVerify": true, + "HasExecute": true, + "HasPitfalls": true, + "CmdCount": 2, + "DDSSection": 4, + "DDSLines": 4 + } +] diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/SKILL.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/SKILL.md new file mode 100644 index 0000000..bee2f6d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/SKILL.md @@ -0,0 +1,220 @@ +--- +name: developing-feishu-bitable +description: > + 飞书多维表格(Bitable)Go SDK 全栈开发指导 Skill(Full-stack development guide for Feishu/Lark Bitable using Go SDK)。涵盖 oapi-sdk-go 初始化、App/Table/View/Record/Field CRUD API、字段类型与数据结构、记录筛选 Filter 语法、事件订阅(字段变更/记录变更)、长连接/Webhook 事件处理、高级权限(Role/Member)管理。触发场景 Trigger: 使用 Go 开发飞书多维表格集成时、调用 Bitable API 时、处理多维表格事件回调时、操作字段/记录/视图时。关键词 Keywords: feishu, lark, bitable, 多维表格, Go SDK, oapi-sdk-go, app_token, table_id, record, field, view, filter, event, webhook, 长连接, tenant_access_token, 高级权限。 +argument-hint: " - e.g., 'create record', 'list fields', 'subscribe event', 'filter records'" +allowed-tools: + - Read + - Glob + - Grep +--- + +# Developing Feishu Bitable + +本 Skill 是飞书多维表格(Bitable)Go 后端开发的唯一全栈向导。基于 `oapi-sdk-go/v3` SDK,覆盖 +App/Table/View/Record/Field/Role/Member 全部资源的 CRUD API、字段类型系统、记录筛选公式、 +事件订阅(字段变更 + 记录变更)、长连接/HTTP 回调模式、以及高级权限管理。 + +**核心技术栈**:Go ≥ 1.18 · `github.com/larksuite/oapi-sdk-go/v3` · REST API · WebSocket 长连接 + +## Quick Context + +```bash +# 动态注入:查看项目中已有的 Bitable 相关代码 +!`grep -rn "larkbitable\|Bitable\|bitable\|AppTableRecord\|AppTableField" --include="*.go" . | head -30` + +# 动态注入:查看 SDK 依赖版本 +!`grep "oapi-sdk-go" go.mod 2>/dev/null || echo "SDK not in go.mod"` + +# 动态注入:查看事件处理相关代码 +!`grep -rn "EventDispatcher\|OnP2\|larkws\|webhook" --include="*.go" . | head -20` +``` + +## Plan + +### 产物清单 +- [ ] SDK Client 初始化模块(含 token 缓存配置) +- [ ] Bitable CRUD 服务层(Record/Field/View/Table 操作封装) +- [ ] 字段类型映射与序列化/反序列化逻辑 +- [ ] 记录筛选 Filter 构建器 +- [ ] 事件订阅处理器(记录变更 / 字段变更) +- [ ] 高级权限管理(Role/Member,如需要) + +### 决策点 +1. **凭证模式选择**:`tenant_access_token`(纯后端服务)vs `user_access_token`(代用户操作)。SDK 自动管理 tenant token 的获取与缓存,但不管理 user token。 +2. **事件接收模式**:推荐长连接(WebSocket),免内网穿透、无需解密验签;生产集群部署时注意集群模式为随机分发而非广播。 +3. **批量操作策略**:批量 API(batch_create/batch_update/batch_delete)单次限 500 条,结果全成功或全失败,无部分结果。 + +## Verify + +> 验证按 SDK 初始化 → API 调用 → 字段处理 → 事件 → 权限 顺序。 + +### SDK 初始化验证 +- [ ] `lark.NewClient(appID, appSecret)` 中 appID/appSecret 来自开发者后台,不硬编码 +- [ ] `lark.WithEnableTokenCache(true)` 已启用(默认开启) +- [ ] 商店应用调用时附带 `larkcore.WithTenantKey(tenantKey)` + +### API 调用验证 +- [ ] 所有 API 调用统一使用 Builder 模式:`NewXxxReqBuilder().XxxField(val).Build()` +- [ ] 分页查询使用 `PageToken` + `PageSize`(单次最多 500 条记录) +- [ ] API 路径中的 `app_token`、`table_id` 来自配置或动态获取,不硬编码 +- [ ] 响应处理先检查 `resp.Success()`,失败时记录 `resp.Code`、`resp.Msg`、`resp.RequestId()` + +### 字段类型验证 +- [ ] 字段 type 枚举与 `reference/02-data-model/field-types.md` 一致(1=文本, 2=数字, 3=单选...) +- [ ] 写入日期字段使用 **毫秒级 Unix 时间戳**(number) +- [ ] 写入人员字段使用 `[{"id": "ou_xxx"}]` 格式 +- [ ] 写入单向关联字段使用 `["record_id_1", "record_id_2"]` 格式 +- [ ] 数字字段写入用 number 类型,读取时返回 string(需类型转换) + +### 事件处理验证 +- [ ] 长连接 `dispatcher.NewEventDispatcher("", "")` 两个参数填**空字符串** +- [ ] HTTP 回调模式需传入正确的 `verificationToken` 和 `eventEncryptKey` +- [ ] 事件处理在 **3 秒内**完成,否则触发超时重推 +- [ ] 记录变更事件类型与 `reference/04-events/record-changed.md` 中 action 枚举一致 +- [ ] 公式字段值变化**不会触发**记录变更事件 + +### 权限验证 +- [ ] 使用 `tenant_access_token` 前,确认应用已加入目标多维表格的协作者列表 +- [ ] 高级权限 API 调用前,确认多维表格已开启高级权限 + +## Execute + +> 开发顺序:SDK 初始化 → CRUD API → 字段处理 → 筛选 → 事件 → 权限 + +### Step 1:SDK Client 初始化 + +```go +import lark "github.com/larksuite/oapi-sdk-go/v3" + +client := lark.NewClient(appID, appSecret, + lark.WithEnableTokenCache(true), // 自动管理 tenant_access_token +) +// 方法映射:client.Bitable.V1.<资源>.<动作>(ctx, req) +``` + +**关键约束**: +- SDK **仅**托管 `tenant_access_token`,`user_access_token` 需自行获取与刷新 +- 未封装的 API 可用 `client.Do()` 原生调用(参考 `reference/01-sdk-guide/raw-api-call.md`) + +### Step 2:Record CRUD 实现 + +按 `reference/03-api-reference/record-apis.md` 中的 OpenAPI Spec 实现: + +```go +// 列出记录(分页) +req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken(appToken).TableId(tableId). + PageSize(500). // 单次最多 500 + Filter(filterExpression). // 可选筛选 + Build() +resp, err := client.Bitable.V1.AppTableRecord.List(ctx, req) + +// 新增记录 +fields := map[string]interface{}{ + "文本字段": "value", + "数字字段": 42, // 写入用 number + "日期字段": 1672531200000, // 毫秒 Unix 时间戳 + "人员字段": []map[string]string{{"id": "ou_xxx"}}, + "单选字段": "选项A", + "多选字段": []string{"选项A", "选项B"}, +} +``` + +### Step 3:字段类型处理 + +根据 `reference/02-data-model/field-types.md` 和 `reference/02-data-model/field-edit-guide.md`: + +| type 值 | 类型 | 写入格式 | 读取格式 | +|---------|------|---------|---------| +| 1 | 多行文本 | `string` | `string` | +| 2 | 数字 | `number` | `string`(需转换!) | +| 3 | 单选 | `string`(选项名) | `string` | +| 4 | 多选 | `[]string` | `[]string` | +| 5 | 日期 | `number`(ms timestamp) | `number` | +| 7 | 复选框 | `boolean` | `boolean` | +| 11 | 人员 | `[{"id":"ou_xxx"}]` | `[{name,id,email}]` | +| 17 | 附件 | 需先上传获取 file_token | `[{file_token,name,url}]` | +| 18 | 单向关联 | `["record_id"]` | `["record_id"]` | + +**注意**:双向关联(21)、公式(20)、查找引用(19) **不支持写入**。 + +### Step 4:记录筛选 Filter 构建 + +根据 `reference/03-api-reference/filter-guide.md`: + +``` +// 语法:CurrentValue.[字段名] 运算符 值 +filter := `CurrentValue.[状态] = "进行中"` +filter := `AND(CurrentValue.[类型]="需求", CurrentValue.[优先级]>=3)` +filter := `CurrentValue.[创建时间] > TODAY()` + +// ⚠️ URL 编码注意:+ 号须编码为 %2B +``` + +### Step 5:事件订阅处理 + +根据 `reference/04-events/record-changed.md` 和 `reference/01-sdk-guide/event-handling.md`: + +```go +// 推荐:长连接模式(免内网穿透) +eventHandler := dispatcher.NewEventDispatcher("", ""). // 必须空串 + OnCustomizedEvent("drive.file.bitable_record_changed_v1", + func(ctx context.Context, event *larkevent.EventReq) error { + // event.Body 中 action_list 包含变更详情 + // action: record_added / record_edited / record_deleted + return nil // 3 秒内返回 + }) + +cli := larkws.NewClient(appID, appSecret, + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), +) +cli.Start(ctx) // 阻塞主线程 +``` + +### Step 6:高级权限管理(如适用) + +根据 `reference/05-permissions/role-member-apis.md`: +1. 先通过更新元数据 API 开启高级权限 +2. 创建自定义角色(`AppRole.Create`) +3. 为角色添加协作者(`AppRoleMember.Create`) +4. 开启后可能有延迟,遇到 `OperationTypeError` 需重试 + +## Pitfalls + +1. **数字字段读写类型不一致**:写入时是 `number`,但列出记录时返回 `string`,需做类型转换。忽略此差异会导致 JSON 反序列化失败。(参考 `reference/02-data-model/field-types.md`) + +2. **日期字段用毫秒而非秒**:日期字段的 value 是**毫秒级** Unix 时间戳。若误传秒级时间戳,结果日期将是 1970 年附近。(参考 `reference/02-data-model/field-types.md`) + +3. **长连接 EventDispatcher 参数必须为空串**:使用长连接模式时 `dispatcher.NewEventDispatcher("", "")`,传非空值会导致签名验证失败。HTTP 回调模式才需要传 verificationToken 和 encryptKey。(参考 `reference/01-sdk-guide/event-handling.md`) + +4. **批量操作全成功或全失败**:`batch_create`/`batch_update`/`batch_delete` 不存在部分成功的结果。若其中一条记录有问题,整个请求全部失败。(参考 `reference/03-api-reference/record-apis.md`) + +5. **公式字段变化不触发事件**:记录变更事件 `drive.file.bitable_record_changed_v1` 不会因公式字段值的变化而触发。如果业务依赖公式结果变化,需通过轮询方式检测。(参考 `reference/04-events/record-changed.md`) + +6. **同一时刻对同一多维表格仅一次写操作**:并发写入同一张多维表格可能导致数据冲突。需用串行写入队列或乐观锁策略。(参考 `reference/03-api-reference/record-apis.md`) + +7. **字段更新是全量覆盖**:更新字段的 `property` 是全量替换而非增量 merge。更新单选/多选字段时必须传入完整的 options 列表,否则未传入的选项会被删除。(参考 `reference/02-data-model/field-edit-guide.md`) + +8. **Filter 中 + 号须 URL 编码为 %2B**:在日期表达式如 `TODAY()+1` 中,`+` 需编码为 `%2B`,否则服务端会将其解析为空格。(参考 `reference/03-api-reference/filter-guide.md`) + +## Related References + +| 需要了解... | 查阅... | +|------------|--------| +| Go SDK 安装初始化、Client 构建 | `reference/01-sdk-guide/sdk-setup.md` | +| 原生调用未封装 API | `reference/01-sdk-guide/raw-api-call.md` | +| 事件/回调处理(长连接+HTTP) | `reference/01-sdk-guide/event-handling.md` | +| Bitable 资源模型(App/Table/View/Record/Field) | `reference/02-data-model/resource-model.md` | +| 字段类型系统(type 枚举、读写格式) | `reference/02-data-model/field-types.md` | +| 字段 Property 编辑指南 | `reference/02-data-model/field-edit-guide.md` | +| Record CRUD API(含 OpenAPI Spec) | `reference/03-api-reference/record-apis.md` | +| Table/View/Field/App API | `reference/03-api-reference/table-view-field-apis.md` | +| 记录筛选 Filter 公式语法 | `reference/03-api-reference/filter-guide.md` | +| 附件上传/下载 | `reference/03-api-reference/attachment.md` | +| 记录变更事件(action + 回调体) | `reference/04-events/record-changed.md` | +| 字段变更事件 | `reference/04-events/field-changed.md` | +| 高级权限 Role/Member API | `reference/05-permissions/role-member-apis.md` | +| 鉴权模式与 QPS 限制 | `reference/05-permissions/auth-and-limits.md` | +| SDK 常见问题与排错 | `reference/06-faq/common-issues.md` | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/bitable_client.go b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/bitable_client.go new file mode 100644 index 0000000..77f0eea --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/bitable_client.go @@ -0,0 +1,129 @@ +// bitable_client.go - 飞书多维表格 SDK Client 初始化骨架 +// +// 设计决策: +// 1. 使用 tenant_access_token(纯后端服务场景) +// 2. 启用 token 缓存(SDK 自动管理 token 生命周期) +// 3. 通过环境变量注入 App ID/Secret,避免硬编码 + +package bitable + +import ( + "context" + "fmt" + "os" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkbitable "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// Config 存储多维表格连接配置 +type Config struct { + AppID string // 飞书应用 App ID + AppSecret string // 飞书应用 App Secret + AppToken string // 目标多维表格的 app_token + TableID string // 目标数据表的 table_id +} + +// Client 封装飞书 Bitable SDK Client +type Client struct { + larkClient *lark.Client + config Config +} + +// NewClient 创建 Bitable Client +func NewClient(cfg Config) *Client { + client := lark.NewClient(cfg.AppID, cfg.AppSecret, + lark.WithEnableTokenCache(true), // 自动管理 tenant_access_token + ) + return &Client{ + larkClient: client, + config: cfg, + } +} + +// NewClientFromEnv 从环境变量创建 Client +func NewClientFromEnv() *Client { + return NewClient(Config{ + AppID: os.Getenv("FEISHU_APP_ID"), + AppSecret: os.Getenv("FEISHU_APP_SECRET"), + AppToken: os.Getenv("FEISHU_APP_TOKEN"), + TableID: os.Getenv("FEISHU_TABLE_ID"), + }) +} + +// ListRecords 列出记录(带分页) +// filter: 筛选表达式,如 `CurrentValue.[状态]="进行中"` +func (c *Client) ListRecords(ctx context.Context, filter string, pageToken string) ([]*larkbitable.AppTableRecord, string, error) { + builder := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken(c.config.AppToken). + TableId(c.config.TableID). + PageSize(500) // 单次最多 500 + + if filter != "" { + builder.Filter(filter) + } + if pageToken != "" { + builder.PageToken(pageToken) + } + + resp, err := c.larkClient.Bitable.V1.AppTableRecord.List(ctx, builder.Build()) + if err != nil { + return nil, "", fmt.Errorf("list records: %w", err) + } + if !resp.Success() { + return nil, "", fmt.Errorf("list records failed: code=%d msg=%s requestId=%s", + resp.Code, resp.Msg, resp.RequestId()) + } + + nextPageToken := "" + if resp.Data.PageToken != nil { + nextPageToken = *resp.Data.PageToken + } + return resp.Data.Items, nextPageToken, nil +} + +// CreateRecord 新增单条记录 +// fields: map[string]interface{} 字段名 -> 值 +func (c *Client) CreateRecord(ctx context.Context, fields map[string]interface{}) (string, error) { + req := larkbitable.NewCreateAppTableRecordReqBuilder(). + AppToken(c.config.AppToken). + TableId(c.config.TableID). + AppTableRecord(larkbitable.NewAppTableRecordBuilder(). + Fields(fields). + Build()). + Build() + + resp, err := c.larkClient.Bitable.V1.AppTableRecord.Create(ctx, req) + if err != nil { + return "", fmt.Errorf("create record: %w", err) + } + if !resp.Success() { + return "", fmt.Errorf("create record failed: code=%d msg=%s requestId=%s", + resp.Code, resp.Msg, resp.RequestId()) + } + return *resp.Data.Record.RecordId, nil +} + +// UpdateRecord 更新单条记录 +// fields: 需要更新的字段(增量更新) +func (c *Client) UpdateRecord(ctx context.Context, recordID string, fields map[string]interface{}) error { + req := larkbitable.NewUpdateAppTableRecordReqBuilder(). + AppToken(c.config.AppToken). + TableId(c.config.TableID). + RecordId(recordID). + AppTableRecord(larkbitable.NewAppTableRecordBuilder(). + Fields(fields). + Build()). + Build() + + resp, err := c.larkClient.Bitable.V1.AppTableRecord.Update(ctx, req) + if err != nil { + return fmt.Errorf("update record: %w", err) + } + if !resp.Success() { + return fmt.Errorf("update record failed: code=%d msg=%s requestId=%s", + resp.Code, resp.Msg, resp.RequestId()) + } + return nil +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/event_handler.go b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/event_handler.go new file mode 100644 index 0000000..2f92d0b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/examples/event_handler.go @@ -0,0 +1,87 @@ +// event_handler.go - 飞书多维表格事件处理骨架 +// +// 设计决策: +// 1. 使用长连接模式(推荐):免内网穿透、无需解密验签 +// 2. EventDispatcher 参数必须为空字符串(长连接要求) +// 3. 事件处理需在 3 秒内完成,耗时操作应异步化 + +package bitable + +import ( + "context" + "encoding/json" + "fmt" + "log" + + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkevent "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) + +// RecordAction 记录变更事件中的单个操作 +type RecordAction struct { + Action string `json:"action"` // record_added / record_edited / record_deleted + RecordID string `json:"record_id"` + BeforeValue []FieldValue `json:"before_value"` + AfterValue []FieldValue `json:"after_value"` +} + +// FieldValue 字段值 +type FieldValue struct { + FieldID string `json:"field_id"` + FieldValue string `json:"field_value"` // JSON 序列化后的字符串 +} + +// RecordChangedEvent 记录变更事件体 +type RecordChangedEvent struct { + Event struct { + FileToken string `json:"file_token"` // 多维表格 app_token + FileType string `json:"file_type"` // 固定 "bitable" + TableID string `json:"table_id"` + ActionList []RecordAction `json:"action_list"` + OperatorID struct { + OpenID string `json:"open_id"` + UnionID string `json:"union_id"` + UserID string `json:"user_id"` + } `json:"operator_id"` + } `json:"event"` +} + +// RecordChangeHandler 记录变更回调函数类型 +type RecordChangeHandler func(ctx context.Context, event RecordChangedEvent) error + +// StartEventListener 启动长连接事件监听器 +// +// appID, appSecret: 飞书应用凭证 +// handler: 记录变更事件处理函数 +// +// ⚠️ 此函数会阻塞主线程 +func StartEventListener(appID, appSecret string, handler RecordChangeHandler) error { + // ⚠️ 长连接模式:两个参数必须为空字符串 + eventHandler := dispatcher.NewEventDispatcher("", ""). + OnCustomizedEvent("drive.file.bitable_record_changed_v1", + func(ctx context.Context, event *larkevent.EventReq) error { + var parsed RecordChangedEvent + if err := json.Unmarshal(event.Body, &parsed); err != nil { + log.Printf("parse event failed: %v", err) + return nil // 解析失败也要返回 nil,避免重推 + } + + // 委托给业务处理器 + if err := handler(ctx, parsed); err != nil { + log.Printf("handle event failed: %v", err) + // 不返回 error,避免触发重推 + // 如需重试,在 handler 内部实现异步重试 + } + return nil // 3 秒内返回 + }) + + cli := larkws.NewClient(appID, appSecret, + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + + fmt.Println("starting bitable event listener...") + return cli.Start(context.Background()) // 阻塞主线程 +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/event-handling.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/event-handling.md new file mode 100644 index 0000000..3df4e80 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/event-handling.md @@ -0,0 +1,101 @@ +# 事件与回调处理 + +- **DDS-Section**: 3.5 事件与回调处理 / B.4 处理事件 / B.5 处理回调 +- **DDS-Lines**: L86-L91, L16843-L17528 + +## Extract + +### 两种事件接收模式 + +| 模式 | 优势 | 限制 | +|------|------|------| +| **长连接(WebSocket)** | 免内网穿透、无需解密验签、SDK 内置鉴权 | 仅限企业自建应用,每应用最多 50 连接 | +| **HTTP 回调(Webhook)** | 支持所有应用类型 | 需公网地址、需处理解密验签 | + +### 关键约束 + +- 长连接模式是**集群分发**,不是广播;同应用多实例时由随机一个实例消费 +- 无论哪种模式,事件处理**需在 3 秒内完成**,否则触发超时重推 +- HTTP 回调模式服务端需在 3 秒内返回 HTTP 200 状态码 + +### 长连接示例(推荐) + +```go +package main + +import ( + "context" + "fmt" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkevent "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) + +func main() { + // ⚠️ 长连接模式:两个参数必须填空字符串 + eventHandler := dispatcher.NewEventDispatcher("", ""). + OnCustomizedEvent("drive.file.bitable_record_changed_v1", + func(ctx context.Context, event *larkevent.EventReq) error { + fmt.Printf("record changed: %s\n", string(event.Body)) + return nil // 3 秒内返回 + }) + + cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET", + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + // 启动客户端,主线程阻塞 + err := cli.Start(context.Background()) + if err != nil { + panic(err) + } +} +``` + +### HTTP 回调模式示例 + +```go +// HTTP 模式:需传入 verificationToken 和 eventEncryptKey +handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") +handler = handler.OnCustomizedEvent("drive.file.bitable_record_changed_v1", + func(ctx context.Context, event *larkevent.EventReq) error { + fmt.Println(string(event.Body)) + return nil + }) + +http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, + larkevent.WithLogLevel(larkcore.LogLevelDebug))) +http.ListenAndServe(":9999", nil) +``` + +### Gin 框架集成 + +```bash +go get -u github.com/larksuite/oapi-sdk-gin +``` + +```go +gin.POST("/webhook/event", sdkginext.NewEventHandlerFunc(handler)) +``` + +### 事件版本说明 + +| 版本 | 注册方法 | 说明 | +|------|---------|------| +| v2.0 | `OnP2XxxV1(...)` | P2 前缀 = v2.0 版本事件结构 | +| v1.0 | `OnCustomizedEvent("event_key", ...)` | 自定义事件 key | + +### 回调处理(卡片交互等) + +长连接模式下处理卡片回传交互: + +```go +eventHandler := dispatcher.NewEventDispatcher("", ""). + OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { + fmt.Println(larkcore.Prettify(event)) + return nil, nil + }) +``` + +HTTP 模式下处理旧版卡片回调(使用 `larkcard.NewCardActionHandler`)。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/raw-api-call.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/raw-api-call.md new file mode 100644 index 0000000..43b9976 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/raw-api-call.md @@ -0,0 +1,30 @@ +# 原生调用未封装 API + +- **DDS-Section**: 3.4 历史/未封装 API 的原生调用 +- **DDS-Lines**: L72-L84 + +## Extract + +当 SDK 暂未提供强类型方法时,可用 `client.Do()` 进行原生调用: + +```go +resp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/contact/v3/users/:user_id", + PathParams: larkcore.PathParams{"user_id": "ou_xxx"}, + QueryParams: larkcore.QueryParams{"user_id_type": []string{"open_id"}}, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}, +}) +``` + +### 使用场景 + +- SDK 版本落后于 API 更新 +- 历史版本接口调用 +- 特殊参数需求(如自定义 Header) + +### 注意事项 + +- `ApiPath` 使用完整的 API URL +- `PathParams` 中的键名对应 URL 中的 `:key` 占位符 +- `SupportedAccessTokenTypes` 必须指定凭证类型 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/sdk-setup.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/sdk-setup.md new file mode 100644 index 0000000..8465690 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/01-sdk-guide/sdk-setup.md @@ -0,0 +1,73 @@ +# Go SDK 安装与初始化 + +- **DDS-Section**: 3. Golang SDK 调用说明 / B.2 开发前准备 +- **DDS-Lines**: L23-L97, L16549-L16586 + +## Extract + +### 安装 + +```bash +go get -u github.com/larksuite/oapi-sdk-go/v3@latest +``` + +### Client 初始化 + +```go +import lark "github.com/larksuite/oapi-sdk-go/v3" + +client := lark.NewClient(appID, appSecret, + // lark.WithMarketplaceApp(), // 商店应用时启用 + lark.WithEnableTokenCache(true), // 默认启用,自动管理 tenant_access_token +) +``` + +### 关键约束 + +| 约束 | 说明 | +|------|------| +| Token 托管 | SDK 自动获取和缓存 `tenant_access_token` 和 `app_access_token`,无需手动管理 | +| user_access_token | SDK **不**托管,需自行实现获取/刷新逻辑 | +| 商店应用 | 调用时需补 `larkcore.WithTenantKey(tenantKey)` | + +### Bitable API 调用范式 + +SDK 方法映射规则:`client.Bitable.V1.<资源>.<动作>(ctx, req)` + +```go +req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken("app_token"). + TableId("table_id"). + PageSize(20). + Build() + +resp, err := client.Bitable.V1.AppTableRecord.List(context.Background(), req) +if err != nil { + // 网络错误 + panic(err) +} +if !resp.Success() { + // 业务错误 + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return +} +fmt.Println(larkcore.Prettify(resp.Data)) +``` + +### 请求级选项 + +| 选项 | 用途 | +|------|------| +| `larkcore.WithUserAccessToken(...)` | 用户态调用 | +| `larkcore.WithTenantAccessToken(...)` | 手动传租户 token | +| `larkcore.WithTenantKey(...)` | 商店应用必须设置 | +| `larkcore.WithHeaders(...)` | 透传自定义 Header | + +### 本地示例代码位置 + +| 路径 | 内容 | +|------|------| +| `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/apiall/bitablev1/` | Bitable v1 全量 API 样例 | +| `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/api/bitable2.go` | 复杂字段示例 | +| `offline-docs-v2/go-sdk-examples/oapi-sdk-go-demo/` | 官方场景化 Demo | +| `offline-docs-v2/go-sdk-examples/bitablev1-curated/` | 精选拷贝 | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-edit-guide.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-edit-guide.md new file mode 100644 index 0000000..ad2e4da --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-edit-guide.md @@ -0,0 +1,136 @@ +# 字段 Property 编辑指南 + +- **DDS-Section**: A.5 字段编辑指南 - Property 说明 +- **DDS-Lines**: L734-L1370 + +## Extract + +> ⚠️ **关键约束**:更新字段时为**全量更新**,`property` 会被完全覆盖。更新单选/多选字段时,必须传入完整的 options 列表。 + +### 数字字段 Property + +| 名称 | 类型 | 说明 | 默认值 | +|------|------|------|--------| +| `formatter` | string | 数字显示格式 | `"0.0"` | + +**formatter 对照表**: + +| 格式 | formatter 值 | +|------|-------------| +| 整数 | `"0"` | +| 保留1位小数 | `"0.0"` | +| 保留2位小数 | `"0.00"` | +| 千分位 | `"1,000"` | +| 千分位(小数) | `"1,000.00"` | +| 百分比 | `"%"` | +| 百分比(小数) | `"0.00%"` | +| 人民币 | `"¥"` | +| 人民币(小数) | `"¥0.00"` | +| 美元 | `"$"` | +| 美元(小数) | `"$0.00"` | + +```json +{ + "field_name": "数字", + "type": 2, + "property": { + "formatter": "0.00" + } +} +``` + +### 单选/多选字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `options` | array | 选项列表 | +| `options[].name` | string | 选项名 | +| `options[].id` | string | 选项 ID(更新时如果保留已有选项需传入) | +| `options[].color` | int | 选项颜色(0-54) | + +**⚠️ 更新时必须传入完整 options 列表**: + +```json +// 新增字段:只需 name 和 color +{ + "field_name": "任务状态", + "type": 3, + "property": { + "options": [ + {"name": "待处理", "color": 0}, + {"name": "进行中", "color": 1} + ] + } +} + +// 更新字段:保留已有选项需带上 id +{ + "field_name": "任务状态", + "type": 3, + "property": { + "options": [ + {"name": "待处理", "color": 0, "id": "optXXX1"}, + {"name": "进行中", "color": 1, "id": "optXXX2"}, + {"name": "已完成", "color": 2} // 新增选项不需要 id + ] + } +} +``` + +### 日期字段 Property + +| 名称 | 类型 | 说明 | 默认值 | +|------|------|------|--------| +| `date_formatter` | string | 日期显示格式 | `"yyyy/MM/dd"` | +| `auto_fill` | boolean | 新记录自动填写创建时间 | `false` | + +### 人员字段 Property + +| 名称 | 类型 | 说明 | 默认值 | +|------|------|------|--------| +| `multiple` | boolean | 允许添加多个成员 | `false` | + +### 单向关联字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `table_id` | string | 关联的数据表 ID(必填) | +| `multiple` | boolean | 允许关联多条记录 | + +### 双向关联字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `table_id` | string | 关联的数据表 ID(必填) | +| `back_field_name` | string | 对向关联字段名(必填) | +| `multiple` | boolean | 允许关联多条记录 | + +### 公式字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `formula_expression` | string | 公式表达式(⚠️ 创建/更新字段时不支持设置公式表达式) | +| `formatter` | string | 显示格式 | + +### 创建时间/最后更新时间字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `date_formatter` | string | 日期显示格式 | + +### 自动编号字段 Property + +| 名称 | 类型 | 说明 | +|------|------|------| +| `auto_serial` | object | 编号规则配置 | +| `auto_serial.type` | string | 类型:`auto_increment_number`(自增数字), `custom`(自定义) | +| `auto_serial.options` | array | 自定义规则列表 | +| `auto_serial.options[].type` | string | 规则项类型:`system_number`(自增编号), `fixed_text`(固定字符), `created_time`(创建时间) | +| `auto_serial.options[].value` | string | 与类型对应的取值 | + +### 各字段类型的 API 支持情况 + +| 操作 | 支持的字段类型 | 不支持 | +|------|-------------|--------| +| 新增/更新记录 | 文本、单选、多选、日期、人员、附件、复选框、超链接、数字、单向关联、电话、地理位置 | 双向关联、公式、查找引用 | +| 新增/更新字段 | 文本、单选、多选、日期、数字、人员、附件、单向/双向关联、复选框、超链接、公式(不支持设表达式)、创建人、修改人、创建时间、更新时间、自动编号、电话、地理位置 | 查找引用 | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-types.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-types.md new file mode 100644 index 0000000..c8a12f1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/field-types.md @@ -0,0 +1,107 @@ +# 字段类型系统 + +- **DDS-Section**: A.3 数据结构 / A.5 字段编辑指南 - 字段概述 +- **DDS-Lines**: L479-L604, L717-L733 + +## Extract + +### 字段 type 枚举 + +| type 值 | 类型名 | 读取格式 | 写入格式 | 可写入 | +|---------|--------|---------|---------|--------| +| 1 | 多行文本 | `string` | `string` | ✅ | +| 2 | 数字 | `string` ⚠️ | `number` | ✅ | +| 3 | 单选 | `string` | `string`(选项名) | ✅ | +| 4 | 多选 | `[]string` | `[]string` | ✅ | +| 5 | 日期 | `number`(ms) | `number`(ms timestamp) | ✅ | +| 7 | 复选框 | `boolean` | `boolean` | ✅ | +| 11 | 人员 | `[{name,id,en_name,email}]` | `[{"id":"ou_xxx"}]` | ✅ | +| 13 | 电话号码 | `string` | `string`(正则 `(\+)?\d*`) | ✅ | +| 15 | 超链接 | `{text,link}` | `{text,link}` | ✅ | +| 17 | 附件 | `[{file_token,name,type,size,url,tmp_url}]` | 需先上传获取 file_token | ✅ | +| 18 | 单向关联 | `[]string`(record_id) | `[]string`(record_id) | ✅ | +| 19 | 查找引用 | - | - | ❌ | +| 20 | 公式 | 取决于公式返回类型 | - | ❌ | +| 21 | 双向关联 | 只读 | - | ❌ | +| 22 | 地理位置 | `{location,pname,cityname,adname,address,name,full_address}` | 同结构 | ✅ | +| 1001 | 创建时间 | `number`(ms) | - | ❌(自动) | +| 1002 | 最后更新时间 | `number`(ms) | - | ❌(自动) | +| 1003 | 创建人 | `{name,id,en_name,email}` | - | ❌(自动) | +| 1004 | 修改人 | `{name,id,en_name,email}` | - | ❌(自动) | +| 1005 | 自动编号 | `string` | - | ❌(自动) | + +### ⚠️ 关键陷阱:数字字段读写不一致 + +- **写入时**:值为 `number` 类型(如 `42`、`3.14`) +- **读取时**:值为 `string` 类型(如 `"42"`、`"3.14"`) +- 必须在代码中做类型转换 + +### 人员对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `name` | string | 名字 | +| `id` | string | user open_id | +| `en_name` | string | 英文名 | +| `email` | string | 邮箱 | + +### 超链接对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `text` | string | 文本名称 | +| `link` | string | 超链接 URL | + +### 附件对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `file_token` | string | 附件 token | +| `name` | string | 附件名称 | +| `type` | string | MIME 类型,如 `image/png` | +| `size` | int | 大小(字节) | +| `url` | string | 附件 URL(需鉴权下载) | +| `tmp_url` | string | 临时下载链接(需 access token) | + +### 地理位置对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `location` | string | 经纬度 | +| `pname` | string | 省 | +| `cityname` | string | 市 | +| `adname` | string | 区 | +| `address` | string | 详细地址 | +| `name` | string | 地名 | +| `full_address` | string | 完整地址 | + +### Record 结构 + +```json +{ + "record_id": "recn0hoyXL", + "fields": { + "字段名1": "值", + "字段名2": 42 + } +} +``` + +- `fields` 是 `map[string]interface{}`,key 为字段名(非 field_id),value 类型随字段类型而异 + +### 视图结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `view_id` | string | 视图 ID | +| `view_name` | string | 视图名称 | +| `view_type` | string | 类型:grid, kanban, gallery, gantt | + +### 字段结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `field_id` | string | 字段 ID | +| `field_name` | string | 字段名 | +| `type` | int | 字段类型枚举 | +| `property` | object | 字段属性,因类型而异(见 field-edit-guide.md) | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/resource-model.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/resource-model.md new file mode 100644 index 0000000..a9d71b1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/02-data-model/resource-model.md @@ -0,0 +1,81 @@ +# Bitable 资源模型 + +- **DDS-Section**: A.1 概述 / A.2 接入指南 - 2.内容 +- **DDS-Lines**: L107-L260, L268-L310 + +## Extract + +### 资源层级 + +``` +Bitable App (app_token) +├── Table (table_id) # 最多 100 个/App +│ ├── View (view_id) # 最多 200 个/Table +│ ├── Field (field_id) # 最多 150 个/Table +│ └── Record (record_id) # 最多 20000 条/Table +├── Role (role_id) # 最多 30 个/App(高级权限) +│ └── Member (member_id) # 最多 200 个/Role +└── Dashboard # 仪表盘 +``` + +### 资源标识符 + +| 标识符 | 唯一范围 | 获取方式 | +|--------|---------|---------| +| `app_token` | 全局唯一 | URL 中直接获取,或从文档 block 中解析 | +| `table_id` | App 内唯一 | URL 中获取或 `List Table` API | +| `view_id` | App 内唯一 | URL 中获取或 `List View` API | +| `record_id` | App 内唯一 | `List Record` API | +| `field_id` | App 内唯一 | `List Field` API | +| `role_id` | App 内唯一 | `List Role` API | +| `member_id` | Role 内唯一 | `List Member` API | + +### API 基础路径 + +``` +https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +``` + +### app_token 获取方式 + +**Bitable App**(独立多维表格): +- URL 中直接截取:`feishu.cn/base/` + +**Bitable Doc Block**(文档内嵌): +- 调用「获取文档所有块」API,`bitable.token` 字段值用 `_` 分隔 = `app_token_tableId` + +**Bitable Sheet Block**(表格内嵌): +- 调用「获取表格元数据」API,`blockType=BITABLE_BLOCK` 时 `blockToken` 用 `_` 分隔 + +### 多维表格三种形态 + +| 形态 | URL 特征 | 说明 | +|------|---------|------| +| Bitable App | `feishu.cn/base` | 飞书云文档中独立创建 | +| Bitable Doc Block | `feishu.cn/docs` 或 `feishu.cn/docx` | 飞书文档中插入 | +| Bitable Sheet Block | `feishu.cn/sheets` | 飞书表格中新建 | + +### 每种资源的 API 方法一览 + +| 资源 | 方法 | +|------|------| +| App | Get, Update | +| Table | List, Create, BatchCreate, Delete, BatchDelete | +| View | List, Create, Delete, Get, Update | +| Record | List, Get, Create, BatchCreate, Update, BatchUpdate, Delete, BatchDelete | +| Field | List, Create, Update, Delete | +| Role | List, Create, Update, Delete | +| Member | List, Create, Delete, BatchCreate, BatchDelete | +| Dashboard | List, Copy | +| Form | GetMeta, UpdateMeta, ListFields, UpdateField | + +### 容量限制 + +| 资源 | 限制 | +|------|------| +| 记录 | 最多 20,000 条/表 | +| 字段 | 最多 150 个/表 | +| 视图 | 最多 200 个/表 | +| 数据表 | 最多 100 个/App | +| 自定义权限 | 最多 30 条/App | +| 权限协作者 | 最多 200 个/角色 | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/attachment.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/attachment.md new file mode 100644 index 0000000..26a23f4 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/attachment.md @@ -0,0 +1,74 @@ +# 附件字段说明 + +- **DDS-Section**: A.6 附件字段说明 +- **DDS-Lines**: L1370-L1541 + +## Extract + +### 附件对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `file_token` | string | 附件 token(用于下载) | +| `name` | string | 附件名称 | +| `type` | string | MIME 类型,如 `image/png` | +| `size` | int | 文件大小(字节) | +| `url` | string | 附件 URL | +| `tmp_url` | string | 临时下载链接(需 access token 鉴权) | + +### 上传附件 + +**步骤**: +1. 先调用云空间文件上传 API 获得 `file_token` +2. 再将 `file_token` 写入记录的附件字段 + +**上传接口**:`POST /open-apis/drive/v1/medias/upload_all` + +```go +// 上传文件到多维表格 +req := larkdrive.NewUploadAllMediaReqBuilder(). + Body(larkdrive.NewUploadAllMediaReqBodyBuilder(). + FileName("test.pdf"). + ParentType("bitable_file"). + ParentNode(appToken). + Size(fileSize). + File(fileReader). + Build()). + Build() + +resp, err := client.Drive.V1.Media.UploadAll(ctx, req) +// 从 resp 中获取 file_token +``` + +**写入记录**: +```json +{ + "fields": { + "附件字段": [{"file_token": "获得的file_token"}] + } +} +``` + +### 下载附件 + +**方式一**:使用 `tmp_url`(临时下载链接) +- 附件对象中的 `tmp_url` 字段提供临时下载能力 +- 需要携带 `access_token` 进行鉴权 + +**方式二**:使用云空间下载 API +- `GET /open-apis/drive/v1/medias/:file_token/download` + +```go +req := larkdrive.NewDownloadMediaReqBuilder(). + FileToken(fileToken). + Build() + +resp, err := client.Drive.V1.Media.Download(ctx, req) +// resp.File 即文件内容(io.Reader) +``` + +### 注意事项 + +- `parent_type` 对于多维表格固定为 `"bitable_file"` +- `parent_node` 为多维表格的 `app_token` +- 上传大文件时需要使用分片上传 API diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/filter-guide.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/filter-guide.md new file mode 100644 index 0000000..a4fdacc --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/filter-guide.md @@ -0,0 +1,81 @@ +# 记录筛选 Filter 公式指南 + +- **DDS-Section**: A.4 记录筛选开发指南 +- **DDS-Lines**: L614-L707 + +## Extract + +### 语法基础 + +- 表达式语法:`CurrentValue.[字段名]`(C 和 V 必须**大写**) +- 支持公式语法,可通过 `AND` 或 `OR` 组合 +- ⚠️ URL 编码注意:`+` 号需编码为 `%2B` + +### 常用运算符 + +| 逻辑 | 表达式 | +|------|--------| +| 为空 | `CurrentValue.[字段名] = ""` | +| 不为空 | `NOT(CurrentValue.[字段名] = "")` | +| 等于 | `CurrentValue.[字段名] = "值"` | +| 不等于 | `CurrentValue.[字段名] != "值"` | +| 大于等于 | `CurrentValue.[字段名] >= 10.5` | +| 小于等于 | `CurrentValue.[字段名] <= "值"` | +| 包含 | `CurrentValue.[字段名].contains("值")` | +| 不包含 | `NOT(CurrentValue.[字段名].contains("值"))` | +| 与 | `AND(表达式1, 表达式2)` 或 `表达式1&&表达式2` | +| 或 | `OR(表达式1, 表达式2)` | + +### 日期表达式 + +| 场景 | 表达式 | +|------|--------| +| 今天 | `CurrentValue.[日期] = TODAY()` | +| 昨天 | `CurrentValue.[日期] = TODAY()-1` | +| 明天 | `CurrentValue.[日期] = TODAY()%2B1` | +| 本周 | `AND(TODAY()-(WEEKDAY(TODAY(),2)-1)<=CurrentValue.[日期], CurrentValue.[日期]<=TODAY()%2B(7-WEEKDAY(TODAY(),2)))` | +| 本月 | `AND(DATE(YEAR(TODAY()),MONTH(TODAY()),1)<=CurrentValue.[日期], CurrentValue.[日期]<=DATE(YEAR(TODAY()),MONTH(TODAY())%2B1,0))` | +| 过去 N 天 | `today()-N%2B1 <= CurrentValue.[日期]&&CurrentValue.[日期] <= today()` | +| 未来 N 天 | `today()<= CurrentValue.[日期]&&CurrentValue.[日期] <= today()%2BN-1` | +| 日期范围 | `CurrentValue.[日期] > TODATE("2021-06-01")&&CurrentValue.[日期] < TODATE("2021-06-30")` | + +### 各字段类型筛选示例 + +| 字段类型 | 示例 | +|---------|------| +| 多行文本 | `CurrentValue.[字段名]="内容a"` | +| 单选 | `CurrentValue.[字段名]="选项内容a"` | +| 多选 | `CurrentValue.[字段名]="选项内容a"` | +| 人员 | `CurrentValue.[人员]="姓名"` | +| 电话号码 | `CurrentValue.[电话号码]="+2020202020"` | +| 日期 | `CurrentValue.[日期] = TODAY()` | +| 数字 | `CurrentValue.[字段名]=1` | +| 复选框 | `CurrentValue.[字段名]=1`(1=选中) | +| 超链接 | `CurrentValue.[超链接]="文本值"`(匹配文本部分) | +| 公式 | 数字返回值不需引号:`CurrentValue.[公式]=123` | +| 创建人/修改人 | `CurrentValue.[创建人]="人名"` | +| 创建时间/更新时间 | `CurrentValue.[创建时间]>TODAY()` | +| 自动编号 | `CurrentValue.[自动编号]="001no20220624"` | +| 单向关联 | `CurrentValue.[关联字段]="内容"` | + +### Go 代码中使用 Filter + +```go +import "net/url" + +// 构建 filter 表达式 +filter := `AND(CurrentValue.[状态]="进行中", CurrentValue.[优先级]>=3)` + +req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken(appToken). + TableId(tableId). + Filter(filter). // SDK 会自动处理 URL 编码 + PageSize(500). + Build() +``` + +### ⚠️ 常见陷阱 + +1. `CurrentValue` 首字母 C 和 V 必须大写 +2. `+` 号在 URL 中会被解析为空格,必须编码为 `%2B`(如 `TODAY()+1` → `TODAY()%2B1`) +3. 字段名使用方括号 `[]` 包裹,中间为字段名原文(非 field_id) diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/record-apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/record-apis.md new file mode 100644 index 0000000..05dc63a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/record-apis.md @@ -0,0 +1,102 @@ +# Record CRUD API 参考 + +- **DDS-Section**: A.1 概述 - 资源:记录 Record / A.29-A.36 记录 API +- **DDS-Lines**: L172-L196, L8506-L12086 + +## Extract + +### API 路径总览 + +| 操作 | 方法 | 路径 | +|------|------|------| +| 列出记录 | `GET` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records` | +| 检索记录 | `GET` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id` | +| 新增记录 | `POST` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records` | +| 新增多条 | `POST` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create` | +| 更新记录 | `PUT` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id` | +| 更新多条 | `POST` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update` | +| 删除记录 | `DELETE` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id` | +| 删除多条 | `POST` | `/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete` | + +### Go SDK 方法映射 + +```go +client.Bitable.V1.AppTableRecord.List(ctx, req) +client.Bitable.V1.AppTableRecord.Get(ctx, req) +client.Bitable.V1.AppTableRecord.Create(ctx, req) +client.Bitable.V1.AppTableRecord.BatchCreate(ctx, req) +client.Bitable.V1.AppTableRecord.Update(ctx, req) +client.Bitable.V1.AppTableRecord.BatchUpdate(ctx, req) +client.Bitable.V1.AppTableRecord.Delete(ctx, req) +client.Bitable.V1.AppTableRecord.BatchDelete(ctx, req) +``` + +### 关键约束 + +| 约束 | 说明 | +|------|------| +| 单次列出上限 | **500 条**(通过 `page_token` 分页) | +| 批量操作上限 | **500 条/次** | +| 批量结果 | **全部成功或全部失败**,无部分结果 | +| 并发写入 | 同一时刻对同一多维表格最好**只请求一次写操作** | +| 权限 | 读取需「查看、评论和导出」;写入需「查看、评论、编辑和管理」 | + +### 列出记录 - 关键参数 + +| 参数 | 类型 | 说明 | +|------|------|------| +| `app_token` | string | 多维表格 token(必填) | +| `table_id` | string | 数据表 ID(必填) | +| `view_id` | string | 视图 ID(可选,指定视图范围) | +| `filter` | string | 筛选表达式(可选,语法见 filter-guide.md) | +| `sort` | string | 排序条件(可选) | +| `field_names` | string | 指定返回的字段名(可选,逗号分隔) | +| `page_size` | int | 每页数量(可选,最大 500) | +| `page_token` | string | 分页标记(可选) | + +### 新增/更新记录 - 请求体 + +```json +{ + "fields": { + "文本字段": "hello", + "数字字段": 42, + "单选字段": "选项A", + "多选字段": ["选项A", "选项B"], + "日期字段": 1672531200000, + "复选框": true, + "人员字段": [{"id": "ou_xxx"}], + "超链接": {"text": "飞书", "link": "https://www.feishu.cn"}, + "电话号码": "+8613800138000", + "单向关联": ["recXXX1", "recXXX2"] + } +} +``` + +### 批量新增 - 请求体 + +```json +{ + "records": [ + {"fields": {"字段1": "值1"}}, + {"fields": {"字段1": "值2"}} + ] +} +``` + +### 批量删除 - 请求体 + +```json +{ + "records": ["recXXX1", "recXXX2"] +} +``` + +### 删除结果结构 + +```json +{ + "deleted": true, + "record_id": "recXXX" +} +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/table-view-field-apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/table-view-field-apis.md new file mode 100644 index 0000000..5863a00 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/03-api-reference/table-view-field-apis.md @@ -0,0 +1,71 @@ +# Table / View / Field / App API 参考 + +- **DDS-Section**: A.1 概述 - 各资源方法列表 / A.10-A.28, A.37-A.40 +- **DDS-Lines**: L111-L260, L1932-L7926, L12655-L13935 + +## Extract + +### App API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 获取元数据 | `GET` | `/open-apis/bitable/v1/apps/:app_token` | `client.Bitable.V1.App.Get` | +| 更新元数据 | `PUT` | `/open-apis/bitable/v1/apps/:app_token` | `client.Bitable.V1.App.Update` | + +更新元数据可用于:修改多维表格名称、**开启/关闭高级权限**。 + +### Table API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出数据表 | `GET` | `.../tables` | `client.Bitable.V1.AppTable.List` | +| 新增数据表 | `POST` | `.../tables` | `client.Bitable.V1.AppTable.Create` | +| 新增多个表 | `POST` | `.../tables/batch_create` | `client.Bitable.V1.AppTable.BatchCreate` | +| 删除数据表 | `DELETE` | `.../tables/:table_id` | `client.Bitable.V1.AppTable.Delete` | +| 删除多个表 | `POST` | `.../tables/batch_delete` | `client.Bitable.V1.AppTable.BatchDelete` | + +### View API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出视图 | `GET` | `.../views` | `client.Bitable.V1.AppTableView.List` | +| 检索视图 | `GET` | `.../views/:view_id` | `client.Bitable.V1.AppTableView.Get` | +| 新增视图 | `POST` | `.../views` | `client.Bitable.V1.AppTableView.Create` | +| 更新视图 | `PATCH` | `.../views/:view_id` | `client.Bitable.V1.AppTableView.Patch` | +| 删除视图 | `DELETE` | `.../views/:view_id` | `client.Bitable.V1.AppTableView.Delete` | + +### Field API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出字段 | `GET` | `.../fields` | `client.Bitable.V1.AppTableField.List` | +| 新增字段 | `POST` | `.../fields` | `client.Bitable.V1.AppTableField.Create` | +| 更新字段 | `PUT` | `.../fields/:field_id` | `client.Bitable.V1.AppTableField.Update` | +| 删除字段 | `DELETE` | `.../fields/:field_id` | `client.Bitable.V1.AppTableField.Delete` | + +### Dashboard API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出仪表盘 | `GET` | `.../dashboards` | `client.Bitable.V1.AppDashboard.List` | +| 复制仪表盘 | `POST` | `.../dashboards/:block_id/copy` | `client.Bitable.V1.AppDashboard.Copy` | + +### Form API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 获取表单元数据 | `GET` | `.../forms/:form_id` | `client.Bitable.V1.AppTableFormField` | +| 更新表单元数据 | `PATCH` | `.../forms/:form_id` | (同上) | +| 列出表单问题 | `GET` | `.../forms/:form_id/fields` | (同上) | +| 更新表单问题 | `PATCH` | `.../forms/:form_id/fields/:field_id` | (同上) | + +### 权限要求 + +| 操作类型 | 所需权限 | +|---------|---------| +| 读取(List/Get) | `查看、评论和导出多维表格` | +| 写入(Create/Update/Delete) | `查看、评论、编辑和管理多维表格` | + +### 凭证支持 + +所有 Bitable API 同时支持 `tenant_access_token` 和 `user_access_token`。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/field-changed.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/field-changed.md new file mode 100644 index 0000000..4d6ab22 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/field-changed.md @@ -0,0 +1,65 @@ +# 多维表格字段变更事件 + +- **DDS-Section**: A.8 多维表格字段变更 +- **DDS-Lines**: L1595-L1810 + +## Extract + +### 事件概述 + +| 属性 | 值 | +|------|------| +| 事件类型 | `drive.file.bitable_field_changed_v1` | +| 支持的应用类型 | 自建应用、商店应用 | +| 权限要求 | 查看、评论、编辑和管理多维表格 **或** 查看、评论、编辑和管理云空间中所有文件 | +| 推送方式 | Webhook | +| 字段权限要求 | 获取用户 user ID(仅自建应用) | + +### 事件体核心字段 + +| 名称 | 类型 | 说明 | +|------|------|------| +| `file_type` | string | 文档类型,固定 `"bitable"` | +| `file_token` | string | 多维表格 token(即 app_token) | +| `table_id` | string | 数据表 ID | +| `operator_id` | user_id | 操作人(含 union_id, user_id, open_id) | +| `action_list` | array | 字段变更操作列表 | +| `revision` | int | 数据表版本号 | +| `update_time` | int | 变更时间(时间戳) | +| `subscriber_id_list` | array | 订阅用户列表 | + +### action_list 中每个操作的结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `action` | string | 操作类型(如 field_added, field_edited, field_deleted) | +| `field_id` | string | 字段 ID | +| `before_value` | object | 操作前的字段定义 | +| `after_value` | object | 操作后的字段定义 | + +### before_value / after_value 字段定义结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `id` | string | 字段 ID | +| `name` | string | 字段名字 | +| `type` | int | 字段类型 | +| `description` | string | 字段描述 | +| `property` | object | 字段属性(含 formatter, date_formatter, auto_fill, multiple, table_id, options 等) | + +### property 中嵌套结构 + +**数字/公式字段**:`formatter` (string) +**日期/创建时间/更新时间字段**:`date_formatter` (string), `auto_fill` (boolean) +**人员/关联字段**:`multiple` (boolean), `table_id` (string), `table_name` (string) +**双向关联**:`back_field_name`, `back_field_id` +**自动编号**:`auto_serial.type`, `auto_serial.options[]` +**单选/多选**:`options[].name`, `options[].id`, `options[].color` +**公式**:`formula_expression` +**地理位置**:`input_type` + +### 使用场景 + +- 监控字段结构变化,自动更新本地 Schema 映射 +- 检测字段被删除/重命名,发送报警通知 +- 审计字段配置变更历史 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/record-changed.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/record-changed.md new file mode 100644 index 0000000..33ee5aa --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/04-events/record-changed.md @@ -0,0 +1,126 @@ +# 多维表格记录变更事件 + +- **DDS-Section**: A.9 多维表格记录变更 +- **DDS-Lines**: L1811-L1928 + +## Extract + +### 事件概述 + +| 属性 | 值 | +|------|------| +| 事件类型 | `drive.file.bitable_record_changed_v1` | +| 支持的应用类型 | 自建应用、商店应用 | +| 权限要求 | 查看、评论、编辑和管理多维表格 **或** 查看、评论、编辑和管理云空间中所有文件 | +| 推送方式 | WebSocket 长连接 或 Webhook | +| 触发条件 | 被订阅的多维表格记录发生变更 | + +### ⚠️ 关键限制 + +- **公式字段的值变化不会触发事件** +- 需要先订阅文档事件:调用「订阅云文档事件」API + +### 支持的变更类型 + +| 变更类型 | action 值 | +|---------|----------| +| 新增行记录 | `record_added` | +| 删除行记录 | `record_deleted` | +| 修改行记录 | `record_edited` | + +### 事件回调体结构 + +```json +{ + "schema": "2.0", + "header": { + "event_id": "85ec04b2f6cff27a1bf249b26fbabcef", + "token": "L3bzVf0sz7qb9XoTavpsHe0uJv7abcef", + "create_time": "1652677457000", + "event_type": "drive.file.bitable_record_changed_v1", + "tenant_key": "736588c9260abcef", + "app_id": "cli_a00c8400a7babcef" + }, + "event": { + "file_token": "bascnItn6oHUSEL8RDUdF6abcef", + "file_type": "bitable", + "table_id": "tblOaqBWfGeabcef", + "operator_id": { + "open_id": "ou_xxx", + "union_id": "on_xxx", + "user_id": "638abcef" + }, + "action_list": [ + { + "action": "record_edited", + "record_id": "rec9sabcef", + "before_value": [ + {"field_id": "fld9Eabcef", "field_value": "123"} + ], + "after_value": [ + {"field_id": "fld9Eabcef", "field_value": "666"} + ] + } + ], + "subscriber_id_list": [ + {"open_id": "ou_xxx", "union_id": "on_xxx", "user_id": "638abcef"} + ] + } +} +``` + +### action_list 中对象结构 + +| 字段 | 类型 | 说明 | +|------|------|------| +| `action` | string | 变更类型:`record_added` / `record_edited` / `record_deleted` | +| `record_id` | string | 发生变更的记录 ID | +| `before_value` | array | 变更前的字段值列表(新增时为空) | +| `after_value` | array | 变更后的字段值列表(删除时为空) | + +### field_value 说明 + +- `field_value` 是 JSON 序列化后的**字符串** +- 反序列化前的结构参考「数据结构」文档(field-types.md) +- 富文本类型的 field_value 示例:`"[{\"type\":\"text\",\"text\":\"变更后的值\"}]"` + +### Go 代码处理示例 + +```go +eventHandler := dispatcher.NewEventDispatcher("", ""). + OnCustomizedEvent("drive.file.bitable_record_changed_v1", + func(ctx context.Context, event *larkevent.EventReq) error { + // 解析事件体 + var body struct { + Event struct { + FileToken string `json:"file_token"` + TableId string `json:"table_id"` + ActionList []struct { + Action string `json:"action"` + RecordId string `json:"record_id"` + BeforeValue []struct { + FieldId string `json:"field_id"` + FieldValue string `json:"field_value"` + } `json:"before_value"` + AfterValue []struct { + FieldId string `json:"field_id"` + FieldValue string `json:"field_value"` + } `json:"after_value"` + } `json:"action_list"` + } `json:"event"` + } + json.Unmarshal(event.Body, &body) + + for _, action := range body.Event.ActionList { + switch action.Action { + case "record_added": + // 处理新增 + case "record_edited": + // 处理修改 + case "record_deleted": + // 处理删除 + } + } + return nil // 3 秒内返回 + }) +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/auth-and-limits.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/auth-and-limits.md new file mode 100644 index 0000000..988a914 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/auth-and-limits.md @@ -0,0 +1,41 @@ +# 鉴权模式与 QPS 限制 + +- **DDS-Section**: A.2 接入指南 - 3.鉴权 / 4.限制 +- **DDS-Lines**: L311-L384 + +## Extract + +### 两种凭证模式 + +| 凭证 | 说明 | 有效期 | 刷新策略 | 适用场景 | +|------|------|--------|---------|---------| +| `user_access_token` | 用户身份鉴权 | 7200 秒 | 刷新后老 token **立即失效** | 小程序、网页应用 | +| `tenant_access_token` | 应用身份鉴权 | 2 小时 | 有效期 < 30 分钟时可刷新,新老 token **同时有效** | 纯后端服务 | + +### 使用 tenant_access_token 的前提 + +1. **必须**确保应用已经是目标文档的所有者或协作者 +2. 可先用 `tenant_access_token` 创建多维表格,则应用自动成为所有者 +3. 或通过文档权限 API 将应用添加为协作者 + +### SDK Token 管理 + +- SDK 自动托管 `tenant_access_token` (获取 + 缓存 + 刷新) +- SDK **不**托管 `user_access_token`,需自行实现 +- 商店应用调用需附带 `larkcore.WithTenantKey(tenantKey)` + +### QPS 限制 + +- 每个接口都有频率限制,参考飞书官方[频控策略](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN) +- 批量操作单次最高 500 条记录 + +### 接口报错处理 + +- 部分参数不符合要求导致报错时,**整个请求全部失败**,不会部分生效 +- 错误响应中包含 `code`(错误码)和 `msg`(错误信息) +- 可通过错误码查阅[服务端错误码说明](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN) +- 调用失败时记录 `resp.RequestId()` 以便排查 + +### 部分接口的凭证限制 + +大部分 Bitable 接口同时支持 `tenant_access_token` 和 `user_access_token`,但仍有部分接口只支持其中一种。调用前需仔细阅读对应接口文档。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/role-member-apis.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/role-member-apis.md new file mode 100644 index 0000000..e2f364e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/05-permissions/role-member-apis.md @@ -0,0 +1,68 @@ +# 高级权限 Role / Member API + +- **DDS-Section**: A.7 概述(高级权限) / A.41-A.49 +- **DDS-Lines**: L1541-L1591, L14354-L16470 + +## Extract + +### 前置条件 + +1. 多维表格必须**已开启高级权限**(通过「更新多维表格元数据」API 开启) +2. ⚠️ 开启后有延迟,立即调用可能遇到 `OperationTypeError`,需重试 +3. 飞书文档、飞书表格、知识库中的多维表格**不支持**开启高级权限 +4. 暂不支持仪表盘权限 + +### 高级权限 vs 云文档权限 + +高级权限的协作者与云文档权限协作者是**不同的权限身份**。添加高级权限协作者后,建议同时通过「增加协作者权限」API 新增文档权限。 + +### Role(自定义角色)API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出角色 | `GET` | `.../roles` | `client.Bitable.V1.AppRole.List` | +| 新增角色 | `POST` | `.../roles` | `client.Bitable.V1.AppRole.Create` | +| 更新角色 | `PUT` | `.../roles/:role_id` | `client.Bitable.V1.AppRole.Update` | +| 删除角色 | `DELETE` | `.../roles/:role_id` | `client.Bitable.V1.AppRole.Delete` | + +### Member(协作者)API + +| 操作 | 方法 | 路径 | SDK 方法 | +|------|------|------|---------| +| 列出协作者 | `GET` | `.../roles/:role_id/members` | `client.Bitable.V1.AppRoleMember.List` | +| 新增协作者 | `POST` | `.../roles/:role_id/members` | `client.Bitable.V1.AppRoleMember.Create` | +| 删除协作者 | `DELETE` | `.../roles/:role_id/members/:member_id` | `client.Bitable.V1.AppRoleMember.Delete` | +| 批量新增 | `POST` | `.../roles/:role_id/members/batch_create` | `client.Bitable.V1.AppRoleMember.BatchCreate` | +| 批量删除 | `POST` | `.../roles/:role_id/members/batch_delete` | `client.Bitable.V1.AppRoleMember.BatchDelete` | + +### 容量限制 + +| 资源 | 限制 | +|------|------| +| 自定义权限 | 最多 30 条/App | +| 协作者 | 最多 200 个/角色 | + +### 角色功能 + +自定义角色可以针对每个数据表设置: +- 谁可以查看指定的行 +- 谁可以编辑指定的行 +- 指定可以编辑的列 + +### 工作流程 + +``` +1. 调用 App.Update 开启高级权限 + ↓ +2. 调用 AppRole.Create 创建自定义角色 + ↓ +3. 调用 AppRole.Update 配置角色的表/行/列权限 + ↓ +4. 调用 AppRoleMember.Create 添加协作者到角色 + ↓ +5.(建议)调用 drive.Permission.Member.Create 添加文档权限 +``` + +### 权限要求 + +所有高级权限 API 均需要 `查看、评论、编辑和管理多维表格` 权限。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/06-faq/common-issues.md b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/06-faq/common-issues.md new file mode 100644 index 0000000..0472dbc --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/reference/06-faq/common-issues.md @@ -0,0 +1,57 @@ +# SDK 常见问题 + +- **DDS-Section**: B.7 常见问题 +- **DDS-Lines**: L18097-L18212 + +## Extract + +### Q: API 调试台的 token 获取代码提示找不到方法? + +**A**: SDK 已封装 tenant_access_token/app_access_token 的获取与缓存逻辑。构建 Client 时传入 App ID 和 App Secret 即可,**不需要手动获取 Token**。 + +### Q: 调试台成功但示例代码调用失败? + +**A**: 调试台代码根据参数自动生成,需要: +1. 在调试台中先配置好参数再复制代码 +2. 手动替换 App ID 和 App Secret(从开发者后台 > 应用详情 > 凭证与基础信息获取) + +### Q: 如何确认某接口在 SDK 中是否支持? + +**A**: 查看接口文档,有「尝试一下」按钮的表示 SDK 已支持。不支持的接口可用 `client.Do()` 原生调用。 + +### Q: 如何调用 SDK 不支持的接口? + +**A**: 使用原生 API 调用方式,传入 HTTP Method、URL 和参数: + +```go +resp, err := client.Do(ctx, &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/xxx", + ... +}) +``` + +### Q: 下载文件时文件名特殊字符导致报错? + +**A**: 使用 SDK 原生模式调用 API(`client.Do()`),绕过文件名校验。 + +### Q: 如何配置私有部署/代理服务器? + +**A**: Go SDK 可通过自定义 HTTP Client 实现。Java SDK 示例见文档,Go 中可传入自定义 transport。 + +### Q: 调用失败有 code 和 logid 如何排查? + +**A**: +1. 在[飞书开发文档](https://open.larkoffice.com/document/home/index)搜索栏输入错误码(code)或日志 ID(logid)查询 +2. 如无法解决,提交[技术支持](https://applink.feishu.cn/TLJpeNdW) + +### Q: 接收事件时重复收到事件? + +**A**: 服务器需在 **3 秒内以 HTTP 200** 响应,否则开放平台认为推送失败会**重新推送**。确保事件处理速度足够快,耗时操作应异步化。 + +### 开发排错要点 + +1. 检查 `resp.Success()` 和 `resp.Code` +2. 记录 `resp.RequestId()` 用于反馈给飞书支持 +3. 开启 `larkcore.LogLevelDebug` 查看请求/响应详情 +4. 确认应用权限是否已开启,文档协作者是否已添加 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/scripts/verify.sh b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/scripts/verify.sh new file mode 100644 index 0000000..6c88176 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/developing-feishu-bitable/scripts/verify.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# verify.sh - developing-feishu-bitable Skill 结构与内容验证 +set -e + +PASS=0; FAIL=0 +check() { + if eval "$2"; then + echo "✅ PASS: $1"; ((PASS++)) + else + echo "❌ FAIL: $1"; ((FAIL++)) + fi +} + +SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" + +# === 结构检查 === +check "SKILL.md 存在" "test -f '$SKILL_DIR/SKILL.md'" +check "reference/ 目录存在" "test -d '$SKILL_DIR/reference'" +check "SKILL.md < 500 行" "[ $(wc -l < '$SKILL_DIR/SKILL.md') -lt 500 ]" + +# === Frontmatter 检查 === +check "frontmatter 包含 name" "head -20 '$SKILL_DIR/SKILL.md' | grep -q '^name:'" +check "frontmatter 包含 description" "head -20 '$SKILL_DIR/SKILL.md' | grep -q '^description:'" +check "name 为 developing-feishu-bitable" "head -5 '$SKILL_DIR/SKILL.md' | grep -q 'developing-feishu-bitable'" + +# === 章节检查 === +check "包含 Quick Context 章节" "grep -q '## Quick Context' '$SKILL_DIR/SKILL.md'" +check "包含 Plan 章节" "grep -q '## Plan' '$SKILL_DIR/SKILL.md'" +check "包含 Verify 章节" "grep -q '## Verify' '$SKILL_DIR/SKILL.md'" +check "包含 Execute 章节" "grep -q '## Execute' '$SKILL_DIR/SKILL.md'" +check "包含 Pitfalls 章节" "grep -q '## Pitfalls' '$SKILL_DIR/SKILL.md'" +check "包含 Related References 章节" "grep -q '## Related References' '$SKILL_DIR/SKILL.md'" + +# === 动态注入检查 === +check "包含 >= 2 处动态注入命令" "[ $(grep -c '!\`' '$SKILL_DIR/SKILL.md') -ge 2 ]" + +# === reference 检查 === +check "reference 有 01-sdk-guide 目录" "test -d '$SKILL_DIR/reference/01-sdk-guide'" +check "reference 有 02-data-model 目录" "test -d '$SKILL_DIR/reference/02-data-model'" +check "reference 有 03-api-reference 目录" "test -d '$SKILL_DIR/reference/03-api-reference'" +check "reference 有 04-events 目录" "test -d '$SKILL_DIR/reference/04-events'" +check "reference 有 05-permissions 目录" "test -d '$SKILL_DIR/reference/05-permissions'" +check "reference 有 06-faq 目录" "test -d '$SKILL_DIR/reference/06-faq'" +check "reference 文件含 DDS-Section" "grep -rq 'DDS-Section:' '$SKILL_DIR/reference/' 2>/dev/null" +check "reference 文件含 DDS-Lines" "grep -rq 'DDS-Lines:' '$SKILL_DIR/reference/' 2>/dev/null" + +# === Pitfalls 引用检查 === +check "Pitfalls >= 2 条引用 reference" "[ $(grep -c 'reference/' '$SKILL_DIR/SKILL.md' | head -1) -ge 2 ]" + +# === 唯一收敛性检查 === +check "不存在系统级 Skill" "! find '$SKILL_DIR/..' -maxdepth 1 -type d -name '*-system' | grep -q ." +check "不存在 managing-* Skill" "! find '$SKILL_DIR/..' -maxdepth 1 -type d -name 'managing-*' | grep -q ." +check "不存在 designing-* Skill" "! find '$SKILL_DIR/..' -maxdepth 1 -type d -name 'designing-*' | grep -q ." + +echo "" +echo "=== 结果: $PASS PASS / $FAIL FAIL ===" +[ $FAIL -eq 0 ] && exit 0 || exit 1 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/README.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/README.md new file mode 100644 index 0000000..b888c35 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/README.md @@ -0,0 +1,14 @@ +# 飞书多维表格离线资料包 v2 + +## 离线入口 + +1. 主参考文档:..\飞书多维表格开发文档-完整参考-v2.md +2. Bitable 原始页:sources\bitable-md +3. Golang SDK 指南:sources\go-sdk-md +4. Go 示例代码:go-sdk-examples +5. 索引清单:manifest.csv + +## 说明 + +- 本目录中的文档源自 Feishu API 参考页面(通过 .md 导出)。 +- 已包含 Bitable v1 全子页与 Golang SDK 指南页面,可离线查看。 \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_004c6c488584e3637d9497b4bf76c93fddada9fe.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_004c6c488584e3637d9497b4bf76c93fddada9fe.png new file mode 100644 index 0000000..0b69139 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_004c6c488584e3637d9497b4bf76c93fddada9fe.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png new file mode 100644 index 0000000..a508e1d Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_14898d1baed2eb032eb48a98ec19154f6a50cdd1.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_14898d1baed2eb032eb48a98ec19154f6a50cdd1.png new file mode 100644 index 0000000..a9e2043 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_14898d1baed2eb032eb48a98ec19154f6a50cdd1.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_2ff482eb48a16372e75c62e539acb11c01c38ffb.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_2ff482eb48a16372e75c62e539acb11c01c38ffb.png new file mode 100644 index 0000000..b9dce01 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_2ff482eb48a16372e75c62e539acb11c01c38ffb.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3081ff12c2b38a28452241099b5188852ee1636a.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3081ff12c2b38a28452241099b5188852ee1636a.png new file mode 100644 index 0000000..b9dce01 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3081ff12c2b38a28452241099b5188852ee1636a.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_364d682b8f54707e57ef6316e20c3c982faf16cd.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_364d682b8f54707e57ef6316e20c3c982faf16cd.png new file mode 100644 index 0000000..ecf32fb Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_364d682b8f54707e57ef6316e20c3c982faf16cd.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png new file mode 100644 index 0000000..f74655f Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png new file mode 100644 index 0000000..b9dce01 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_44427ad80f813abf93524b824cc2765b4ac33fc3.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_44427ad80f813abf93524b824cc2765b4ac33fc3.png new file mode 100644 index 0000000..8843768 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_44427ad80f813abf93524b824cc2765b4ac33fc3.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_46e78ff1d6f554ae8875726b56c2edece62541a4.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_46e78ff1d6f554ae8875726b56c2edece62541a4.png new file mode 100644 index 0000000..85b5864 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_46e78ff1d6f554ae8875726b56c2edece62541a4.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png new file mode 100644 index 0000000..20a8436 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4c9cc48d695e73d892c9da4c2e566365b9937dc1.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4c9cc48d695e73d892c9da4c2e566365b9937dc1.png new file mode 100644 index 0000000..523aac8 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4c9cc48d695e73d892c9da4c2e566365b9937dc1.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4d673f008fffcce4428d24f1913905c4a7f83eba.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4d673f008fffcce4428d24f1913905c4a7f83eba.png new file mode 100644 index 0000000..8e802e7 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_4d673f008fffcce4428d24f1913905c4a7f83eba.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png new file mode 100644 index 0000000..df52eac Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_55990417f8118de94187eb5006484ad6b0c34e87.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_55990417f8118de94187eb5006484ad6b0c34e87.png new file mode 100644 index 0000000..83089ff Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_55990417f8118de94187eb5006484ad6b0c34e87.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_5879690e78fa7a82b661c4606286ca1fc3804345.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_5879690e78fa7a82b661c4606286ca1fc3804345.png new file mode 100644 index 0000000..e605011 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_5879690e78fa7a82b661c4606286ca1fc3804345.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_679c4aceff414bfc299dbaeb850dd2313cdb3201.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_679c4aceff414bfc299dbaeb850dd2313cdb3201.png new file mode 100644 index 0000000..8946027 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_679c4aceff414bfc299dbaeb850dd2313cdb3201.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_704483242d64efb2212090e79e605dfc683560e4.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_704483242d64efb2212090e79e605dfc683560e4.png new file mode 100644 index 0000000..fb2142a Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_704483242d64efb2212090e79e605dfc683560e4.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_77e8081c5e3e797636b2e4a32ecddb488801348f.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_77e8081c5e3e797636b2e4a32ecddb488801348f.png new file mode 100644 index 0000000..2ae9fb6 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_77e8081c5e3e797636b2e4a32ecddb488801348f.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png new file mode 100644 index 0000000..573e5d7 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png new file mode 100644 index 0000000..261485f Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_9f24b8e8a20a267845c3bc352ad6c8a2bcbd3324.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_9f24b8e8a20a267845c3bc352ad6c8a2bcbd3324.png new file mode 100644 index 0000000..acb99bf Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_9f24b8e8a20a267845c3bc352ad6c8a2bcbd3324.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png new file mode 100644 index 0000000..3910e85 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png new file mode 100644 index 0000000..f768226 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ad16e0cdb84b697edbcabd3157ae60ed699379a3.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ad16e0cdb84b697edbcabd3157ae60ed699379a3.png new file mode 100644 index 0000000..b9dce01 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ad16e0cdb84b697edbcabd3157ae60ed699379a3.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_b584f19e7218e5ce3163d549b65b0a351cdba1fe.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_b584f19e7218e5ce3163d549b65b0a351cdba1fe.png new file mode 100644 index 0000000..509c84a Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_b584f19e7218e5ce3163d549b65b0a351cdba1fe.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png new file mode 100644 index 0000000..593c57a Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_beba130b4d3356c65c5d3c8794963c7687b86acd.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_beba130b4d3356c65c5d3c8794963c7687b86acd.png new file mode 100644 index 0000000..7593768 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_beba130b4d3356c65c5d3c8794963c7687b86acd.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png new file mode 100644 index 0000000..01e6f3e Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ce63ed1c5a8fb02e95d691a01e57e59405865815.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ce63ed1c5a8fb02e95d691a01e57e59405865815.png new file mode 100644 index 0000000..4e6c66d Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_ce63ed1c5a8fb02e95d691a01e57e59405865815.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png new file mode 100644 index 0000000..2155441 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dec71c02ec7fca171c02f759e29e67365e8d3e75.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dec71c02ec7fca171c02f759e29e67365e8d3e75.png new file mode 100644 index 0000000..8bef562 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dec71c02ec7fca171c02f759e29e67365e8d3e75.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dfcf17b29763178f183ee726d9f93e227c13ebd6.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dfcf17b29763178f183ee726d9f93e227c13ebd6.png new file mode 100644 index 0000000..5103e78 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_dfcf17b29763178f183ee726d9f93e227c13ebd6.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png new file mode 100644 index 0000000..684da9d Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_f644398483f6b691846b875f810b87c5b8d30fa0.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_f644398483f6b691846b875f810b87c5b8d30fa0.png new file mode 100644 index 0000000..42335f6 Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_f644398483f6b691846b875f810b87c5b8d30fa0.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png new file mode 100644 index 0000000..540c28d Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png new file mode 100644 index 0000000..170c3fe Binary files /dev/null and b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png differ diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/download-manifest.json b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/download-manifest.json new file mode 100644 index 0000000..19c25ef --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/download-manifest.json @@ -0,0 +1,434 @@ +[ + { + "url": "https://feishu.apifox.cn/api-10753711", + "md_url": "https://feishu.apifox.cn/api-10753711.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-10753711.md", + "ok": true, + "size": 10788, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58952482", + "md_url": "https://feishu.apifox.cn/api-58952482.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58952482.md", + "ok": true, + "size": 8096, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58953650", + "md_url": "https://feishu.apifox.cn/api-58953650.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58953650.md", + "ok": true, + "size": 6147, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58954319", + "md_url": "https://feishu.apifox.cn/api-58954319.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58954319.md", + "ok": true, + "size": 13511, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58955066", + "md_url": "https://feishu.apifox.cn/api-58955066.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58955066.md", + "ok": true, + "size": 20196, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58955123", + "md_url": "https://feishu.apifox.cn/api-58955123.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58955123.md", + "ok": true, + "size": 17134, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58955559", + "md_url": "https://feishu.apifox.cn/api-58955559.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58955559.md", + "ok": true, + "size": 14674, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58956188", + "md_url": "https://feishu.apifox.cn/api-58956188.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58956188.md", + "ok": true, + "size": 14121, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58957318", + "md_url": "https://feishu.apifox.cn/api-58957318.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58957318.md", + "ok": true, + "size": 14741, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58958068", + "md_url": "https://feishu.apifox.cn/api-58958068.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58958068.md", + "ok": true, + "size": 14174, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58961268", + "md_url": "https://feishu.apifox.cn/api-58961268.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58961268.md", + "ok": true, + "size": 18494, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58961961", + "md_url": "https://feishu.apifox.cn/api-58961961.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58961961.md", + "ok": true, + "size": 14617, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58962762", + "md_url": "https://feishu.apifox.cn/api-58962762.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58962762.md", + "ok": true, + "size": 6332, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58963075", + "md_url": "https://feishu.apifox.cn/api-58963075.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58963075.md", + "ok": true, + "size": 26184, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58963324", + "md_url": "https://feishu.apifox.cn/api-58963324.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58963324.md", + "ok": true, + "size": 7269, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58963532", + "md_url": "https://feishu.apifox.cn/api-58963532.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58963532.md", + "ok": true, + "size": 7419, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58963762", + "md_url": "https://feishu.apifox.cn/api-58963762.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58963762.md", + "ok": true, + "size": 10911, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-58963951", + "md_url": "https://feishu.apifox.cn/api-58963951.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-58963951.md", + "ok": true, + "size": 7680, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020910", + "md_url": "https://feishu.apifox.cn/api-9020910.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020910.md", + "ok": true, + "size": 32558, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020911", + "md_url": "https://feishu.apifox.cn/api-9020911.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020911.md", + "ok": true, + "size": 24321, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020912", + "md_url": "https://feishu.apifox.cn/api-9020912.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020912.md", + "ok": true, + "size": 22003, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020913", + "md_url": "https://feishu.apifox.cn/api-9020913.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020913.md", + "ok": true, + "size": 24457, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020914", + "md_url": "https://feishu.apifox.cn/api-9020914.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020914.md", + "ok": true, + "size": 18579, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020915", + "md_url": "https://feishu.apifox.cn/api-9020915.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020915.md", + "ok": true, + "size": 20924, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020916", + "md_url": "https://feishu.apifox.cn/api-9020916.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020916.md", + "ok": true, + "size": 11799, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020917", + "md_url": "https://feishu.apifox.cn/api-9020917.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020917.md", + "ok": true, + "size": 12635, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020918", + "md_url": "https://feishu.apifox.cn/api-9020918.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020918.md", + "ok": true, + "size": 24234, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020919", + "md_url": "https://feishu.apifox.cn/api-9020919.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020919.md", + "ok": true, + "size": 18784, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020920", + "md_url": "https://feishu.apifox.cn/api-9020920.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020920.md", + "ok": true, + "size": 17958, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020921", + "md_url": "https://feishu.apifox.cn/api-9020921.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020921.md", + "ok": true, + "size": 12625, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020922", + "md_url": "https://feishu.apifox.cn/api-9020922.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020922.md", + "ok": true, + "size": 13118, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020923", + "md_url": "https://feishu.apifox.cn/api-9020923.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020923.md", + "ok": true, + "size": 13616, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020924", + "md_url": "https://feishu.apifox.cn/api-9020924.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020924.md", + "ok": true, + "size": 11470, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020925", + "md_url": "https://feishu.apifox.cn/api-9020925.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020925.md", + "ok": true, + "size": 11682, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020926", + "md_url": "https://feishu.apifox.cn/api-9020926.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020926.md", + "ok": true, + "size": 11729, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020927", + "md_url": "https://feishu.apifox.cn/api-9020927.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020927.md", + "ok": true, + "size": 11922, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020928", + "md_url": "https://feishu.apifox.cn/api-9020928.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020928.md", + "ok": true, + "size": 10154, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/api-9020929", + "md_url": "https://feishu.apifox.cn/api-9020929.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_api-9020929.md", + "ok": true, + "size": 10585, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-1949951", + "md_url": "https://feishu.apifox.cn/doc-1949951.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-1949951.md", + "ok": true, + "size": 17227, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-1949955", + "md_url": "https://feishu.apifox.cn/doc-1949955.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-1949955.md", + "ok": true, + "size": 4508, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-1964912", + "md_url": "https://feishu.apifox.cn/doc-1964912.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-1964912.md", + "ok": true, + "size": 5779, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436424", + "md_url": "https://feishu.apifox.cn/doc-436424.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436424.md", + "ok": true, + "size": 21302, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436427", + "md_url": "https://feishu.apifox.cn/doc-436427.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436427.md", + "ok": true, + "size": 15950, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436428", + "md_url": "https://feishu.apifox.cn/doc-436428.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436428.md", + "ok": true, + "size": 7508, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436454", + "md_url": "https://feishu.apifox.cn/doc-436454.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436454.md", + "ok": true, + "size": 4251, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436742", + "md_url": "https://feishu.apifox.cn/doc-436742.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436742.md", + "ok": true, + "size": 22560, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-436743", + "md_url": "https://feishu.apifox.cn/doc-436743.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\bitable-md\\feishu.apifox.cn_doc-436743.md", + "ok": true, + "size": 5191, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-1940248", + "md_url": "https://feishu.apifox.cn/doc-1940248.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-1940248.md", + "ok": true, + "size": 6188, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518657", + "md_url": "https://feishu.apifox.cn/doc-7518657.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518657.md", + "ok": true, + "size": 5990, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518568", + "md_url": "https://feishu.apifox.cn/doc-7518568.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518568.md", + "ok": true, + "size": 2445, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518569", + "md_url": "https://feishu.apifox.cn/doc-7518569.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518569.md", + "ok": true, + "size": 15864, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518571", + "md_url": "https://feishu.apifox.cn/doc-7518571.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518571.md", + "ok": true, + "size": 15134, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518573", + "md_url": "https://feishu.apifox.cn/doc-7518573.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518573.md", + "ok": true, + "size": 17915, + "error": "" + }, + { + "url": "https://feishu.apifox.cn/doc-7518577", + "md_url": "https://feishu.apifox.cn/doc-7518577.md", + "file": "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectAGiPrompt\\18-基础架构及交付部署特战队\\10-飞书多维表格\\offline-docs-v2\\sources\\go-sdk-md\\feishu.apifox.cn_doc-7518577.md", + "ok": true, + "size": 22102, + "error": "" + } +] diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/README-BITABLE.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/README-BITABLE.md new file mode 100644 index 0000000..dcad0d2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/README-BITABLE.md @@ -0,0 +1,57 @@ +# Go SDK 示例代码索引(Bitable) + +## 主要目录 + +1. `oapi-sdk-go/sample/apiall/bitablev1`:Bitable v1 API 自动生成调用示例。 +2. `oapi-sdk-go/sample/api/bitable2.go`:复杂字段与记录示例。 +3. `oapi-sdk-go-demo`:官方场景化示例仓库。 +4. `bitablev1-curated`:精选拷贝,便于快速查看。 + +## bitablev1 API 示例文件 + +- `batchCreate_appRoleMember.go` +- `batchCreate_appTable.go` +- `batchCreate_appTableRecord.go` +- `batchDelete_appRoleMember.go` +- `batchDelete_appTable.go` +- `batchDelete_appTableRecord.go` +- `batchGet_appTableRecord.go` +- `batchUpdate_appTableRecord.go` +- `copy_app.go` +- `copy_appDashboard.go` +- `create_app.go` +- `create_appRole.go` +- `create_appRoleMember.go` +- `create_appTable.go` +- `create_appTableField.go` +- `create_appTableRecord.go` +- `create_appTableView.go` +- `delete_appRole.go` +- `delete_appRoleMember.go` +- `delete_appTable.go` +- `delete_appTableField.go` +- `delete_appTableRecord.go` +- `delete_appTableView.go` +- `get_app.go` +- `get_appTableForm.go` +- `get_appTableRecord.go` +- `get_appTableView.go` +- `list_appDashboard.go` +- `list_appRole.go` +- `list_appRoleMember.go` +- `list_appTable.go` +- `list_appTableField.go` +- `list_appTableFormField.go` +- `list_appTableRecord.go` +- `list_appTableView.go` +- `list_appWorkflow.go` +- `patch_appTable.go` +- `patch_appTableForm.go` +- `patch_appTableFormField.go` +- `patch_appTableView.go` +- `search_appTableRecord.go` +- `update_app.go` +- `update_appRole.go` +- `update_appTableField.go` +- `update_appTableRecord.go` +- `update_appWorkflow.go` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/README.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/README.md new file mode 100644 index 0000000..48384ca --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/README.md @@ -0,0 +1,45 @@ +# 飞书开放接口SDK/Feishu OpenPlatform Server SDK + +旨在让开发者便捷的调用飞书开放API、处理订阅的事件、处理服务端推送的卡片行为等。 + +Feishu Open Platform offers a series of server-side atomic APIs to achieve diverse functionalities. However, actual coding requires additional work, such as obtaining and maintaining access tokens, encrypting and decrypting data, and verifying request signatures. Furthermore, the lack of semantic descriptions for function calls and type system support can increase coding burdens. + +To address these issues, Feishu Open Platform has developed the Open Interface SDK, which incorporates all lengthy logic processes, provides a comprehensive type system, and offers a semantic programming interface to enhance the coding experience. + +## 介绍文档 Introduction Documents + +- [开发前准备(安装) / Preparations before development(Install SDK)](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/preparations) +- [调用服务端 API / Calling Server-side APIs](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) +- [处理事件订阅 / Handle Events](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-events) +- [处理卡片回调 / Handle Card Callbacks](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-callback) +- [常见问题 / SDK FAQs](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/faq) + +## 扩展示例 + +我们还基于 SDK 封装了常用的 API 组合调用及业务场景示例,如: + +* 消息 + * [发送文件消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_file.go) + * [发送图片消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_image.go) +* 通讯录 + * [获取部门下所有用户列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/contact/list_user_by_department.go) +* 多维表格 + * [创建多维表格同时添加数据表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/base/create_app_and_tables.go) +* 电子表格 + * [复制粘贴某个范围的单元格数据](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/copy_and_paste_by_range.go) + * [下载指定范围单元格的所有素材列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/download_media_by_range.go) +* 教程 + * [机器人自动拉群报警](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/quick_start/robot) ([开发教程](https://open.feishu.cn/document/home/message-development-tutorial/introduction)) + +更多示例可参考:https://github.com/larksuite/oapi-sdk-go-demo + +## 加入交流互助群 + +[单击加入交流互助](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=985nb30c-787a-4fbb-904d-2cf945534078) + +## License + +使用 MIT + + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appRoleMember.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appRoleMember.go new file mode 100644 index 0000000..f6af427 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appRoleMember.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/batch_create +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchCreateAppRoleMemberReqBuilder(). + AppToken("bascnnKKvcoUblgmmhZkYqabcef"). + RoleId("rolNGhPqks"). + Body(larkbitable.NewBatchCreateAppRoleMemberReqBodyBuilder(). + MemberList([]*larkbitable.AppRoleMemberId{larkbitable.NewAppRoleMemberIdBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRoleMember.BatchCreate(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTable.go new file mode 100644 index 0000000..f45e5ff --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTable.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/batch_create +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchCreateAppTableReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + UserIdType("user_id"). + Body(larkbitable.NewBatchCreateAppTableReqBodyBuilder(). + Tables([]*larkbitable.ReqTable{larkbitable.NewReqTableBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.BatchCreate(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTableRecord.go new file mode 100644 index 0000000..2c074ff --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchCreate_appTableRecord.go @@ -0,0 +1,56 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchCreateAppTableRecordReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + UserIdType("user_id"). + ClientToken("fe599b60-450f-46ff-b2ef-9f6675625b97"). + IgnoreConsistencyCheck(true). + Body(larkbitable.NewBatchCreateAppTableRecordReqBodyBuilder(). + Records([]*larkbitable.AppTableRecord{larkbitable.NewAppTableRecordBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.BatchCreate(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appRoleMember.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appRoleMember.go new file mode 100644 index 0000000..71a715f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appRoleMember.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/batch_delete +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchDeleteAppRoleMemberReqBuilder(). + AppToken("bascnnKKvcoUblgmmhZkYqabcef"). + RoleId("rolNGhPqks"). + Body(larkbitable.NewBatchDeleteAppRoleMemberReqBodyBuilder(). + MemberList([]*larkbitable.AppRoleMemberId{larkbitable.NewAppRoleMemberIdBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRoleMember.BatchDelete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTable.go new file mode 100644 index 0000000..0738dc1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTable.go @@ -0,0 +1,52 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/batch_delete +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchDeleteAppTableReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + Body(larkbitable.NewBatchDeleteAppTableReqBodyBuilder(). + TableIds([]string{}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.BatchDelete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTableRecord.go new file mode 100644 index 0000000..54054d0 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchDelete_appTableRecord.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchDeleteAppTableRecordReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + Body(larkbitable.NewBatchDeleteAppTableRecordReqBodyBuilder(). + Records([]string{}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.BatchDelete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchGet_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchGet_appTableRecord.go new file mode 100644 index 0000000..5a35c3d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchGet_appTableRecord.go @@ -0,0 +1,56 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_get +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchGetAppTableRecordReqBuilder(). + AppToken("NQRxbRkBMa6OnZsjtERcxhNWnNh"). + TableId("tbl0xe5g8PP3U3cS"). + Body(larkbitable.NewBatchGetAppTableRecordReqBodyBuilder(). + RecordIds([]string{}). + UserIdType("open_id"). + WithSharedUrl(false). + AutomaticFields(false). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.BatchGet(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchUpdate_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchUpdate_appTableRecord.go new file mode 100644 index 0000000..0b23995 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/batchUpdate_appTableRecord.go @@ -0,0 +1,55 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewBatchUpdateAppTableRecordReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + UserIdType("user_id"). + IgnoreConsistencyCheck(true). + Body(larkbitable.NewBatchUpdateAppTableRecordReqBodyBuilder(). + Records([]*larkbitable.AppTableRecord{larkbitable.NewAppTableRecordBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.BatchUpdate(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_app.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_app.go new file mode 100644 index 0000000..38f41f7 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_app.go @@ -0,0 +1,55 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/copy +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCopyAppReqBuilder(). + AppToken("S404b*****e9PQsYDWYcNryFn0g"). + Body(larkbitable.NewCopyAppReqBodyBuilder(). + Name("一篇新的多维表格"). + FolderToken("fldbco*****CIMltVc"). + WithoutContent(false). + TimeZone("Asia/Shanghai"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.App.Copy(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_appDashboard.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_appDashboard.go new file mode 100644 index 0000000..c65dcfe --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/copy_appDashboard.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/dashboards/:block_id/copy +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCopyAppDashboardReqBuilder(). + AppToken("basbcldP5xZeskcHDFZQfeToydb"). + BlockId("blkEsvEEaNllY2UV"). + Body(larkbitable.NewCopyAppDashboardReqBodyBuilder(). + Name("Dashboard"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppDashboard.Copy(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_app.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_app.go new file mode 100644 index 0000000..031e80c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_app.go @@ -0,0 +1,57 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppReqBuilder(). + CustomizedConfig(false). + SourceAppToken("Xm5EbPVCInfoqRs0HKBbyIBjc1g"). + CopyTypes([]string{}). + ApiType("new"). + ReqApp(larkbitable.NewReqAppBuilder(). + Name("一篇新的多维表格"). + FolderToken("fldbcoh8O99CIMltVc"). + TimeZone("Asia/Macau"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.App.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRole.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRole.go new file mode 100644 index 0000000..de4b0c5 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRole.go @@ -0,0 +1,54 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/roles +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppRoleReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + AppRole(larkbitable.NewAppRoleBuilder(). + RoleName("自定义权限1"). + TableRoles([]*larkbitable.AppRoleTableRole{larkbitable.NewAppRoleTableRoleBuilder().Build()}). + BlockRoles([]*larkbitable.AppRoleBlockRole{larkbitable.NewAppRoleBlockRoleBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRole.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRoleMember.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRoleMember.go new file mode 100644 index 0000000..0307324 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appRoleMember.go @@ -0,0 +1,54 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppRoleMemberReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + RoleId("roljRpwIUt"). + MemberIdType("open_id"). + AppRoleMember(larkbitable.NewAppRoleMemberBuilder(). + MemberId("ou_7dab8a3d3cdcc9da365777c7ad535d62"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRoleMember.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTable.go new file mode 100644 index 0000000..ae6fcbc --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTable.go @@ -0,0 +1,52 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppTableReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + Body(larkbitable.NewCreateAppTableReqBodyBuilder(). + Table(larkbitable.NewReqTableBuilder().Build()). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableField.go new file mode 100644 index 0000000..a2a9027 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableField.go @@ -0,0 +1,58 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppTableFieldReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + ClientToken("fe599b60-450f-46ff-b2ef-9f6675625b97"). + AppTableField(larkbitable.NewAppTableFieldBuilder(). + FieldName("字段名称"). + Type(0). + Property(larkbitable.NewAppTableFieldPropertyBuilder().Build()). + Description(larkbitable.NewAppTableFieldDescriptionBuilder().Build()). + UiType("Progress"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableField.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableRecord.go new file mode 100644 index 0000000..ab0e2c4 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableRecord.go @@ -0,0 +1,56 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppTableRecordReqBuilder(). + AppToken("bascng7vrxcxpig7geggXiCtadY"). + TableId("tblUa9vcYjWQYJCj"). + UserIdType("user_id"). + ClientToken("fe599b60-450f-46ff-b2ef-9f6675625b97"). + IgnoreConsistencyCheck(true). + AppTableRecord(larkbitable.NewAppTableRecordBuilder(). + Fields(map[string]interface{}{}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableView.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableView.go new file mode 100644 index 0000000..e72e6ef --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/create_appTableView.go @@ -0,0 +1,54 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewCreateAppTableViewReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + ReqView(larkbitable.NewReqViewBuilder(). + ViewName("表格视图1"). + ViewType("grid"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableView.Create(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRole.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRole.go new file mode 100644 index 0000000..3b9bd56 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRole.go @@ -0,0 +1,50 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/roles/:role_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppRoleReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + RoleId("roljRpwIUt"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRole.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRoleMember.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRoleMember.go new file mode 100644 index 0000000..68e0a75 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appRoleMember.go @@ -0,0 +1,52 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppRoleMemberReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + RoleId("roljRpwIUt"). + MemberId("ou_7dab8a3d3cdcc9da365777c7ad53uew2"). + MemberIdType("open_id"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRoleMember.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTable.go new file mode 100644 index 0000000..fc48f7c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTable.go @@ -0,0 +1,50 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/tables/:table_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppTableReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableField.go new file mode 100644 index 0000000..90ef014 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableField.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppTableFieldReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + FieldId("fldPTb0U2y"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableField.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableRecord.go new file mode 100644 index 0000000..eda8c36 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableRecord.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppTableRecordReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + RecordId("recpCsf4ME"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableView.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableView.go new file mode 100644 index 0000000..69f6f77 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/delete_appTableView.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// DELETE /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewDeleteAppTableViewReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + ViewId("vewTpR1urY"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableView.Delete(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_app.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_app.go new file mode 100644 index 0000000..ae2e56f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_app.go @@ -0,0 +1,49 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewGetAppReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.App.Get(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableForm.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableForm.go new file mode 100644 index 0000000..e4d977c --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableForm.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/forms/:form_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewGetAppTableFormReqBuilder(). + AppToken("bascnv1jIEppJdTCn3jOosabcef"). + TableId("tblz8nadEUdxNMt5"). + FormId("vew6oMbAa4"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableForm.Get(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableRecord.go new file mode 100644 index 0000000..06416fd --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableRecord.go @@ -0,0 +1,56 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewGetAppTableRecordReqBuilder(). + AppToken("bascnCMII2ORej2RItqpZZUNMIe"). + TableId("tblxI2tWaxP5dG7p"). + RecordId("recn0hoyXL"). + TextFieldAsArray(true). + UserIdType("user_id"). + DisplayFormulaRef(true). + WithSharedUrl(false). + AutomaticFields(true). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.Get(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableView.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableView.go new file mode 100644 index 0000000..2d3d2a6 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/get_appTableView.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewGetAppTableViewReqBuilder(). + AppToken("bascnCMII2ORej2RItqpZZUNMIe"). + TableId("tblsRc9GRRXKqhvW"). + ViewId("vewTpR1urY"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableView.Get(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appDashboard.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appDashboard.go new file mode 100644 index 0000000..5bbd368 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appDashboard.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/dashboards +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppDashboardReqBuilder(). + AppToken("bascng7vrxcxpig7geggXiCtadY"). + PageSize(10). + PageToken("blknkqrP3RqUkcAW"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppDashboard.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRole.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRole.go new file mode 100644 index 0000000..b019184 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRole.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/roles +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppRoleReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + PageSize(10). + PageToken("roljRpwIUt"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRole.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRoleMember.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRoleMember.go new file mode 100644 index 0000000..7ecb576 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appRoleMember.go @@ -0,0 +1,52 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppRoleMemberReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + RoleId("roljRpwIUt"). + PageSize(100). + PageToken("xxxxx"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRoleMember.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTable.go new file mode 100644 index 0000000..8ae72d6 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTable.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppTableReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + PageToken("tblsRc9GRRXKqhvW"). + PageSize(20). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableField.go new file mode 100644 index 0000000..adbc870 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableField.go @@ -0,0 +1,54 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppTableFieldReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + ViewId("vewOVMEXPF"). + TextFieldAsArray(true). + PageToken("fldwJ4YrtB"). + PageSize(20). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableField.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableFormField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableFormField.go new file mode 100644 index 0000000..c49cbfb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableFormField.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/forms/:form_id/fields +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppTableFormFieldReqBuilder(). + AppToken("bascnCMII2ORej2RItqpZZUNMIe"). + TableId("tblxI2tWaxP5dG7p"). + FormId("vewTpR1urY"). + PageSize(10). + PageToken("vewTpR1urY"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableFormField.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableRecord.go new file mode 100644 index 0000000..73feb78 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableRecord.go @@ -0,0 +1,60 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken("bascnCMII2ORej2RItqpZZUNMIe"). + TableId("tblxI2tWaxP5dG7p"). + ViewId("vewqhz51lk"). + Filter("AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)"). + Sort(""). + FieldNames(""). + TextFieldAsArray(true). + UserIdType("user_id"). + DisplayFormulaRef(true). + AutomaticFields(true). + PageToken("recn0hoyXL"). + PageSize(20). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableView.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableView.go new file mode 100644 index 0000000..7423ff3 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appTableView.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppTableViewReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + PageSize(10). + PageToken("vewTpR1urY"). + UserIdType("user_id"). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableView.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appWorkflow.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appWorkflow.go new file mode 100644 index 0000000..0c31ec7 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/list_appWorkflow.go @@ -0,0 +1,51 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// GET /open-apis/bitable/v1/apps/:app_token/workflows +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewListAppWorkflowReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + PageToken(""). + PageSize(20). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppWorkflow.List(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTable.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTable.go new file mode 100644 index 0000000..191fe3b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTable.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewPatchAppTableReqBuilder(). + AppToken(""). + TableId(""). + Body(larkbitable.NewPatchAppTableReqBodyBuilder(). + Name(""). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTable.Patch(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableForm.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableForm.go new file mode 100644 index 0000000..6b64fdd --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableForm.go @@ -0,0 +1,58 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id/forms/:form_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewPatchAppTableFormReqBuilder(). + AppToken("bascnv1jIEppJdTCn3jOosabcef"). + TableId("tblz8nadEUdxNMt5"). + FormId("vew6oMbAa4"). + AppTableForm(larkbitable.NewAppTableFormBuilder(). + Name(""). + Description(""). + Shared(false). + SharedLimit("off"). + SubmitLimitOnce(false). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableForm.Patch(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableFormField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableFormField.go new file mode 100644 index 0000000..f6da2e9 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableFormField.go @@ -0,0 +1,59 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id/forms/:form_id/fields/:field_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewPatchAppTableFormFieldReqBuilder(). + AppToken("bascnCMII2ORej2RItqpZZUNMIe"). + TableId("tblsRc9GRRXKqhvW"). + FormId("vewTpR1urY"). + FieldId("fldjX7dUj5"). + AppTableFormPatchedField(larkbitable.NewAppTableFormPatchedFieldBuilder(). + PreFieldId(""). + Title(""). + Description(""). + Required(false). + Visible(false). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableFormField.Patch(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableView.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableView.go new file mode 100644 index 0000000..af06c8b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/patch_appTableView.go @@ -0,0 +1,55 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewPatchAppTableViewReqBuilder(). + AppToken("bascng7vrxcxpig7geggXiCtadY"). + TableId("tblsRc9GRRXKqhvW"). + ViewId("vewTpR1urY"). + Body(larkbitable.NewPatchAppTableViewReqBodyBuilder(). + ViewName("grid"). + Property(larkbitable.NewAppTableViewPropertyBuilder().Build()). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableView.Patch(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/search_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/search_appTableRecord.go new file mode 100644 index 0000000..18dcd90 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/search_appTableRecord.go @@ -0,0 +1,60 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/search +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewSearchAppTableRecordReqBuilder(). + AppToken("NQRxbRkBMa6OnZsjtERcxhNWnNh"). + TableId("tbl0xe5g8PP3U3cS"). + UserIdType("open_id"). + PageToken(""). + PageSize(20). + Body(larkbitable.NewSearchAppTableRecordReqBodyBuilder(). + ViewId("viex"). + FieldNames([]string{}). + Sort([]*larkbitable.Sort{larkbitable.NewSortBuilder().Build()}). + Filter(larkbitable.NewFilterInfoBuilder().Build()). + AutomaticFields(false). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.Search(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_app.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_app.go new file mode 100644 index 0000000..3956411 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_app.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PUT /open-apis/bitable/v1/apps/:app_token +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewUpdateAppReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + Body(larkbitable.NewUpdateAppReqBodyBuilder(). + Name("新的多维表格名字"). + IsAdvanced(true). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.App.Update(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appRole.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appRole.go new file mode 100644 index 0000000..37f9036 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appRole.go @@ -0,0 +1,55 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PUT /open-apis/bitable/v1/apps/:app_token/roles/:role_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewUpdateAppRoleReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + RoleId("roljRpwIUt"). + AppRole(larkbitable.NewAppRoleBuilder(). + RoleName("自定义权限1"). + TableRoles([]*larkbitable.AppRoleTableRole{larkbitable.NewAppRoleTableRoleBuilder().Build()}). + BlockRoles([]*larkbitable.AppRoleBlockRole{larkbitable.NewAppRoleBlockRoleBuilder().Build()}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppRole.Update(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableField.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableField.go new file mode 100644 index 0000000..bff5af1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableField.go @@ -0,0 +1,58 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PUT /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewUpdateAppTableFieldReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + FieldId("fldPTb0U2y"). + AppTableField(larkbitable.NewAppTableFieldBuilder(). + FieldName("字段名称"). + Type(0). + Property(larkbitable.NewAppTableFieldPropertyBuilder().Build()). + Description(larkbitable.NewAppTableFieldDescriptionBuilder().Build()). + UiType("Progress"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableField.Update(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableRecord.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableRecord.go new file mode 100644 index 0000000..1021018 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appTableRecord.go @@ -0,0 +1,56 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PUT /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewUpdateAppTableRecordReqBuilder(). + AppToken("appbcbWCzen6D8dezhoCH2RpMAh"). + TableId("tblsRc9GRRXKqhvW"). + RecordId("recqwIwhc6"). + UserIdType("user_id"). + IgnoreConsistencyCheck(true). + AppTableRecord(larkbitable.NewAppTableRecordBuilder(). + Fields(map[string]interface{}{}). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppTableRecord.Update(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appWorkflow.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appWorkflow.go new file mode 100644 index 0000000..d55f9d2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/apiall-bitablev1/update_appWorkflow.go @@ -0,0 +1,53 @@ +// Package bitable code generated by oapi sdk gen +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +// PUT /open-apis/bitable/v1/apps/:app_token/workflows/:workflow_id +func main() { + // 创建 Client + client := lark.NewClient("appID", "appSecret") + // 创建请求对象 + req := larkbitable.NewUpdateAppWorkflowReqBuilder(). + AppToken("appbcbWCzen6D8dezh"). + WorkflowId("730887xxxx552638996"). + Body(larkbitable.NewUpdateAppWorkflowReqBodyBuilder(). + Status("Enable"). + Build()). + Build() + // 发起请求 + resp, err := client.Bitable.V1.AppWorkflow.Update(context.Background(), req) + + // 处理错误 + if err != nil { + fmt.Println(err) + return + } + + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + // 业务处理 + fmt.Println(larkcore.Prettify(resp)) +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/bitable2.go b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/bitable2.go new file mode 100644 index 0000000..b2e87de --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/go-sdk-examples/bitablev1-curated/bitable2.go @@ -0,0 +1,133 @@ +/* + * MIT License + * + * Copyright (c) 2022 Lark Technologies Pte. Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package main + +import ( + "context" + "fmt" + "os" + "time" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkbitable "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" + larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1" + larkext "github.com/larksuite/oapi-sdk-go/v3/service/ext" +) + +func batchAdd(client *lark.Client) { + client.Bitable.AppTableRecord.BatchCreate(context.Background(), larkbitable.NewBatchCreateAppTableRecordReqBuilder(). + TableId("id"). + Body(larkbitable.NewBatchCreateAppTableRecordReqBodyBuilder(). + Records([]*larkbitable.AppTableRecord{larkbitable. + NewAppTableRecordBuilder(). + RecordId(""). + Fields(map[string]interface{}{"a": []*larkbitable.Person{larkbitable.NewPersonBuilder().Name("name").Build()}}). + Build()}). + Build()). + Build()) +} + +func createBitableFile(client *lark.Client) { + resp, err := client.Ext.DriveExplorer.CreateFile(context.Background(), larkext.NewCreateFileReqBuilder(). + FolderToken("fldcniHf40Vcv1DoEc8SXeuA0Zd"). + Body(larkext.NewCreateFileReqBodyBuilder(). + Title("title"). + Type(larkext.FileTypeBitable). + Build()). + Build(), larkcore.WithUserAccessToken("u-1Kg48B3nh96VzeLBgRanoskhlmB1l54biMG010qyw7rm")) + + if err != nil { + fmt.Println(err) + return + } + + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return + } + + fmt.Println(larkcore.Prettify(resp.Data)) + fmt.Println(resp.RequestId()) +} + +func listFileByIterator(client *lark.Client) { + iter, err := client.Drive.File.ListByIterator(context.Background(), larkdrive.NewListFileReqBuilder().PageSize(5).FolderToken("fldcniHf40Vcv1DoEc8SXeuA0Zd").Build(), + larkcore.WithUserAccessToken("u-2NJonELO1d.WwANxJ3Q1fL5k2caRglcFr200g5ww22PK")) + if err != nil { + fmt.Println(err) + return + } + count := 0 + for { + hasNext, file, err := iter.Next() + if err != nil { + fmt.Println(err) + break + } + + if !hasNext { + break + } + + fmt.Println(larkcore.Prettify(file)) + time.Sleep(time.Millisecond * 300) + count++ + } + fmt.Println(fmt.Sprintf("total :%d", count)) +} + +func listFile(client *lark.Client) { + resp, err := client.Drive.File.List(context.Background(), larkdrive.NewListFileReqBuilder().PageSize(100).FolderToken("fldcniHf40Vcv1DoEc8SXeuA0Zd").Build(), + larkcore.WithUserAccessToken("u-2NJonELO1d.WwANxJ3Q1fL5k2caRglcFr200g5ww22PK")) + if err != nil { + fmt.Println(err) + return + } + + fmt.Println(fmt.Sprintf("total :%d", len(resp.Data.Files))) +} + +func TestAppRecordStruct() { + tableRecord := larkbitable.AppTableRecord{} + fields := map[string]interface{}{} + fields["str"] = "string" + fields["bool"] = false + fields["listurl1"] = []larkbitable.Url{*larkbitable.NewUrlBuilder().Text("t1").Link("www.baiducom").Build(), *larkbitable.NewUrlBuilder().Text("t2").Link("www.google").Build()} + fields["liststr"] = []string{"str1", "str2"} + fields["listperson"] = []larkbitable.Person{*larkbitable.NewPersonBuilder().Name("n1").Id("id1").Email("e1").Build(), *larkbitable.NewPersonBuilder().Name("n2").Id("id2").Email("e2").Build()} + fields["listattachment"] = []larkbitable.Attachment{*larkbitable.NewAttachmentBuilder().Name("n1").Url("u1").Build(), *larkbitable.NewAttachmentBuilder().Name("n2").Url("url2").Build()} + tableRecord.Fields = fields + + fmt.Println(tableRecord.BoolField("bool")) + fmt.Println(larkcore.Prettify(tableRecord.StringField("str"))) + fmt.Println(larkcore.Prettify(tableRecord.ListUrlField("listurl"))) + fmt.Println(larkcore.Prettify(tableRecord.ListStringField("liststr"))) + fmt.Println(larkcore.Prettify(tableRecord.ListPersonField("listperson"))) + fmt.Println(larkcore.Prettify(tableRecord.ListAttachmentField("listattachment"))) + + boolField := tableRecord.BoolField("bool") + strField := tableRecord.StringField("str") + listUrlField := tableRecord.ListUrlField("listurl") + listStrField := tableRecord.ListStringField("liststr") + listPersonField := tableRecord.ListPersonField("listperson") + listAttachField := tableRecord.ListAttachmentField("listattachment") + fmt.Println(boolField, strField, listUrlField, listStrField, listPersonField, listAttachField) +} +func main() { + TestAppRecordStruct() + var appID, appSecret = os.Getenv("APP_ID"), os.Getenv("APP_SECRET") + client := lark.NewClient(appID, appSecret, lark.WithLogLevel(larkcore.LogLevelDebug), lark.WithLogReqAtDebug(true)) + listFileByIterator(client) + +} diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/manifest.csv b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/manifest.csv new file mode 100644 index 0000000..9a2e7fa --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/manifest.csv @@ -0,0 +1,57 @@ +"type","file","title" +"bitable","feishu.apifox.cn_doc-436424.md","概述" +"bitable","feishu.apifox.cn_doc-436427.md","接入指南" +"bitable","feishu.apifox.cn_doc-436428.md","数据结构" +"bitable","feishu.apifox.cn_doc-436454.md","记录筛选开发指南" +"bitable","feishu.apifox.cn_doc-436742.md","字段编辑指南" +"bitable","feishu.apifox.cn_doc-436743.md","附件字段说明" +"bitable","feishu.apifox.cn_doc-1964912.md","概述" +"bitable","feishu.apifox.cn_doc-1949951.md","多维表格字段变更" +"bitable","feishu.apifox.cn_doc-1949955.md","多维表格记录变更" +"bitable","feishu.apifox.cn_api-10753711.md","获取多维表格元数据" +"bitable","feishu.apifox.cn_api-58952482.md","更新多维表格元数据" +"bitable","feishu.apifox.cn_api-58953650.md","更新数据表" +"bitable","feishu.apifox.cn_api-9020925.md","列出数据表" +"bitable","feishu.apifox.cn_api-9020926.md","新增数据表" +"bitable","feishu.apifox.cn_api-9020927.md","新增多个数据表" +"bitable","feishu.apifox.cn_api-9020928.md","删除一个数据表" +"bitable","feishu.apifox.cn_api-9020929.md","删除多个数据表" +"bitable","s.apifox.cn_apidoc_docs-site_532425_api-58954090.md","复制仪表盘" +"bitable","feishu.apifox.cn_api-58954319.md","列出仪表盘" +"bitable","feishu.apifox.cn_api-58955066.md","更新视图" +"bitable","feishu.apifox.cn_api-58955123.md","检索视图" +"bitable","feishu.apifox.cn_api-9020922.md","列出视图" +"bitable","feishu.apifox.cn_api-9020923.md","新增视图" +"bitable","feishu.apifox.cn_api-9020924.md","删除视图" +"bitable","feishu.apifox.cn_api-58955559.md","更新表单元数据" +"bitable","feishu.apifox.cn_api-58956188.md","获取表单元数据" +"bitable","feishu.apifox.cn_api-58957318.md","更新表单问题" +"bitable","feishu.apifox.cn_api-58958068.md","列出表单问题" +"bitable","feishu.apifox.cn_api-9020911.md","检索记录" +"bitable","feishu.apifox.cn_api-9020910.md","列出记录" +"bitable","feishu.apifox.cn_api-9020912.md","新增记录" +"bitable","feishu.apifox.cn_api-9020914.md","更新记录" +"bitable","feishu.apifox.cn_api-9020916.md","删除记录" +"bitable","feishu.apifox.cn_api-9020913.md","新增多条记录" +"bitable","feishu.apifox.cn_api-9020915.md","更新多条记录" +"bitable","feishu.apifox.cn_api-9020917.md","删除多条记录" +"bitable","feishu.apifox.cn_api-9020918.md","列出字段" +"bitable","feishu.apifox.cn_api-9020919.md","新增字段" +"bitable","feishu.apifox.cn_api-9020920.md","更新字段" +"bitable","feishu.apifox.cn_api-9020921.md","删除字段" +"bitable","feishu.apifox.cn_api-58961268.md","列出自定义角色" +"bitable","feishu.apifox.cn_api-58961961.md","新增自定义角色" +"bitable","feishu.apifox.cn_api-58962762.md","删除自定义角色" +"bitable","feishu.apifox.cn_api-58963075.md","更新自定义角色" +"bitable","feishu.apifox.cn_api-58963324.md","批量删除协作者" +"bitable","feishu.apifox.cn_api-58963532.md","批量新增协作者" +"bitable","feishu.apifox.cn_api-58963762.md","列出协作者" +"bitable","feishu.apifox.cn_api-58963951.md","新增协作者" +"bitable","feishu.apifox.cn_api-58964039.md","删除协作者" +"go-sdk-doc","feishu.apifox.cn_doc-1940248.md","服务端 SDK" +"go-sdk-doc","feishu.apifox.cn_doc-7518568.md","开发前准备" +"go-sdk-doc","feishu.apifox.cn_doc-7518569.md","调用服务端 API" +"go-sdk-doc","feishu.apifox.cn_doc-7518571.md","处理事件" +"go-sdk-doc","feishu.apifox.cn_doc-7518573.md","处理回调" +"go-sdk-doc","feishu.apifox.cn_doc-7518577.md","场景示例" +"go-sdk-doc","feishu.apifox.cn_doc-7518657.md","常见问题" diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-10753711.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-10753711.md new file mode 100644 index 0000000..a699503 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-10753711.md @@ -0,0 +1,266 @@ +# 获取多维表格元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}: + get: + summary: 获取多维表格元数据 + deprecated: false + description: >+ + 通过 app_token 获取多维表格元数据 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/多维表格 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + app: + type: object + properties: + app_token: + type: string + description: 多维表格的 app_token + name: + type: string + description: 多维表格的名字 + revision: + type: integer + description: 多维表格的版本号 + is_advanced: + type: boolean + required: + - app_token + - name + - revision + - is_advanced + x-apifox-orders: + - app_token + - name + - revision + - is_advanced + description: 多维表格元数据 + required: + - app + x-apifox-orders: + - app + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + app: + app_token: appbcbWCzen6D8dezhoCH2RpMAh + name: mybitable + revision: 1 + is_advanced: false + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/多维表格 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-10753711-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58952482.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58952482.md new file mode 100644 index 0000000..ab0dd1f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58952482.md @@ -0,0 +1,217 @@ +# 更新多维表格元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}: + put: + summary: 更新多维表格元数据 + deprecated: false + description: >+ + 通过 app_token 更新多维表格元数据 + + + 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限 + + 此接口非原子操作,先修改多维表格名字,后开关高级权限。可能存在部分成功的情况 + + 该接口支持调用频率上限为 10 QPS + + + 可以单独修改名字或开关高级权限,请求体中不填的参数不受影响 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254031 | InvalidAppName | + 多维表格名称格式错误,长度不超过 100 个字符,不能包含 ? / \ * : [ ] | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254200 | internal error | + 内部错误 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/多维表格 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: "\t 新的多维表格名字 示例值:\"新的多维表格名字\"" + is_advanced: + type: boolean + description: 多维表格是否开启高级权限 示例值:true + x-apifox-orders: + - name + - is_advanced + example: + name: 新的多维表格名字 + is_advanced: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + app: + type: object + properties: + app_token: + type: string + description: 多维表格的 app_token + name: + type: string + description: 多维表格的名字 + is_advanced: + type: boolean + description: 多维表格是否已开启高级权限 + required: + - app_token + - name + - is_advanced + x-apifox-orders: + - app_token + - name + - is_advanced + description: 多维表格元数据 + required: + - app + x-apifox-orders: + - app + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + app: + app_token: appbcbWCzen6D8dezhoCH2RpMAh + name: 新的多维表格名字 + is_advanced: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/多维表格 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58952482-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58953650.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58953650.md new file mode 100644 index 0000000..cda7306 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58953650.md @@ -0,0 +1,174 @@ +# 更新数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}: + patch: + summary: 更新数据表 + deprecated: false + description: >+ + 该接口用于更新数据表的基本信息,包括数据表的名称等。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 403 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 403 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + tags: + - 云文档/多维表格/数据表 + parameters: + - name: app_token + in: path + description: >- + 多维表格的唯一标识符 app_token 参数说明 示例值:"XrgTb4y1haKYnasu0xXb1g7lcSg" + 数据校验规则: 最小长度:1 字符 + required: true + schema: + type: string + - name: table_id + in: path + description: 多维表格数据表的唯一标识符 table_id 参数说明 示例值:"tbl1TkhyTWDkSoZ3" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: >- + 数据表的新名称。 请注意: 名称中的首尾空格将会被去除。 + 如果名称为空或和旧名称相同,接口仍然会返回成功,但是名称不会被更改。 示例值:"数据表的新名称" 数据校验规则: + 长度范围:1 ~ 100 字符 正则校验:^[^\[\]\:\\\/\?\*]+$ + x-apifox-orders: + - name + example: + name: 数据表的新名称 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + name: + type: string + description: 数据表的名称 + required: + - name + x-apifox-orders: + - name + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + name: 数据表的新名称 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58953650-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58954319.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58954319.md new file mode 100644 index 0000000..70951b1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58954319.md @@ -0,0 +1,318 @@ +# 列出仪表盘 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/dashboards: + get: + summary: 列出仪表盘 + deprecated: false + description: >+ + 根据 app_token,获取多维表格下的所有仪表盘 + + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/仪表盘 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:10 数据校验规则: 最大值:500" + required: false + schema: + type: integer + - name: page_token + in: query + description: "\t 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果" + required: false + example: blknkqrP3RqUkcAW + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + dashboards: + type: array + items: + type: object + properties: + block_id: + type: string + description: 仪表盘 ID + name: + type: string + description: 仪表盘名字 + x-apifox-orders: + - block_id + - name + description: 仪表盘信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + required: + - dashboards + - page_token + - has_more + x-apifox-orders: + - dashboards + - page_token + - has_more + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + dashboards: + - block_id: blknkqrP3RqUkcAW + name: 仪表盘1 + page_token: blknkqrP3RqUkcAW + has_more: false + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/仪表盘 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58954319-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955066.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955066.md new file mode 100644 index 0000000..6191d35 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955066.md @@ -0,0 +1,452 @@ +# 更新视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + patch: + summary: 更新视图 + deprecated: false + description: >+ + 该接口用于增量修改视图信息 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ---------------------------------------------- + | ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson + | 请求体错误 | + + | 400 | 1254001 | WrongRequestBody + | 请求体错误 | + + | 400 | 1254002 | Fail + | 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken + | app_token 错误 | + + | 400 | 1254004 | WrongTableId + | table_id 错误 | + + | 400 | 1254005 | WrongViewId + | view_id 错误 | + + | 400 | 1254006 | WrongRecordId + | 检查 record_id | + + | 400 | 1254007 | EmptyValue + | 空值 | + + | 400 | 1254008 | EmptyView + | 空视图 | + + | 400 | 1254009 | WrongFieldId + | 字段 id 错误 | + + | 400 | 1254010 | ReqConvError + | 请求错误 | + + | 400 | 1254016 | InvalidSort + | Sort参数错误 | + + | 400 | 1254018 | InvalidFilter + | Filter参数错误 | + + | 400 | 1254019 | InvalidViewType + | 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated + | 视图名重复 | + + | 400 | 1254021 | EmptyViewName + | 视图名为空 | + + | 400 | 1254022 | InvalidViewName + | 视图名无效 | + + | 400 | 1254030 | TooLargeResponse + | 响应体过大 | + + | 400 | 1254032 | The role name is invalid, please modify it. + | 自定义角色名无效 | + + | 400 | 1254033 | The role name is duplicated, please modify it. + | 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. + | 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound + | app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound + | table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound + | view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound + | record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound + | field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound + | 字段名字不存在 | + + | 404 | 1254047 | Role id is not found. + | role_id 不存在 | + + | 400 | 1254048 | MemberNotFound + | member 不存在 | + + | 404 | 1254049 | Form field is not found. + | form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail + | 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail + | 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail + | 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail + | 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail + | 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail + | 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail + | 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail + | 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit + | 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit + | 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit + | 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit + | 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds limit + | 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell + | 格子内容过大 | + + | 429 | 1254290 | TooManyRequest + | 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict + | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError + | 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | Permission denied. + | 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255002 | RpcError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255003 | MarshalError + | 序列化错误,有疑问可咨询客服 | + + | 500 | 1255004 | UmMarshalError + | 反序列化错误 | + + | 500 | 1255005 | ConvError + | 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later. + | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图 ID + required: true + example: vewTpR1urY + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + view_name: + type: string + description: "\t 视图名称 示例值:\"grid\"" + property: + type: object + properties: + filter_info: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_id: + type: string + description: 用于过滤的字段唯一ID 示例值:"单选" + operator: + type: string + description: "\t 过滤操作的类型 示例值:\"is\" 可选值有: is:等于 isNot:不等于 contains:包含 doesNotContain:不包含 isEmpty:为空 isNotEmpty:不为空 isGreater:大于 isGreaterEqual:大于等于 isLess:小于 isLessEqual:小于等于" + value: + type: string + description: 筛选值 示例值:"["optbdVHf4q", "optrpd3eIJ"]" + x-apifox-orders: + - field_id + - operator + - value + description: 筛选条件 数据校验规则: 最大长度:50 + conjunction: + type: string + description: "\t 多个筛选条件的关系 示例值:\"and\" 可选值有: and:与 or:或 默认值:and" + required: + - conditions + - conjunction + x-apifox-orders: + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: "\t 隐藏字段ID列表 示例值:[\"fldCGzANXx\", \"fldCGzANXx\"] 数据校验规则: 最大长度:100" + required: + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + x-apifox-orders: + - view_name + - property + example: + view_name: grid + property: + filter_info: + conditions: + - field_id: fldVioUai1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + property: + type: object + properties: + filter_info: + type: object + properties: + condition_omitted: + type: 'null' + conditions: + type: array + items: + type: object + properties: + condition_id: + type: string + description: 过滤条件的唯一ID + field_id: + type: string + field_type: + type: integer + description: 用于过滤的字段类型 + operator: + type: string + description: >- + 过滤操作的类型 可选值有: is:等于 isNot:不等于 + contains:包含 doesNotContain:不包含 + isEmpty:为空 isNotEmpty:不为空 isGreater:大于 + isGreaterEqual:大于等于 isLess:小于 + isLessEqual:小于等于 + value: + type: string + description: 筛选值 + x-apifox-orders: + - condition_id + - field_id + - field_type + - operator + - value + description: 筛选条件 + conjunction: + type: string + description: "\t 多个筛选条件的关系 可选值有: and:与 or:或" + required: + - condition_omitted + - conditions + - conjunction + x-apifox-orders: + - condition_omitted + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: 隐藏字段ID列表 + required: + - filter_info + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + required: + - view_id + - view_name + - view_type + - property + x-apifox-orders: + - view_id + - view_name + - view_type + - property + description: 视图信息 + required: + - view + x-apifox-orders: + - view + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewsOleexJ + view_name: grid + view_type: grid + property: + filter_info: + condition_omitted: null + conditions: + - condition_id: conuKMQNNg + field_id: fldVioUai1 + field_type: 1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955066-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955123.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955123.md new file mode 100644 index 0000000..fc9b0f3 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955123.md @@ -0,0 +1,383 @@ +# 检索视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + get: + summary: 检索视图 + deprecated: false + description: >+ + 该接口根据 view_id 检索现有视图 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ---------------------------------------------- + | ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson + | 请求体错误 | + + | 400 | 1254001 | WrongRequestBody + | 请求体错误 | + + | 400 | 1254002 | Fail + | 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken + | app_token 错误 | + + | 400 | 1254004 | WrongTableId + | table_id 错误 | + + | 400 | 1254005 | WrongViewId + | view_id 错误 | + + | 400 | 1254006 | WrongRecordId + | 检查 record_id | + + | 400 | 1254007 | EmptyValue + | 空值 | + + | 400 | 1254008 | EmptyView + | 空视图 | + + | 400 | 1254009 | WrongFieldId + | 字段 id 错误 | + + | 400 | 1254010 | ReqConvError + | 请求错误 | + + | 400 | 1254016 | InvalidSort + | Sort参数错误 | + + | 400 | 1254018 | InvalidFilter + | Filter参数错误 | + + | 400 | 1254019 | InvalidViewType + | 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated + | 视图名重复 | + + | 400 | 1254021 | EmptyViewName + | 视图名为空 | + + | 400 | 1254022 | InvalidViewName + | 视图名无效 | + + | 400 | 1254030 | TooLargeResponse + | 响应体过大 | + + | 400 | 1254032 | The role name is invalid, please modify it. + | 自定义角色名无效 | + + | 400 | 1254033 | The role name is duplicated, please modify it. + | 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. + | 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound + | app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound + | table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound + | view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound + | record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound + | field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound + | 字段名字不存在 | + + | 404 | 1254047 | Role id is not found. + | role_id 不存在 | + + | 400 | 1254048 | MemberNotFound + | member 不存在 | + + | 404 | 1254049 | Form field is not found. + | form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail + | 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail + | 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail + | 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail + | 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail + | 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail + | 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail + | 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail + | 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit + | 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit + | 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit + | 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit + | 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds limit + | 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell + | 格子内容过大 | + + | 429 | 1254290 | TooManyRequest + | 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict + | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError + | 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | Permission denied. + | 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255002 | RpcError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255003 | MarshalError + | 序列化错误,有疑问可咨询客服 | + + | 500 | 1255004 | UmMarshalError + | 反序列化错误 | + + | 500 | 1255005 | ConvError + | 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later. + | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图 ID + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + property: + type: object + properties: + filter_info: + type: object + properties: + condition_omitted: + type: 'null' + description: 筛选条件是否缺省 + conditions: + type: array + items: + type: object + properties: + condition_id: + type: string + description: 过滤条件的唯一ID + field_id: + type: string + description: 用于过滤的字段唯一ID + field_type: + type: integer + description: 用于过滤的字段类型 + operator: + type: string + description: "\t\n过滤操作的类型\n\n可选值有:\n\nis:等于\nisNot:不等于\ncontains:包含\ndoesNotContain:不包含\nisEmpty:为空\nisNotEmpty:不为空\nisGreater:大于\nisGreater:大于等于\nisLess:小于\nisLessEqual:小于等于" + value: + type: string + description: 筛选值 + x-apifox-orders: + - condition_id + - field_id + - field_type + - operator + - value + description: 筛选条件 + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + required: + - condition_omitted + - conditions + - conjunction + x-apifox-orders: + - condition_omitted + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: 隐藏字段ID列表 + required: + - filter_info + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + required: + - view_id + - view_name + - view_type + - property + x-apifox-orders: + - view_id + - view_name + - view_type + - property + description: 视图信息 + required: + - view + x-apifox-orders: + - view + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewsOleexJ + view_name: grid + view_type: grid + property: + filter_info: + condition_omitted: null + conditions: + - condition_id: conuKMQNNg + field_id: fldVioUai1 + field_type: 1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955123-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955559.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955559.md new file mode 100644 index 0000000..6146171 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955559.md @@ -0,0 +1,353 @@ +# 更新表单元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}: + patch: + summary: 更新表单元数据 + deprecated: false + description: >+ + 该接口用于更新表单中的元数据项 + + 该接口支持调用频率上限为 10 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnv1jIEppJdTCn3jOosabcef + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblz8nadEUdxNMt5 + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vew6oMbAa4 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: "\t 表单名称 示例值:\"表单\"" + description: + type: string + description: "\t 表单描述 示例值:\"表单描述\"" + shared: + type: boolean + description: "\t 是否开启共享 示例值:true" + shared_limit: + type: string + description: >- + 分享范围限制 示例值:"tenant_editable" 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: "\t 填写次数限制一次 示例值:true" + x-apifox-orders: + - name + - description + - shared + - shared_limit + - submit_limit_once + example: + name: 表单 + description: 表单描述 + shared: true + shared_limit: tenant_editable + submit_limit_once: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + form: + type: object + properties: + name: + type: string + description: 表单名称 + description: + type: string + description: 表单描述 + shared: + type: boolean + description: 是否开启共享 + shared_url: + type: string + description: 分享 URL + shared_limit: + type: string + description: >- + 分享范围限制 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 + anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: 填写次数限制一次 + required: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + x-apifox-orders: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + description: 表单元数据信息 + required: + - form + x-apifox-orders: + - form + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + form: + name: 表单 + description: 表单描述 + shared: true + shared_url: >- + https://bytedance.feishu.cn/share/base/shrcnCy1KAlpahNotmhRn1abcde + shared_limit: tenant_editable + submit_limit_once: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955559-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58956188.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58956188.md new file mode 100644 index 0000000..b3a8bed --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58956188.md @@ -0,0 +1,337 @@ +# 获取表单元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}: + get: + summary: 获取表单元数据 + deprecated: false + description: >+ + 获取表单的所有元数据项 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnv1jIEppJdTCn3jOosabcef + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblz8nadEUdxNMt5 + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vew6oMbAa4 + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + form: + type: object + properties: + name: + type: string + description: 表单名称 + description: + type: string + description: |+ + 表单描述 + + shared: + type: boolean + description: 是否开启共享 + shared_url: + type: string + description: 分享 URL + shared_limit: + type: string + description: >- + 分享范围限制 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 + anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: |+ + 填写次数限制一次 + + required: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + x-apifox-orders: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + description: 表单元数据信息 + required: + - form + x-apifox-orders: + - form + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + form: + name: 表单 + description: 表单描述 + shared: true + shared_url: >- + https://bytedance.feishu.cn/share/base/shrcnCy1KAlpahNotmhRn1abcde + shared_limit: tenant_editable + submit_limit_once: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58956188-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58957318.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58957318.md new file mode 100644 index 0000000..8e7f768 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58957318.md @@ -0,0 +1,356 @@ +# 更新表单问题 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields/{field_id}: + patch: + summary: 更新表单问题 + deprecated: false + description: >+ + 该接口用于更新表单中的问题项 + + 该接口支持调用频率上限为 10 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254102 | FileExceedLimit | + 超限 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vewTpR1urY + schema: + type: string + - name: field_id + in: path + description: 表单问题 ID + required: true + example: fldjX7dUj5 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + pre_field_id: + type: string + description: >- + 上一个表单问题 ID,用于支持调整表单问题的顺序,通过前一个表单问题的 field_id 来确定位置;如果 + pre_field_id 为空字符串,则说明要排到首个表单问题 示例值:"fldjX7dUj5" + title: + type: string + description: "\t 表单问题 示例值:\"多行文本\"" + description: + type: string + description: 问题描述 示例值:"多行文本描述" + required: + type: boolean + description: 是否必填 示例值:true + visible: + type: boolean + description: "\t 是否可见,当值为 false 时,不允许更新其他字段。 示例值:true" + x-apifox-orders: + - pre_field_id + - title + - description + - required + - visible + example: + pre_field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + field: + type: object + properties: + pre_field_id: + type: string + description: >+ + 上一个表单问题 ID,用于支持调整表单问题的顺序,通过前一个表单问题的 field_id + 来确定位置;如果 pre_field_id 为空字符串,则说明要排到首个表单问题 + + title: + type: string + description: 表单问题 + description: + type: string + description: 问题描述 + required: + type: boolean + description: 是否必填 + visible: + type: boolean + description: 是否可见,当值为 false 时,不允许更新其他字段。 + required: + - pre_field_id + - title + - description + - required + - visible + x-apifox-orders: + - pre_field_id + - title + - description + - required + - visible + description: 更新后的表单问题项 + required: + - field + x-apifox-orders: + - field + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + field: + pre_field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58957318-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58958068.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58958068.md new file mode 100644 index 0000000..8d3a11d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58958068.md @@ -0,0 +1,346 @@ +# 列出表单问题 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields: + get: + summary: 列出表单问题 + deprecated: false + description: >+ + 列出表单的所有问题项 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254102 | FileExceedLimit | + 超限 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vewTpR1urY + schema: + type: string + - name: page_size + in: query + description: 必填 描述 page_size int 否 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: '' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + field_id: + type: string + description: |+ + 表单问题 ID + + title: + type: string + description: 表单问题 + description: + type: string + description: 问题描述 + required: + type: boolean + description: |+ + 是否必填 + + visible: + type: boolean + description: 是否可见 + x-apifox-orders: + - field_id + - title + - description + - required + - visible + description: 表单问题信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: 总数 + required: + - items + - page_token + - has_more + - total + x-apifox-orders: + - items + - page_token + - has_more + - total + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + page_token: fld1lAbHh7 + has_more: true + total: 1 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58958068-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961268.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961268.md new file mode 100644 index 0000000..7cde4b6 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961268.md @@ -0,0 +1,411 @@ +# 列出自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles: + get: + summary: 列出自定义角色 + deprecated: false + description: >+ + 列出自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:10 数据校验规则: 最大值:30" + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: roljRpwIUt + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + role_id: + type: string + description: 自定义角色的id + role_name: + type: string + description: 自定义角色的名字 + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: 数据表名 + table_id: + type: string + description: |+ + 数据表ID + + table_perm: + type: integer + description: "\t 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录" + allow_add_record: + type: boolean + allow_delete_record: + type: boolean + rec_rule: + type: object + properties: + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: ' 创建人 包含 访问者本人' + field_type: + type: integer + description: 字段类型 + operator: + type: string + description: >- + 运算符 可选值有: is:等于 isNot:不等于 contains:包含 + doesNotContain:不包含 isEmpty:为空 + isNotEmpty:不为空 + value: + type: array + items: + type: string + description: 单选或多选字段的选项id + required: + - field_name + - field_type + - operator + - value + x-apifox-orders: + - field_name + - field_type + - operator + - value + description: 记录筛选条件 + other_perm: + type: integer + description: >- + 其他记录权限,仅在table_perm为2时有意义 可选值有: 0:禁止查看 + 1:仅可阅读 + required: + - conditions + - other_perm + - conjunction + x-apifox-orders: + - conjunction + - conditions + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 单选: + type: integer + 年龄: + type: integer + required: + - 单选 + - 年龄 + x-apifox-orders: + - 单选 + - 年龄 + description: >- + 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 + map,key 是字段名,value 是字段权限 value 枚举值有: + 1:可阅读 2:可编辑 + required: + - table_name + - table_id + - table_perm + - rec_rule + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: 数据表角色 + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: |+ + Block 的 ID,例如列出仪表盘接口中的仪表盘 block id + + block_type: + type: string + description: Block类型 可选值有: dashboard:仪表盘 + block_perm: + type: integer + description: "\t Block权限 可选值有: 0:无权限 1:可阅读" + required: + - block_id + - block_type + - block_perm + x-apifox-orders: + - block_id + - block_type + - block_perm + description: |+ + block权限 + + x-apifox-orders: + - role_id + - role_name + - table_roles + - block_roles + description: 自定义角色列表 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: |+ + 总数 + + required: + - items + - page_token + - has_more + - total + x-apifox-orders: + - items + - page_token + - has_more + - total + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - role_id: rola66uIZT + role_name: role1 + table_roles: + - table_name: table1 + table_id: tblFIgBzKEq75HSE + table_perm: 2 + allow_add_record: false + allow_delete_record: true + rec_rule: + conjunction: or + conditions: + - field_name: 单选 + field_type: 3 + operator: is + value: + - optbdVHf4q + - field_name: 人员 + field_type: 11 + operator: contains + value: null + - field_name: '' + field_type: 1003 + operator: contains + value: null + other_perm: 0 + field_perm: + 单选: 1 + 年龄: 2 + - table_name: table2 + table_id: tblMPI6OC1aWvTvs + table_perm: 1 + rec_rule: + conditions: + - field_name: 人员 + field_type: 11 + operator: contains + value: null + - field_name: 多选 + field_type: 4 + operator: is + value: + - opttgKOTSt + - optWcdXR0W + other_perm: 0 + conjunction: and + - table_name: table3 + table_id: tblmkLF7Tg6IWbRb + table_perm: 0 + - table_name: table4 + table_id: tbl5VQHDTms19Qe7 + table_perm: 4 + block_roles: + - block_id: blknkqrP3RqUkcAW + block_type: dashboard + block_perm: 0 + - block_id: blkAjxjWKvbBi7EA + block_type: dashboard + block_perm: 1 + page_token: rola66uIZT + has_more: false + total: 1 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58961268-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961961.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961961.md new file mode 100644 index 0000000..12620fd --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961961.md @@ -0,0 +1,292 @@ +# 新增自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles: + post: + summary: 新增自定义角色 + deprecated: false + description: >+ + 新增自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254032 | + InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | + RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254047 | + RoleIdNotFound | role_id + 不存在 | + + | 400 | 1254110 | + RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + role_name: + type: string + description: 自定义角色的名字 示例值:"自定义角色1" + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: "\t 数据表名 示例值:\"数据表1\"" + table_id: + type: string + description: "\t 数据表ID 示例值:\"tblKz5D60T4JlfcT\"" + table_perm: + type: integer + description: >- + 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 + 示例值:0 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录 默认值:0 + allow_add_record: + type: boolean + description: >- + 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 示例值:true + 默认值:true + allow_delete_record: + type: boolean + description: >- + 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 示例值:true + 默认值:true + rec_rule: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: ' 创建人 包含 访问者本人' + operator: + type: string + value: + type: array + items: + type: string + required: + - field_name + - operator + - value + x-apifox-orders: + - field_name + - operator + - value + description: 记录筛选条件 数据校验规则: 最大长度:100 + conjunction: + type: string + description: 多个筛选条件的关系 示例值:"and" 可选值有: and:与 or:或 默认值:and + other_perm: + type: integer + description: >- + 其他记录权限,仅在table_perm为2时有意义 示例值:0 可选值有: 0:禁止查看 + 1:仅可阅读 默认值:0 + required: + - conditions + x-apifox-orders: + - conditions + - conjunction + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 年龄: + type: integer + 单选: + type: integer + required: + - 年龄 + - 单选 + x-apifox-orders: + - 年龄 + - 单选 + description: "\t 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 map,key 是字段名,value 是字段权限 value 枚举值有: 1:可阅读 2:可编辑" + required: + - rec_rule + - table_perm + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: "\t 数据表角色 数据校验规则: 最大长度:100" + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: "\t Block 的 ID,例如列出仪表盘接口中的仪表盘 block id 示例值:\"blknkqrP3RqUkcAW\"" + block_perm: + type: integer + description: "\t Block权限 示例值:0 可选值有: 0:无权限 1:可阅读 默认值:0" + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: "\t block权限 数据校验规则: 最大长度:100" + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + example: "{\r\n \"role_name\": \"role1\",\r\n \"table_roles\": [\r\n {\r\n \"table_name\": \"table1\",\r\n \"table_id\": \"tblFIgBzKEq75HSE\",\r\n \"table_perm\": 2,\r\n \"allow_add_record\": false,\r\n \"allow_delete_record\": true,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"单选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"optbdVHf4q\"\r\n ]\r\n },\r\n {\r\n \"field_name\": \"人员\" // 人员 包含 访问者本人\r\n },\r\n {\r\n \"field_name\": \"\" // 创建人 包含 访问者本人\r\n }\r\n ],\r\n \"conjunction\": \"or\",\r\n \"other_perm\": 0\r\n },\r\n \"field_perm\": {\r\n \"年龄\": 2,\r\n \"单选\": 1\r\n }\r\n },\r\n {\r\n \"table_name\": \"table2\",\r\n \"table_id\": \"tblMPI6OC1aWvTvs\",\r\n \"table_perm\": 1,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"人员\"\r\n },\r\n {\r\n \"field_name\": \"多选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"opttgKOTSt\",\r\n \"optWcdXR0W\"\r\n ]\r\n }\r\n ],\r\n \"conjunction\": \"and\"\r\n }\r\n },\r\n {\r\n \"table_name\": \"table3\",\r\n \"table_id\": \"tblmkLF7Tg6IWbRb\",\r\n \"table_perm\": 0\r\n },\r\n {\r\n \"table_name\": \"table4\",\r\n \"table_id\": \"tbl5VQHDTms19Qe7\",\r\n \"table_perm\": 4\r\n }\r\n ],\r\n \"block_roles\": [\r\n {\r\n \"block_id\": \"blknkqrP3RqUkcAW\",\r\n \"block_perm\": 0\r\n },\r\n {\r\n \"block_id\": \"blkAjxjWKvbBi7EA\",\r\n \"block_perm\": 1\r\n }\r\n ]\r\n}" + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58961961-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58962762.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58962762.md new file mode 100644 index 0000000..0e182f8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58962762.md @@ -0,0 +1,173 @@ +# 删除自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}: + delete: + summary: 删除自定义角色 + deprecated: false + description: >+ + 删除自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: |+ + 错误码,非 0 表示失败 + + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58962762-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963075.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963075.md new file mode 100644 index 0000000..f1ae027 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963075.md @@ -0,0 +1,530 @@ +# 更新自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}: + put: + summary: 更新自定义角色 + deprecated: false + description: >+ + 更新自定义角色 + + 更新自定义角色是全量更新,会完全覆盖旧的自定义角色设置 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254032 | + InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | + RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254047 | + RoleIdNotFound | role_id + 不存在 | + + | 400 | 1254110 | + RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + role_name: + type: string + description: "\t 自定义角色的名字 示例值:\"自定义角色1\"" + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: "\t 数据表名 示例值:\"数据表1\"" + table_id: + type: string + description: "\t 数据表ID 示例值:\"tblKz5D60T4JlfcT\"" + table_perm: + type: integer + description: "\t\n数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果\n\n示例值:0\n\n可选值有:\n\n0:无权限\n1:可阅读\n2:可编辑记录\n4:可编辑字段和记录\n默认值:0" + allow_add_record: + type: boolean + description: "\t 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 示例值:true 默认值:true" + allow_delete_record: + type: boolean + description: "\t 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 示例值:true 默认值:true" + rec_rule: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: "\t 字段名,记录筛选条件是创建人包含访问者本人时,此参数值为\"\" 示例值:\"单选\"" + operator: + type: string + description: |- + 运算符 + + 示例值:"is" + + 可选值有: + + is:等于 + isNot:不等于 + contains:包含 + doesNotContain:不包含 + isEmpty:为空 + isNotEmpty:不为空 + 默认值:is + value: + type: array + items: + type: string + description: "\t 单选或多选字段的选项id 示例值:[\"optbdVHf4q\", \"optrpd3eIJ\"]" + required: + - field_name + - operator + - value + x-apifox-orders: + - field_name + - operator + - value + description: "\t 记录筛选条件 数据校验规则: 最大长度:100" + conjunction: + type: string + description: "\t 多个筛选条件的关系 示例值:\"and\" 可选值有: and:与 or:或 默认值:and" + other_perm: + type: integer + description: "\t 其他记录权限,仅在table_perm为2时有意义 示例值:0 可选值有: 0:禁止查看 1:仅可阅读 默认值:0" + required: + - conditions + - conjunction + x-apifox-orders: + - conditions + - conjunction + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 年龄: + type: integer + 单选: + type: integer + required: + - 年龄 + - 单选 + x-apifox-orders: + - 年龄 + - 单选 + description: "\t 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 map,key 是字段名,value 是字段权限 value 枚举值有: 1:可阅读 2:可编辑" + required: + - table_perm + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: "\t 数据表角色 数据校验规则: 最大长度:100" + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: "\t Block 的 ID,例如列出仪表盘接口中的仪表盘 block id 示例值:\"blknkqrP3RqUkcAW\"" + block_perm: + type: integer + description: "\t Block权限 示例值:0 可选值有: 0:无权限 1:可阅读 默认值:0" + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: "\t block权限 数据校验规则: 最大长度:100" + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + example: "{\r\n \"role_name\": \"role1\",\r\n \"table_roles\": [\r\n {\r\n \"table_name\": \"table1\",\r\n \"table_id\": \"tblFIgBzKEq75HSE\",\r\n \"table_perm\": 2,\r\n \"allow_add_record\": false,\r\n \"allow_delete_record\": true,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"单选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"optbdVHf4q\"\r\n ]\r\n },\r\n {\r\n \"field_name\": \"人员\" // 人员 包含 访问者本人\r\n },\r\n {\r\n \"field_name\": \"\" // 创建人 包含 访问者本人\r\n }\r\n ],\r\n \"conjunction\": \"or\",\r\n \"other_perm\": 0\r\n },\r\n \"field_perm\": {\r\n \"年龄\": 2,\r\n \"单选\": 1\r\n }\r\n },\r\n {\r\n \"table_name\": \"table2\",\r\n \"table_id\": \"tblMPI6OC1aWvTvs\",\r\n \"table_perm\": 1,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"人员\"\r\n },\r\n {\r\n \"field_name\": \"多选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"opttgKOTSt\",\r\n \"optWcdXR0W\"\r\n ]\r\n }\r\n ],\r\n \"conjunction\": \"and\"\r\n }\r\n },\r\n {\r\n \"table_name\": \"table3\",\r\n \"table_id\": \"tblmkLF7Tg6IWbRb\",\r\n \"table_perm\": 0\r\n },\r\n {\r\n \"table_name\": \"table4\",\r\n \"table_id\": \"tbl5VQHDTms19Qe7\",\r\n \"table_perm\": 4\r\n }\r\n ],\r\n \"block_roles\": [\r\n {\r\n \"block_id\": \"blknkqrP3RqUkcAW\",\r\n \"block_perm\": 0\r\n },\r\n {\r\n \"block_id\": \"blkAjxjWKvbBi7EA\",\r\n \"block_perm\": 1\r\n }\r\n ]\r\n}" + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + role: + type: object + properties: + role_name: + type: string + description: 自定义角色的名字 + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: 数据表名 + table_id: + type: string + description: 数据表ID + table_perm: + type: integer + description: >- + 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 + 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录 + addrecords_perm: + type: boolean + description: 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 + deleterecords_perm: + type: boolean + description: 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 + rec_rule: + type: object + properties: + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: 字段名,记录筛选条件是创建人包含访问者本人时,此参数值为"" + operator: + type: string + description: "\t 运算符 可选值有: is:等于 isNot:不等于 contains:包含 doesNotContain:不包含 isEmpty:为空 isNotEmpty:不为空" + field_type: + type: integer + description: 字段类型 + value: + type: array + items: + type: string + description: 单选或多选字段的选项id + required: + - value + - field_name + - operator + - field_type + x-apifox-orders: + - field_name + - operator + - field_type + - value + description: 记录筛选条件 + other_perm: + type: integer + description: "\t 其他记录权限,仅在table_perm为2时有意义 可选值有: 0:禁止查看 1:仅可阅读" + required: + - conditions + - other_perm + - conjunction + x-apifox-orders: + - conjunction + - conditions + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 单选: + type: integer + 年龄: + type: integer + required: + - 单选 + - 年龄 + x-apifox-orders: + - 单选 + - 年龄 + description: >- + 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 + map,key 是字段名,value 是字段权限 + + + value 枚举值有: + + 1:可阅读 + + 2:可编辑 + required: + - table_name + - table_id + - table_perm + - rec_rule + x-apifox-orders: + - table_name + - table_id + - table_perm + - addrecords_perm + - deleterecords_perm + - rec_rule + - field_perm + description: 数据表角色 + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + block_perm: + type: integer + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: block权限 + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + description: |+ + 自定义角色 + + required: + - role + x-apifox-orders: + - role + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + required: + - data + - code + - msg + x-apifox-orders: + - data + - code + - msg + example: + data: + role: + role_name: role1 + table_roles: + - table_name: table1 + table_id: tblFIgBzKEq75HSE + table_perm: 2 + addrecords_perm: false + deleterecords_perm: true + rec_rule: + conjunction: or + conditions: + - field_name: 单选 + operator: is + field_type: 3 + value: + - optbdVHf4q + - value: null + field_name: 人员 + operator: contains + field_type: 11 + - operator: contains + field_type: 1003 + value: null + field_name: '' + other_perm: 0 + field_perm: + 单选: 1 + 年龄: 2 + - table_name: table2 + table_id: tblMPI6OC1aWvTvs + table_perm: 1 + rec_rule: + conditions: + - field_name: 人员 + operator: contains + field_type: 11 + value: null + - operator: is + field_type: 4 + value: + - opttgKOTSt + - optWcdXR0W + field_name: 多选 + other_perm: 0 + conjunction: and + - table_name: table3 + table_id: tblmkLF7Tg6IWbRb + table_perm: 0 + - table_name: table4 + table_id: tbl5VQHDTms19Qe7 + table_perm: 4 + block_roles: + - block_id: blknkqrP3RqUkcAW + block_perm: 0 + - block_id: blkAjxjWKvbBi7EA + block_perm: 1 + code: 0 + msg: success + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963075-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963324.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963324.md new file mode 100644 index 0000000..7db4794 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963324.md @@ -0,0 +1,193 @@ +# 批量删除协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_delete: + post: + summary: 批量删除协作者 + deprecated: false + description: >+ + 批量删除自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnnKKvcoUblgmmhZkYqabcef + schema: + type: string + - name: role_id + in: path + description: 自定义角色 ID + required: true + example: rolNGhPqks + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_list: + type: array + items: + type: object + properties: + type: + type: string + description: "\t 协作者 ID 类型 示例值:\"open_id\" 可选值有: open_id:协作者 ID 类型为 open_id union_id:协作者 ID 类型为 union_id user_id:协作者 ID 类型为 user_id chat_id:协作者 ID 类型为 chat_id department_id:协作者 ID 类型为 department_id open_department_id:协作者 ID 类型为 open_department_id 默认值:open_id" + id: + type: string + description: 协作者 ID 示例值:"ou_35990a9d9052051a2fae9b2f1afabcef" + x-apifox-orders: + - type + - id + required: + - id + description: "\t 协作者列表 数据校验规则: 最大长度:100" + required: + - member_list + x-apifox-orders: + - member_list + example: + member_list: + - type: open_id + id: ou_35990a9d9052051a2fae9b2f1afabcef + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963324-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963532.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963532.md new file mode 100644 index 0000000..2155620 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963532.md @@ -0,0 +1,199 @@ +# 批量新增协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_create: + post: + summary: 批量新增协作者 + deprecated: false + description: >+ + 批量新增自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: Bitable 文档 Token + required: true + example: bascnnKKvcoUblgmmhZkYqabcef + schema: + type: string + - name: role_id + in: path + description: 自定义角色 ID + required: true + example: rolNGhPqks + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_list: + type: array + items: + type: object + properties: + type: + type: string + description: >- + 协作者 ID 类型 示例值:"open_id" 可选值有: open_id:协作者 ID 类型为 + open_id union_id:协作者 ID 类型为 union_id user_id:协作者 ID + 类型为 user_id chat_id:协作者 ID 类型为 chat_id + department_id:协作者 ID 类型为 department_id + open_department_id:协作者 ID 类型为 open_department_id + 默认值:open_id + id: + type: string + description: "\t 协作者 ID 示例值:\"ou_35990a9d9052051a2fae9b2f1afabcef\"" + x-apifox-orders: + - type + - id + required: + - id + description: 协作者列表 数据校验规则: 最大长度:100 + required: + - member_list + x-apifox-orders: + - member_list + example: + member_list: + - type: open_id + id: ou_35990a9d9052051a2fae9b2f1afabcef + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963532-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963762.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963762.md new file mode 100644 index 0000000..6c694f0 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963762.md @@ -0,0 +1,277 @@ +# 列出协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members: + get: + summary: 列出协作者 + deprecated: false + description: >+ + 列出自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:100 数据校验规则: 最大值:100" + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: xxxxx + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + msg: + type: string + description: 错误码,非 0 表示失败 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + member_type: + type: string + description: 协作者名字 + member_name: + type: string + description: 协作者英文名 + member_en_name: + type: string + open_id: + type: string + description: 用户的 open_id + union_id: + type: string + description: 用户的 union_id + user_id: + type: string + description: 用户的 user_id + chat_id: + type: string + description: 群聊的 chat_id + department_id: + type: string + description: 部门的 department_id + open_department_id: + type: string + description: 部门的 open_department_id + required: + - member_type + - member_name + - member_en_name + x-apifox-orders: + - member_type + - member_name + - member_en_name + - open_id + - union_id + - user_id + - chat_id + - department_id + - open_department_id + description: 协作者列表 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + has_more: + type: boolean + description: 是否还有更多项 + required: + - items + - page_token + - total + - has_more + x-apifox-orders: + - items + - page_token + - total + - has_more + code: + type: integer + description: 错误描述 + required: + - msg + - data + - code + x-apifox-orders: + - msg + - data + - code + example: + msg: success + data: + items: + - member_type: user + member_name: 张三 + member_en_name: San Zhang + open_id: ou_xxxxxxxxxxxxxxxx + union_id: on_xxxxxxxxxxxxxxxx + user_id: xxxxxx + - member_type: chat + member_name: design-chat + member_en_name: design-chat + chat_id: oc_xxxxxxxxxxxxxxxx + - member_type: department + member_name: design-center + member_en_name: design-center + department_id: xxxxxxxxx + open_department_id: od-xxxxxxxxxxxxxxxx + page_token: xxxxxxxxx + total: 3 + has_more: false + code: 0 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963762-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963951.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963951.md new file mode 100644 index 0000000..4025ecb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963951.md @@ -0,0 +1,203 @@ +# 新增协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members: + post: + summary: 新增协作者 + deprecated: false + description: >+ + 新增自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: member_id_type + in: query + description: >- + 协作者id类型,与请求体中的member_id要对应 示例值:"open_id" 可选值有: + open_id:以open_id来识别协作者 union_id:以union_id来识别协作者 + user_id:以user_id来识别协作者 chat_id:以chat_id来识别协作者 + department_id:以department_id来识别协作者 + open_department_id:以open_department_id来识别协作者 默认值:open_id + required: false + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_id: + type: string + description: "\t 协作者id 示例值:\"ou_7dab8a3d3cdcc9da365777c7ad535d62\"" + required: + - member_id + x-apifox-orders: + - member_id + example: + member_id: ou_xxxxxxx + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963951-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58964039.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58964039.md new file mode 100644 index 0000000..eeb0e69 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58964039.md @@ -0,0 +1,188 @@ +# 删除协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/{member_id}: + delete: + summary: 删除协作者 + deprecated: false + description: >+ + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: member_id + in: path + description: 协作者id + required: true + example: ou_7dab8a3d3cdcc9da365777c7ad53uew2 + schema: + type: string + - name: member_id_type + in: query + description: "\t 协作者id类型,与请求体中的member_id要对应 示例值:\"open_id\" 可选值有: open_id:以open_id来识别协作者 union_id:以union_id来识别协作者 user_id:以user_id来识别协作者 chat_id:以chat_id来识别协作者 department_id:以department_id来识别协作者 open_department_id:以open_department_id来识别协作者 默认值:open_id" + required: false + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58964039-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020910.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020910.md new file mode 100644 index 0000000..42ee40a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020910.md @@ -0,0 +1,731 @@ +# 列出记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records: + get: + summary: 列出记录 + deprecated: false + description: >+ + 该接口用于列出数据表中的现有记录,单次最多列出 500 行记录,支持分页获取。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率),1000 QPM(Query Per + Minute,每分钟请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254024 | InvalidFieldNames | + FieldNames参数错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254107 | FilterLengthExceedLimit | + Filter长度超限, 限制2,000个字符 | + + | 200 | 1254108 | SortLengthExceedLimit | + Sort长度超限, 限制1,000个字符 | + + | 200 | 1254109 | FormulaTableSizeExceedLimit | + 公式表大小超限 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1254303 | AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/记录 + - 商店应用 + - 自建应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: view_id + in: query + description: 视图 id, 如filter或sort有值, view_id会被忽略 示例值:"vewqhz51lk" + required: false + example: vewqhz51lk + schema: + type: string + - name: filter + in: query + description: >- + filter, 不超过2000个字符, 不支持对高级字段属性(关联和公式)进行过滤筛选,仅支持字段文本值。详细请参考 + [记录筛选指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) + **示例值**:"AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)" + required: false + example: AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150) + schema: + type: string + - name: sort + in: query + description: sort, 不超过1000字符, 不支持对带特殊字段(关联和公式)的表的使用 示例值:"["字段1 DESC","字段2 ASC"]" + required: false + example: '["字段1 DESC","字段2 ASC"]' + schema: + type: string + - name: field_names + in: query + description: field_names 示例值:"["字段1"]" + required: false + example: '["字段1"]' + schema: + type: string + - name: text_field_as_array + in: query + description: 控制多行文本字段数据的返回格式, true 表示以数组形式返回 示例值:true + required: false + example: 'true' + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 示例值:"recn0hoyXL" + required: false + example: recn0hoyXL + schema: + type: string + - name: page_size + in: query + description: 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + example: '10' + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + - name: display_formula_ref + in: query + description: >- + 默认值为false,返回当前字段的默认类型和结果;当该参数的值为true时,公式 和 查找引用 类型的字段,将会以 被引用字段 + 的格式返回 + required: false + example: 'true' + schema: + type: string + - name: automatic_fields + in: query + description: >- + 控制是否返回自动计算的字段,例如 + created_by/created_time/last_modified_by/last_modified_time,true + 表示返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + items: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: string + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + email: + type: string + en_name: + type: string + id: + type: string + name: + type: string + required: + - email + - en_name + - id + - name + x-apifox-orders: + - email + - en_name + - id + - name + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + name: + type: string + size: + type: integer + tmp_url: + type: string + type: + type: string + url: + type: string + required: + - file_token + - name + - size + - tmp_url + - type + - url + x-apifox-orders: + - file_token + - name + - size + - tmp_url + - type + - url + 对应 OKR: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + required: + - text + - type + x-apifox-orders: + - text + - type + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + 单向关联: + type: array + items: + type: object + properties: + type: + type: string + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + required: + - type + - table_id + - record_ids + - text + x-apifox-orders: + - type + - table_id + - record_ids + - text + 双向关联: + type: array + items: + type: object + properties: + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + type: + type: string + required: + - table_id + - record_ids + - text + - type + x-apifox-orders: + - table_id + - record_ids + - text + - type + 多行文本: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + mentionType: + type: string + mentionNotify: + type: boolean + name: + type: string + token: + type: string + link: + type: string + required: + - text + - type + - mentionType + - token + - link + x-apifox-orders: + - text + - type + - mentionType + - mentionNotify + - name + - token + - link + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + required: + - has_more + - items + - page_token + - total + x-apifox-orders: + - has_more + - items + - page_token + - total + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + has_more: false + items: + - fields: + 人力耗时: '64' + 人力评估: '8' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 我是最大的功能开发🥕 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + name: 2.gif + size: 10250625 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnkQWfV4XbHwzDngmezMGzXe + type: image/gif + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnkQWfV4XbHwzDngmezMGzXe/download + 对应 OKR: + - text: 新功能评审 + type: text + 截止日期: 1612108800000 + 文档地址: + link: https://bytedance.feishu.cn/drive/home/ + text: 文档备份 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: recn0hoyXL + - fields: + 人力耗时: '16' + 人力评估: '2' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 新功能评审 + 任务附件: + - file_token: boxcnGk0FfG678EEurDN7dRyxag + name: Hawaii_1_15Retina_R.jpg + size: 5069121 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnGk0FfG678EEurDN7dRyxag + type: image/jpeg + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnGk0FfG678EEurDN7dRyxag/download + 对应 OKR: + - text: 我是最大的功能开发🥕 + type: text + 截止日期: 1612368000000 + 文档地址: + link: https://www.baidu.com/ + text: 百度一下,你就知道 + 是否完成: true + 状态: 未进行 + 相关部门: + - 产品 + - 设计 + - 研发 + 多行文本: + - text: hello + type: text + - mentionType: User + mentionNotify: false + name: test + text: '@test' + token: ou_sfsdfsdfsdfsdfdsfsdfdsf + type: mention + - link: >- + https://test-sasdfsfsd.feishu-boe.cn/base/basbcq2aFvW8nFJpfOXa1111111 + mentionType: Bitable + text: 未命名多维表格 + token: basbcq2aFvW8nFJpfOXalx57ffb + type: mention + - text: 测试链接标题 + link: https://www.baidu.com/ + type: url + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: reciKaDyVO + page_token: reciKaDyVO + total: 2 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020910-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020911.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020911.md new file mode 100644 index 0000000..394c31a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020911.md @@ -0,0 +1,572 @@ +# 检索记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + get: + summary: 检索记录 + deprecated: false + description: >+ + 该接口用于根据 record_id 的值检索现有记录 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1254303 | AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: record_id + in: path + description: |+ + 单条记录的 id + + 示例值:"recqwIwhc6" + + required: true + example: recn0hoyXL + schema: + type: string + - name: text_field_as_array + in: query + description: 控制多行文本字段数据的返回格式, true 表示以数组形式返回 示例值:true + required: false + example: 'true' + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + - name: display_formula_ref + in: query + description: 控制公式、查找引用是否显示完整的原样返回结果 + required: false + example: 'true' + schema: + type: string + - name: automatic_fields + in: query + description: >- + 控制是否返回自动计算的字段,例如 + created_by/created_time/last_modified_by/last_modified_time,true + 表示返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + record: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: integer + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + email: + type: string + en_name: + type: string + id: + type: string + name: + type: string + x-apifox-orders: + - email + - en_name + - id + - name + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + name: + type: string + size: + type: integer + tmp_url: + type: string + type: + type: string + url: + type: string + x-apifox-orders: + - file_token + - name + - size + - tmp_url + - type + - url + 对应 OKR: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + x-apifox-orders: + - text + - type + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + 多行文本: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + mentionType: + type: string + mentionNotify: + type: boolean + name: + type: string + token: + type: string + link: + type: string + required: + - text + - type + - mentionType + - token + - link + x-apifox-orders: + - text + - type + - mentionType + - mentionNotify + - name + - token + - link + description: ' text_field_as_array 为true时的结构' + 单向关联: + type: array + items: + type: object + properties: + type: + type: string + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + x-apifox-orders: + - type + - table_id + - record_ids + - text + 双向关联: + type: array + items: + type: object + properties: + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + type: + type: string + x-apifox-orders: + - table_id + - record_ids + - text + - type + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - record + x-apifox-orders: + - record + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + record: + fields: + 人力耗时: 64 + 人力评估: '8' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 我是最大的功能开发🥕 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + name: 2.gif + size: 10250625 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnkQWfV4XbHwzDngmezMGzXe + type: image/gif + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnkQWfV4XbHwzDngmezMGzXe/download + 对应 OKR: + - text: 新功能评审 + type: text + 截止日期: 1612108800000 + 文档地址: + link: https://bytedance.feishu.cn/drive/home/ + text: 文档备份 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + 多行文本: + - text: hello + type: text + - mentionType: User + mentionNotify: false + name: test + text: '@test' + token: ou_sfsdfsdfsdfsdfdsfsdfdsf + type: mention + - link: >- + https://test-sasdfsfsd.feishu-boe.cn/base/basbcq2aFvW8nFJpfOXa1111111 + mentionType: Bitable + text: 未命名多维表格 + token: basbcq2aFvW8nFJpfOXalx57ffb + type: mention + - text: 测试链接标题 + link: https://www.baidu.com/ + type: url + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: recn0hoyXL + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020911-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020912.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020912.md new file mode 100644 index 0000000..20f831d --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020912.md @@ -0,0 +1,566 @@ +# 新增记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records: + post: + summary: 新增记录 + deprecated: false + description: >+ + 该接口用于在数据表中新增一条记录 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254072 | Failed to convert phone field, please make sure + it is correct. | 电话字段错误 + | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254303 | + AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"bascng7vrxcxpig7geggXiCtadY" + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: table_id + in: path + description: table id 示例值:"tblUa9vcYjWQYJCj" + required: true + example: tblUa9vcYjWQYJCj + schema: + type: string + - name: user_id_type + in: query + description: |- + 用户 ID 类型 + + 示例值:"open_id" + + 可选值有: + + open_id:用户的 open id + union_id:用户的 union id + user_id:用户的 user id + 默认值:open_id + + 当值为 user_id,字段权限要求: + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: integer + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + x-apifox-orders: + - file_token + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + example: + fields: + 人力耗时: 64 + 人力评估: '8' + 任务执行人: + - id: ou_be7f7ff11f5107962c0493f59409508b + 任务描述: 功能开发萝卜 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + 对应 OKR: + - rec82XmuMO + - recZQCkzgd + 截止日期: 1612108800000 + 文档地址: + link: https://open.feishu.cn/drive/home/ + text: 我是可爱的 萝卜 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + record: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - record + x-apifox-orders: + - record + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + record: + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recisKHorn + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020912-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020913.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020913.md new file mode 100644 index 0000000..e781c7b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020913.md @@ -0,0 +1,580 @@ +# 新增多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create: + post: + summary: 新增多条记录 + deprecated: false + description: >+ + 该接口用于在数据表中新增多条记录,单次调用最多新增 500 条记录。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254072 | Failed to convert phone field, please make sure + it is correct. | 电话字段错误 + | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254303 | + AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: user_id_type + in: query + description: "\t 用户 ID 类型 示例值:\"open_id\" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 user ID" + required: false + schema: + type: string + - name: client_token + in: query + description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 + required: false + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + description: 记录 + required: + - records + x-apifox-orders: + - records + example: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recsIbdRSC + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + record_id: recm5qB61M + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020913-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020914.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020914.md new file mode 100644 index 0000000..33d071a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020914.md @@ -0,0 +1,458 @@ +# 更新记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + put: + summary: 更新记录 + deprecated: false + description: >- + 该接口用于更新数据表中的一条记录 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 403 | 1254027 | UploadAttachNotAllowed | + 附件未挂载, 禁止上传 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission denied. | + 仅企业版和旗舰版飞书支持行列权限 | + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: record_id + in: path + description: |- + 单条记录的 id + + 示例值:"recqwIwhc6" + required: true + example: recqwIwhc6 + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + example: + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + record: + type: object + properties: + record_id: + type: string + description: 记录 id + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - record_id + - fields + x-apifox-orders: + - fields + - record_id + description: >- + {"fields": {"人力评估": 2,"任务执行人": [{"id": + "ou_debc524b2d8cb187704df652b43d29de"}],"任务描述": + "多渠道收集用户反馈","对应 OKR": + ["recqwIwhc6","recOuEJMvN"],"截止日期": + 1609516800000,"是否完成": true,"状态": "已结束","相关部门": + ["销售","客服"]}} + required: + - record + x-apifox-orders: + - record + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + record: + record_id: recm5qB61M + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020914-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020915.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020915.md new file mode 100644 index 0000000..968a2f5 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020915.md @@ -0,0 +1,536 @@ +# 更新多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update: + post: + summary: 更新多条记录 + deprecated: false + description: >+ + 该接口用于更新数据表中的多条记录,单次调用最多更新 500 条记录。 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: object + properties: + record_id: + type: string + description: 记录 id 示例值:"recqwIwhc6" + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - record_id + - fields + x-apifox-orders: + - record_id + - fields + description: 记录 + required: + - records + x-apifox-orders: + - records + example: + records: + - record_id: recm5qB61M + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + - record_id: recsIbdRSC + fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recm5qB61M + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + record_id: recsIbdRSC + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020915-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020916.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020916.md new file mode 100644 index 0000000..3f3e784 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020916.md @@ -0,0 +1,316 @@ +# 删除记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + delete: + summary: 删除记录 + deprecated: false + description: >+ + 该接口用于删除数据表中的一条记录 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: record_id + in: path + description: |- + 单条记录的Id + + 示例值:"recpCsf4ME" + required: true + example: recpCsf4ME + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + deleted: + type: boolean + description: 是否成功删除 + record_id: + type: string + description: 删除的记录 ID + required: + - deleted + - record_id + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + deleted: true + record_id: recpCsf4ME + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020916-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020917.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020917.md new file mode 100644 index 0000000..fb7986e --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020917.md @@ -0,0 +1,337 @@ +# 删除多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_delete: + post: + summary: 删除多条记录 + deprecated: false + description: >+ + 该接口用于删除数据表中现有的多条记录 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnQtp6G6IOgCdBnslD4nHYTf + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblw0yvZe64e99t6 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: string + description: 删除的多条记录id列表 示例值:["recIcJBbvC","recvmiCORa"] + required: + - records + example: + records: + - recIcJBbvC + - recvmiCORa + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + deleted: + type: boolean + description: 是否成功删除 + record_id: + type: string + description: 删除的记录 ID + x-apifox-orders: + - deleted + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + records: + - deleted: true + record_id: recpCsf4ME + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020917-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020918.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020918.md new file mode 100644 index 0000000..2b593fb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020918.md @@ -0,0 +1,561 @@ +# 列出字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields: + get: + summary: 列出字段 + deprecated: false + description: >+ + 根据 app_token 和 table_id,获取数据表的所有字段 + + 该接口支持调用频率上限为 20 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254012 | NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | ActionValidateFailed | + Action验证失败 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: query + description: 视图 ID + required: false + example: vewOVMEXPF + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: fldwJ4YrtB + schema: + type: string + - name: page_size + in: query + description: 分页大小 + required: false + example: '10' + schema: + type: string + - name: text_field_as_array + in: query + description: 控制字段描述(多行文本格式)数据的返回格式, true 表示以数组富文本形式返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + items: + type: array + items: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + property: + type: object + properties: + formatter: + type: string + description: 数字、公式字段的显示格式 + options: + type: array + items: + type: object + properties: + color: + type: integer + description: 选项颜色 + id: + type: string + description: 选项id + name: + type: string + description: 选项名 + required: + - color + - id + - name + x-apifox-orders: + - color + - id + - name + description: 单选、多选字段的选项信息 + auto_fill: + type: boolean + description: 日期字段中新纪录自动填写创建时间 + date_formatter: + type: string + description: 日期、创建时间、最后更新时间字段的显示格式 + multiple: + type: boolean + description: 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 + table_id: + type: string + description: 单向关联、双向关联字段中关联的数据表的id + table_name: + type: string + description: 单向关联、双向关联字段中关联的数据表的名字 + formula_expression: + type: string + back_field_id: + type: string + description: "\t 双向关联字段中关联的数据表中对应的双向关联字段的id" + back_field_name: + type: string + description: 双向关联字段中关联的数据表中对应的双向关联字段的名字 + location: + type: object + properties: + input_type: + type: string + required: + - input_type + x-apifox-orders: + - input_type + auto_serial: + type: object + properties: + type: + type: string + options: + type: array + items: + type: object + properties: + value: + type: string + type: + type: string + required: + - value + - type + x-apifox-orders: + - value + - type + required: + - type + x-apifox-orders: + - type + - options + required: + - auto_serial + - date_formatter + x-apifox-orders: + - formatter + - options + - auto_fill + - date_formatter + - multiple + - table_id + - table_name + - back_field_id + - back_field_name + - formula_expression + - location + - auto_serial + description: >- + 字段属性,具体参考:[字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide) + type: + type: integer + description: 多维表格字段类型 + required: + - field_id + - field_name + - property + - type + x-apifox-orders: + - field_id + - field_name + - property + - type + description: 字段信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + required: + - has_more + - items + - page_token + - total + x-apifox-orders: + - has_more + - items + - page_token + - total + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + has_more: false + items: + - field_id: fldjX7dUj5 + field_name: 多行文本 + property: null + type: 1 + - field_id: fldoMnnvIR + field_name: 数字 + property: + formatter: '0.00' + type: 2 + - field_id: fld2RxOyB8 + field_name: 单选 + property: + options: + - color: 0 + id: optpeuQVqp + name: a++ + - color: 1 + id: opt5g3xLFT + name: b + - color: 6 + id: opt558YmTi + name: z + type: 3 + - field_id: fldHBDkAfH + field_name: 日期 + property: + auto_fill: false + date_formatter: yyyy/MM/dd HH:mm + type: 5 + - field_id: fld1lAbHh7 + field_name: 复选框 + property: null + type: 7 + - field_id: fldlQDzjyK + field_name: 人员 + property: + multiple: true + type: 11 + - field_id: fldEahozCL + field_name: 超链接 + property: null + type: 15 + - field_id: fldxZLsTge + field_name: 附件 + property: null + type: 17 + - field_id: fldNdr8VNW + field_name: 单向关联 + property: + multiple: true + table_id: tblw92ErelmCmgHc + table_name: 数据表2 + type: 18 + - field_id: fldNaywkor + field_name: 查找引用 + property: null + type: 19 + - field_id: fldFuAdYEI + field_name: 公式 + property: + formatter: 0.00% + formula_expression: >- + IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN("飞书"),"aaa","bbb") + type: 20 + - field_id: fldpfIDIi0 + field_name: 双向关联 + property: + back_field_id: fldmQGUnWh + back_field_name: 双向关联-自动生成 + multiple: true + table_id: tblw92ErelmCmgHc + table_name: 数据表2 + type: 21 + - field_id: fldoblwmUC + field_name: 创建时间 + property: + date_formatter: yyyy/MM/dd + type: 1001 + - field_id: fldd1bPCW7 + field_name: 创建人 + property: null + type: 1003 + - field_id: fldZXPWBrP + field_name: 电话号码 + type: 13 + property: null + - field_id: fldtuzPEKC + field_name: 地理位置 + type: 22 + property: + location: + input_type: not_limit + - field_id: fldEG65yiU + field_name: 自动编号 + type: 1005 + property: + auto_serial: + type: custom + options: + - value: '1' + type: system_number + - value: MMdd + type: created_time + - type: created_time + value: yyyyMMdd + - type: created_time + value: MM + - field_id: fldwq16vz2 + field_name: 自增数字自动编号 + type: 1005 + property: + auto_serial: + type: auto_increment_number + page_token: fldd1bPCW7 + total: 18 + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020918-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020919.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020919.md new file mode 100644 index 0000000..96895f1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020919.md @@ -0,0 +1,462 @@ +# 新增字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields: + post: + summary: 新增字段 + deprecated: false + description: >+ + 该接口用于在数据表中新增一个字段 + + + 该接口支持调用频率上限为 10 QPS + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254026 | + EmptyOptionName | + 选项名不能为空 | + + | 400 | 1254028 | + EmptyFieldName | + 字段名为空 | + + | 400 | 1254029 | + InvalidFieldName | + 字段名无效 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 400 | 1254080 | + TextFieldPropertyError | + 多行文本字段property错误 | + + | 400 | 1254081 | + NumberFieldPropertyError | + 数字字段property错误 | + + | 400 | 1254082 | + SingleSelectFieldPropertyError | + 单选字段property错误 | + + | 400 | 1254083 | + MultiSelectFieldPropertyError | + 多选字段property错误 | + + | 400 | 1254084 | + DateFieldPropertyError | + 日期字段property错误 | + + | 400 | 1254085 | + CheckboxFieldPropertyError | + 复选框字段property错误 | + + | 400 | 1254086 | + UserFieldPropertyError | + 人员字段property错误 | + + | 400 | 1254087 | + URLFieldPropertyError | + 超链接字段property错误 | + + | 400 | 1254088 | + AttachFieldPropertyError | + 附件字段property错误 | + + | 400 | 1254089 | + LinkFieldPropertyError | + 单向关联字段property错误 | + + | 400 | 1254090 | + LookUpFieldPropertyError | + 查找引用字段property错误 | + + | 400 | 1254091 | + FormulaFieldPropertyError | + 公式字段property错误 | + + | 400 | 1254092 | + DuplexLinkFieldPropertyError | + 双向关联字段property错误 | + + | 400 | 1254093 | + CreatedTimeFieldPropertyError | + 创建时间字段property错误 | + + | 400 | 1254094 | + ModifiedTimeFieldPropertyError | + 最后更新时间字段property错误 | + + | 400 | 1254095 | + CreatedUserFieldPropertyError | + 创建人字段property错误 | + + | 400 | 1254096 | + ModifiedUserFieldPropertyError | + 修改人字段property错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: client_token + in: query + description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 + required: false + example: fe599b60-450f-46ff-b2ef-9f6675625b97 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + field_name: + type: string + description: 多维表格字段名 示例值:"多行文本" + type: + type: integer + description: 多维表格字段类型 + required: + - field_name + - type + x-apifox-orders: + - field_name + - type + example: + field_name: test + type: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + field: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + type: + type: integer + description: 多维表格字段类型 + property: + type: 'null' + description: 字段属性 + required: + - field_id + - field_name + - type + - property + description: 字段 + required: + - field + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + example: + code: 0 + data: + field: + field_id: fld4bocNLY + field_name: test + type: 1 + property: null + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020919-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020920.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020920.md new file mode 100644 index 0000000..d0953f8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020920.md @@ -0,0 +1,463 @@ +# 更新字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}: + put: + summary: 更新字段 + deprecated: false + description: >+ + 该接口用于在数据表中更新一个字段 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254026 | + EmptyOptionName | + 选项名不能为空 | + + | 400 | 1254028 | + EmptyFieldName | + 字段名为空 | + + | 400 | 1254029 | + InvalidFieldName | + 字段名无效 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 400 | 1254080 | + TextFieldPropertyError | + 多行文本字段property错误 | + + | 400 | 1254081 | + NumberFieldPropertyError | + 数字字段property错误 | + + | 400 | 1254082 | + SingleSelectFieldPropertyError | + 单选字段property错误 | + + | 400 | 1254083 | + MultiSelectFieldPropertyError | + 多选字段property错误 | + + | 400 | 1254084 | + DateFieldPropertyError | + 日期字段property错误 | + + | 400 | 1254085 | + CheckboxFieldPropertyError | + 复选框字段property错误 | + + | 400 | 1254086 | + UserFieldPropertyError | + 人员字段property错误 | + + | 400 | 1254087 | + URLFieldPropertyError | + 超链接字段property错误 | + + | 400 | 1254088 | + AttachFieldPropertyError | + 附件字段property错误 | + + | 400 | 1254089 | + LinkFieldPropertyError | + 单向关联字段property错误 | + + | 400 | 1254090 | + LookUpFieldPropertyError | + 查找引用字段property错误 | + + | 400 | 1254091 | + FormulaFieldPropertyError | + 公式字段property错误 | + + | 400 | 1254092 | + DuplexLinkFieldPropertyError | + 双向关联字段property错误 | + + | 400 | 1254093 | + CreatedTimeFieldPropertyError | + 创建时间字段property错误 | + + | 400 | 1254094 | + ModifiedTimeFieldPropertyError | + 最后更新时间字段property错误 | + + | 400 | 1254095 | + CreatedUserFieldPropertyError | + 创建人字段property错误 | + + | 400 | 1254096 | + ModifiedUserFieldPropertyError | + 修改人字段property错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254606 | + DataNotChange | + 数据无变更 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: field_id + in: path + description: field id + required: true + example: fldPTb0U2y + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + field_name: + type: string + description: 多维表格字段名 示例值:"多行文本" + type: + type: integer + description: 多维表格字段类型 + required: + - field_name + - type + x-apifox-orders: + - field_name + - type + example: + field_name: test2 + type: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + field: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + type: + type: integer + description: 多维表格字段类型 + property: + type: 'null' + description: 字段属性 + required: + - field_id + - field_name + - type + - property + x-apifox-orders: + - field_id + - field_name + - type + - property + description: 字段 + required: + - field + x-apifox-orders: + - field + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + field: + field_id: fldwrEQHef + field_name: test2 + type: 1 + property: null + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020920-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020921.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020921.md new file mode 100644 index 0000000..23efe32 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020921.md @@ -0,0 +1,331 @@ +# 删除字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}: + delete: + summary: 删除字段 + deprecated: false + description: >+ + 该接口用于在数据表中删除一个字段 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: field_id + in: path + description: field id + required: true + example: fldPTb0U2y + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + field_id: + type: string + description: field id + deleted: + type: boolean + description: 删除标记 + required: + - field_id + - deleted + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + field_id: fldPTb0U2y + deleted: true + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020921-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020922.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020922.md new file mode 100644 index 0000000..abca888 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020922.md @@ -0,0 +1,316 @@ +# 列出视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views: + get: + summary: 列出视图 + deprecated: false + description: >+ + 根据 app_token 和 table_id,获取数据表的所有视图 + + 该接口支持调用频率上限为 20 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: page_size + in: query + description: 分页大小 + required: true + example: '10' + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + description: 视图信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: 总数 + required: + - items + - page_token + - has_more + - total + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - view_id: vewTpR1urY + view_name: 甘特视图1 + view_type: gantt + page_token: vewdHB3HyE + has_more: false + total: 1 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020922-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020923.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020923.md new file mode 100644 index 0000000..ff0e49a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020923.md @@ -0,0 +1,334 @@ +# 新增视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views: + post: + summary: 新增视图 + deprecated: false + description: >+ + 在数据表中新增一个视图 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + view_name: + type: string + description: 视图名字 示例值:"表格视图1" + view_type: + type: string + description: >- + 视图类型 示例值:"grid" 可选值有: grid:表格视图 kanban:看板视图 gallery:画册视图 + gantt:甘特视图 + required: + - view_name + - view_type + example: + view_name: 表格视图1 + view_type: grid + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + view_name: + type: string + view_type: + type: string + required: + - view_id + - view_name + - view_type + x-apifox-orders: + - view_id + - view_name + - view_type + app.table.view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + required: + - view_id + - view_name + - view_type + description: 视图 + x-apifox-orders: + - view_id + - view_name + - view_type + required: + - view + - app.table.view + x-apifox-orders: + - app.table.view + - view + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewTpR1urY + view_name: 甘特视图1 + view_type: gantt + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020923-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020924.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020924.md new file mode 100644 index 0000000..9346b34 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020924.md @@ -0,0 +1,277 @@ +# 删除视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + delete: + summary: 删除视图 + deprecated: false + description: >+ + 删除数据表中的视图 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254023 | LastViewDeleteForbidden | + 最后一个视图禁止删除 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图ID + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020924-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020925.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020925.md new file mode 100644 index 0000000..56178f8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020925.md @@ -0,0 +1,287 @@ +# 列出数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables: + get: + summary: 列出数据表 + deprecated: false + description: >+ + 根据 app_token,获取多维表格下的所有数据表 + + 该接口支持调用频率上限为 20 QPS + + 关于云文档接口的 AccessToken 调用说明详见 [云文档接口快速入门] + + + (https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 示例值:"tblsRc9GRRXKqhvW" + required: false + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: page_size + in: query + description: 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + example: '10' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + items: + type: array + items: + type: object + properties: + table_id: + type: string + description: 数据表 id + revision: + type: integer + description: 数据表的版本号 + name: + type: string + description: 数据表名字 + description: 数据表信息 + required: + - has_more + - page_token + - total + - items + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + has_more: false + page_token: tblKz5D60T4JlfcT + total: 1 + items: + - table_id: tblKz5D60T4JlfcT + revision: 1 + name: 数据表1 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020925-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020926.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020926.md new file mode 100644 index 0000000..e7dbc71 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020926.md @@ -0,0 +1,281 @@ +# 新增数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables: + post: + summary: 新增数据表 + deprecated: false + description: >+ + 新增一个数据表 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 + Open ID 不同。了解更多:如何获取 Open ID + union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID + 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union + ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? + user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID + 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID + 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 + user_id,字段权限要求: 获取用户 user ID + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + table: + type: object + properties: + name: + type: string + description: 数据表 名字 示例值:"table1" + required: + - name + x-apifox-orders: + - name + description: 数据表 + required: + - table + x-apifox-orders: + - table + example: + table: + name: table1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + table_id: + type: string + description: table id + required: + - table_id + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + table_id: tblKz5D60T4JlfcT + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020926-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020927.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020927.md new file mode 100644 index 0000000..e3b3e77 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020927.md @@ -0,0 +1,286 @@ +# 新增多个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/batch_create: + post: + summary: 新增多个数据表 + deprecated: false + description: >+ + 新增多个数据表 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 + Open ID 不同。了解更多:如何获取 Open ID + union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID + 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union + ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? + user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID + 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID + 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 + user_id,字段权限要求: 获取用户 user ID + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + tables: + type: array + items: + type: object + properties: + name: + type: string + description: 数据表 名字 示例值:"table1" + description: tables + required: + - tables + example: + tables: + - name: table1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + table_ids: + type: array + items: + type: string + description: table ids + required: + - table_ids + x-apifox-orders: + - table_ids + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + table_ids: + - tblsRc9GRRXKqhvW + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020927-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020928.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020928.md new file mode 100644 index 0000000..1e829ec --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020928.md @@ -0,0 +1,247 @@ +# 删除一个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}: + delete: + summary: 删除一个数据表 + deprecated: false + description: >+ + 删除一个数据表 + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 403 | 1254034 | The last table cannot be deleted. | + 不能删除最后一张数据表 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020928-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020929.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020929.md new file mode 100644 index 0000000..92af7a8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020929.md @@ -0,0 +1,260 @@ +# 删除多个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/batch_delete: + post: + summary: 删除多个数据表 + deprecated: false + description: >+ + 删除多个数据表。 + + + 该接口支持调用频率上限为 10 QPS + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 403 | 1254034 | The last table cannot be deleted. | + 不能删除最后一张数据表 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + table_ids: + type: array + items: + type: string + description: 删除的多条tableid列表 示例值:["tblsRc9GRRXKqhvW"] + required: + - table_ids + example: + table_ids: + - tblsRc9GRRXKqhvW + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020929-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949951.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949951.md new file mode 100644 index 0000000..da238a8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949951.md @@ -0,0 +1,208 @@ +# 多维表格字段变更 + +多维表格字段变更 + + + + + + + +## 事件 + +| 基本 | | +| ------------------------- | ------------------------------------------------------------ | +| 事件类型 | drive.file.bitable_field_changed_v1 | +| 支持的应用类型 | 自建应用商店应用 | +| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | +| 字段权限要求 | 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请获取用户 user ID仅自建应用 | +| 推送方式 | [Webhook](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) | + +### 事件体 + +| 名称收起子列表 | 类型 | 描述 | +| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| schema | string | 事件模式 | +| header | event_header | 事件头 | +| event_id | string | 事件 ID | +| event_type | string | 事件类型 | +| create_time | string | 事件创建时间戳(单位:毫秒) | +| token | string | 事件 Token | +| app_id | string | 应用 ID | +| tenant_key | string | 租户 Key | +| event | - | - | +| file_type | string | 文档类型 | +| file_token | string | 文档token | +| table_id | string | 多维表格数据表ID | +| operator_id | user_id | 用户 ID | +| union_id | string | 用户的 union id | +| user_id | string | 用户的 user id**字段权限要求**:获取用户 user ID仅自建应用 | +| open_id | string | 用户的 open id | +| action_list | bitable.table.field_action[] | 字段变更操作列表 | +| action | string | 操作类型 | +| field_id | string | 字段 ID | +| before_value | bitable.table.field_action.value | 操作前的字段值 | +| id | string | 字段 ID | +| name | string | 字段名字 | +| type | int | 字段类型 | +| description | string | 字段描述 | +| property | bitable.table.field_action.value.property | 字段属性 | +| formatter | string | 数字、公式字段的显示格式 | +| date_formatter | string | 日期、创建时间、最后更新时间字段的显示格式 | +| auto_fill | boolean | 日期字段中新纪录自动填写创建时间 | +| multiple | boolean | 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 | +| table_id | string | 单向关联、双向关联字段中关联的数据表的ID | +| table_name | string | 单向关联、双向关联字段中关联的数据表的名字 | +| back_field_name | string | 双向关联字段中关联的数据表中对应的双向关联字段的名字 | +| input_type | string | 地理位置输入限制 | +| back_field_id | string | 双向关联字段中关联的数据表中对应的双向关联字段的id | +| auto_serial | bitable.table.field_action.value.property.auto_serial | 自动编号类型 | +| type | string | 自动编号类型 | +| options | bitable.table.field_action.value.property.auto_serial.options[] | 自动编号规则列表 | +| type | string | 自动编号的可选规则项类型 | +| value | string | 与类型相对应的取值 | +| options | bitable.table.field_action.value.property.option[] | 单选、多选字段的选项信息 | +| name | string | 选项名 | +| id | string | 选项ID | +| color | int | 选项颜色 | +| formula_expression | string | 公式字段的公式表达式 | +| after_value | bitable.table.field_action.value | 操作后的字段值 | +| id | string | 字段 ID | +| name | string | 字段名字 | +| type | int | 字段类型 | +| description | string | 字段描述 | +| property | bitable.table.field_action.value.property | 字段属性 | +| formatter | string | 数字、公式字段的显示格式 | +| date_formatter | string | 日期、创建时间、最后更新时间字段的显示格式 | +| auto_fill | boolean | 日期字段中新纪录自动填写创建时间 | +| multiple | boolean | 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 | +| table_id | string | 单向关联、双向关联字段中关联的数据表的ID | +| table_name | string | 单向关联、双向关联字段中关联的数据表的名字 | +| back_field_name | string | 双向关联字段中关联的数据表中对应的双向关联字段的名字 | +| input_type | string | 地理位置输入限制 | +| back_field_id | string | 双向关联字段中关联的数据表中对应的双向关联字段的id | +| auto_serial | bitable.table.field_action.value.property.auto_serial | 自动编号类型 | +| type | string | 自动编号类型 | +| options | bitable.table.field_action.value.property.auto_serial.options[] | 自动编号规则列表 | +| type | string | 自动编号的可选规则项类型 | +| value | string | 与类型相对应的取值 | +| options | bitable.table.field_action.value.property.option[] | 单选、多选字段的选项信息 | +| name | string | 选项名 | +| id | string | 选项ID | +| color | int | 选项颜色 | +| formula_expression | string | 公式字段的公式表达式 | +| revision | int | 多维表格数据表的版本号 | +| subscriber_id_list | user_id[] | 订阅用户id列表 | +| union_id | string | union id | +| user_id | string | user id | +| open_id | string | open id | +| update_time | int | 字段变更时间 | + +### 事件体示例 + +``` +{ + "schema": "2.0", + "header": { + "event_id": "5e3702a84e847582be8db7fb73283c02", + "event_type": "drive.file.bitable_field_changed_v1", + "create_time": "1608725989000", + "token": "rvaYgkND1GOiu5MM0E1rncYC6PLtF7JV", + "app_id": "cli_9f5343c580712544", + "tenant_key": "2ca1d211f64f6438" + }, + "event": { + "file_type": "bitable", + "file_token": "bascntUPmnoH9kZbGJ8RWeabcef", + "table_id": "tblWXe2d0I0abcef", + "operator_id": { + "union_id": "on_8ed6aa67826108097d9ee143816345", + "user_id": "e33ggbyz", + "open_id": "ou_84aad35d084aa403a838cf73ee18467" + }, + "action_list": [ + { + "action": "field_edited", + "field_id": "fldmj5qNii", + "before_value": { + "id": "fldmj5qNii", + "name": "field name", + "type": 20, + "description": "description", + "property": { + "formatter": "1,000", + "date_formatter": "yyyyMMdd", + "auto_fill": true, + "multiple": true, + "table_id": "tblIniLz0Ic8oXyN", + "table_name": "table name", + "back_field_name": "field name", + "input_type": "only_mobile", + "back_field_id": "fldmj5qNii", + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + }, + "options": [ + { + "name": "option name", + "id": "optabcef", + "color": 3 + } + ], + "formula_expression": "bitable::$table[tblIniLz0Ic8oXyN].$field[fldqatAwxx]*6+333" + } + }, + "after_value": { + "id": "fldmj5qNii", + "name": "field name", + "type": 20, + "description": "description", + "property": { + "formatter": "1,000", + "date_formatter": "yyyyMMdd", + "auto_fill": true, + "multiple": true, + "table_id": "tblIniLz0Ic8oXyN", + "table_name": "table name", + "back_field_name": "field name", + "input_type": "only_mobile", + "back_field_id": "fldmj5qNii", + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + }, + "options": [ + { + "name": "option name", + "id": "optabcef", + "color": 3 + } + ], + "formula_expression": "bitable::$table[tblIniLz0Ic8oXyN].$field[fldqatAwxx]*6+333" + } + } + } + ], + "revision": 10, + "subscriber_id_list": [ + { + "union_id": "on_876b570a984d02ab1c0906a49e4a9d04", + "user_id": "638474b8", + "open_id": "ou_9bc587355789fc049904ae7c73619b89" + } + ], + "update_time": 1663727688 + } +} +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949955.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949955.md new file mode 100644 index 0000000..7b2f6f3 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949955.md @@ -0,0 +1,113 @@ +# 多维表格记录变更 + +了解事件订阅的使用场景和配置流程,请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) + +被订阅的多维表格记录发生变更将会触发此事件,**公式字段的值变化不会触发事件**。 + +## 概述 + +| 基本 | | +| ------------------------- | ------------------------------------------------------------ | +| 支持的应用类型 | 自建应用商店应用 | +| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | + +如何订阅文档请点击查看 [订阅云文档事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/subscribe)。 + +## 支持的记录变更类型 + +| 变更类型 | action | +| ---------- | ---------------- | +| 新增行记录 | `record_added` | +| 删除行记录 | `record_deleted` | +| 修改行记录 | `record_edited` | + +回调结构中的 `field_value` 字段为 JSON 序列化后的字符串,序列化前的结构请查看 [数据结构](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure) + +## 回调示例 + +``` +{ + "schema": "2.0", // 事件格式的版本。无此字段的即为1.0 + "header": { + "event_id": "85ec04b2f6cff27a1bf249b26fbabcef", // 事件的唯一标识 + "token": "L3bzVf0sz7qb9XoTavpsHe0uJv7abcef", // 即 Verification Token + "create_time": "1652677457000", // 事件发送的时间 + "event_type": "drive.file.bitable_record_changed_v1", // 事件类型 + "tenant_key": "736588c9260abcef", // 企业标识 + "app_id": "cli_a00c8400a7babcef" // 应用ID + }, + "event": { + "action_list": [ + { + "action": "record_edited", // 变更类型:修改记录 + "after_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更后的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"变更后的值\"}]" // 发生变更后的字段值 + } + ], + "before_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "123" // 发生变更前的字段值 + }, + { + "field_id": "fldqaabcef", // 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"变更前的值\"}]" // 发生变更前的字段值 + } + ], + "record_id": "rec9sabcef" // 发生变更的记录 ID + }, + { + "action": "record_added", // 变更类型:新增记录 + "after_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更后的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"新增记录字段值\"}]" // 发生变更后的字段值 + } + ], + "record_id": "rec9sabcef" // 新增的记录 ID + }, + { + "action": "record_deleted", // 变更类型:删除记录 + "before_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更前的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"删除记录前字段值\"}]" // 发生变更前的字段值 + } + ], + "record_id": "rec9sabcef" // 删除的记录 ID + } + ], + "file_token": "bascnItn6oHUSEL8RDUdF6abcef", // 多维表格 token + "file_type": "bitable", // 文件类型,即 bitable + "operator_id": { // 操作人 + "open_id": "ou_9bc587355789fc049904ae7c736abcef", + "union_id": "on_8f71e0224c012a0365ad4e3c733abcef", + "user_id": "638abcef" + }, + "subscriber_id_list": [ // 订阅的用户列表 + { + "open_id": "ou_9bc587355789fc049904ae7c736abcef", + "union_id": "on_8f71e0224c012a0365ad4e3c733abcef", + "user_id": "638abcef" + } + ], + "table_id": "tblOaqBWfGeabcef" // 发生变更的数据表 ID + } +} +``` + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1964912.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1964912.md new file mode 100644 index 0000000..3f4f486 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1964912.md @@ -0,0 +1,46 @@ +# 概述 + +多维表格的 **所有者 或者 有可管理权限** 的用户可通过 API 设置高级权限,管理高级权限的协作者,针对每个数据表设置谁可以查看、编辑指定的行,或是指定可以编辑的列。使用前请阅读[使用多维表格高级权限](https://www.feishu.cn/hc/zh-CN/articles/588604550568)。 + +高级权限接口分为 **自定义角色** 和 **协作者** 两部分。 + +## 注意事项 + +调用高级权限的接口前,请先确保多维表格已开启高级权限。可以通过[更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)开启高级权限。 + + + +- 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限。 +- 开启高级权限有延迟,开启高级权限后立即调用高级权限的接口时遇到 `OperationTypeError` 的报错请重试。 +- 高级权限的协作者与云文档权限协作者为不同权限身份,添加高级权限协作者之后,为保证文档权限设置正常,建议再通过 [增加协作者权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) 接口新增文档权限。 + +开启高级权限后,首先设置自定义角色,完成设置后可管理自定义的协作者。 + + + +暂不支持仪表盘权限 + +## 方法列表 + +### 设置自定义角色 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview)。 + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +### 管理自定义角色的协作者 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview)。 + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436424.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436424.md new file mode 100644 index 0000000..49a2c42 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436424.md @@ -0,0 +1,153 @@ +# 概述 + +多维表格是一个表格,也是无数个应用,千人千面,万人万解。 + +## 资源:多维表格应用 App + +每个多维表格都有唯一 app_token 作为标识。(这里的 app 指一个多维表格,而不是指开发者创建的应用) + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| app_token | string | 一个多维表格的唯一标识。 **示例值**:"bascnKMKGS5oD3lmCHq9euO8cGh"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [获取多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get)`GET` /open-apis/bitable/v1/apps/:app_token | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)`PUT` /open-apis/bitable/v1/apps/:app_token | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:数据表 Table + +多维表格的数据容器,一个多维表格中至少有一个数据表,也可能有多个数据表。每个数据表都有唯一标识 table_id。table_id 在一个多维表格 App 中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| -------- | ------ | ------------------------------------------------------------ | +| table_id | string | 一个数据表的唯一标识。 **示例值**:"tblTONn0A0CbGRDX"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:视图 View + +数据表的呈现布局。一个数据表至少有一个视图,可能有多个视图。每个视图都有唯一标识 view_id,view_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| ------- | ------ | ------------------------------------------------------------ | +| view_id | string | 一个视图的唯一标识。 **示例值**:"vewhNUNwqB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:记录 Record + +数据表中的每一行数据都是 Record。每条记录都有唯一标识 record_id,record_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| record_id | string | 一行记录的唯一标识。 **示例值**:"recn0hoyXL"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:字段 Field + +多维表格的字段。每个字段都有唯一标识 field_id,field_id 在一个多维表格内唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| -------- | ------ | ------------------------------------------------------------ | +| field_id | string | 一列字段的唯一标识。 **示例值**:"fldwJ4YrtB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:自定义权限 Role + +高级权限的规则设置。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| ------- | ------ | ------------------------------------------------------------ | +| role_id | string | 一条自定义权限的唯一标识。 **示例值**:"rolJOiPRqp"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:自定义权限的协作者 Member + +高级权限下的协作者。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| member_id | string | 一条自定义权限下的一位协作者的唯一标识。 **示例值**:"ou_xxxxxxxxxxx"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436427.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436427.md new file mode 100644 index 0000000..2a2fcf2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436427.md @@ -0,0 +1,203 @@ +# 接入指南 + +多维表格(Bitable)是飞书云文档下的一个产品。它可以是一个表格,也可以是无数个应用。 + +## 1.形态 + +一篇多维表格可以理解成是一个应用(app),标记该应用的唯一标识叫 apptoken; + +每篇多维表格是由有多个数据表(table)组成的,标记该数据表的唯一标识叫 tableid; + +作为一个应用它会有多种形态存在; + +可以作为一个独立应用存在,也可以作为一个模块(block)与飞书文档、飞书表格结合在一起。 + +| 飞书云文档中 | 飞书文档中 | 飞书表格中 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| Bitable app | Bitable doc block | Bitable sheet block | +| 即在"**飞书云文档**"中新建的多维表格 | 即在"**飞书文档**"中插入的多维表格 | 即在"**飞书表格**"中新建的多维表格 | +| URL 以 **feishu.cn/base** 开头 | URL 以 **feishu.cn/docs**、**feishu.cn/docx** 开头 | URL 以 **feishu.cn/sheets** 开头 | +| 支持 | 支持 | 支持 | +| ![飞书云文档中](../../assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png) | ![飞书文档中](../../assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png) | ![飞书表格中](../../assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png) | + +> *通过 API 在飞书表格(Sheets)中新建数据表暂时无法在页面看到,后续会支持; + +## 2.内容 + +目前开放多维表格在App、数据表、视图、字段、记录、高级权限设置和高级权限协作者 7 种内容的 API 。 + +记录可以狭义的理解为表格行; + +字段可以狭义的理解为表格的列; + +| 记录* | 字段 | 视图 | 数据表 | App | 权限 | 高级权限设置 | 高级权限协作者 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) [记录筛选开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/filter) [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get) [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [新增多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) [更新多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update) [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete) [删除多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete) | [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete) | [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list) [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create) [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete) | [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list) [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create) [新增多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create) [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete) [删除多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete) | [获取元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get) [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update) [新建多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uQTNzUjL0UzM14CN1MTN) [复制多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uYTNzUjL2UzM14iN1MTN) [删除多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/[删除文件](/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/delete)) | [增加权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) [移除权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/delete) [更新权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/update) [列出列表](https://open.feishu.cn/document/ukTMukTMukTM/uATN3UjLwUzN14CM1cTN) [转移拥有者](https://open.feishu.cn/document/ukTMukTMukTM/uQzNzUjL0czM14CN3MTN) [判断是否有权限](https://open.feishu.cn/document/ukTMukTMukTM/uYzN3UjL2czN14iN3cTN) [更新文档设置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-public/patch) | [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list) [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create) [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete) [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update) | [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list) [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create) [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete) | +| 最多 20000条/记录 | 最多150个/字段 | 最多200个/视图 | 最多100个/表格 | -- | -- | 最多30条/自定义权限 | 最多200个/自定义权限协作者 | + +> 注意:列出记录一次最多支持列出 500 条; +> +> 操作多条记录(限制在 500 条/次以下)的结果是全部成功或者全部失败,不存在部分结果。 +> +> 同一时刻,对同一篇多维表格最好只请求一次 API 写操作。 + +## 3.鉴权 + + + +- 在使用 + + tenant_access_token + + + + 前,请确保你的应用已经是文档的所有者或者协作者,否则会调用失败。 + + + +- 多维表格大部分接口都支持通过 + + user_access_token + + + + 和 + + + + tenant_access_token + + + + 两种身份进行调用。但仍然有部分接口只支持其中一种身份,请开发者在调用前,仔细阅读对应接口的说明文档。 + + + +- 使用 + + tenant_access_token + + + + 前,请确保你所使用的应用在云文档的协作者列表里。现阶段,你可以通过使用 + + + + tenant_access_token + + + + 来创建一篇多维表格,再使用 + + + + tenant_access_token + + + + 来进行进一步的操作。 + + + +| **user_access_token** | **tenant_access_token** | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| **用户身份鉴权** token 有效期为7200秒 当该token被刷新之后,老的 token 随即失效 | **应用身份鉴权** token 有效时间2小时 当token有效期<30分,可刷新得到新token 在2小时之内,新老token同时有效 | +| [获取用户身份访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/get-) | [获取应用身份访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/g) | +| 适合小程序、网页应用等场景 | 适合纯后台服务等场景 | + +## 4.限制 + +### QPS 限制 + +- 每个接口都有接口调用的频率限制,可参考[频控策略](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)。 +- 对于接口的批量操作,单次最高 500 条记录,且响应状态是全部成功或者失败,不存在部分结果。 + +### 接口报错 + +当请求不符合某些特定条件时会报错,如果因为部分参数不符合要求而导致报错,意味着当次请求所有的内容提交都失败了,不会对线上的数据造成影响。具体可参考:[服务端错误码说明](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN) + +## 5.字段类型 + +| 接口类型 | 支持 | 不支持 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------------- | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) | 全支持 | -- | +| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) | 多行文本、单选、多选、日期、人员、附件、复选框、超链接、数字、单向关联、电话号码、地理位置 | 双向关联 公式 查找引用 | +| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) | 全支持 | -- | +| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) | 多行文本、单选、多选、日期、数字、人员、附件、单向关联、双向关联、复选框、超链接、公式(不支持设置公式表达式)、创建人、修改人、创建时间、最后更新时间、自动编号、电话号码、地理位置 | 查找引用 | + +## 6.参数说明 + +**API 地址**:https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id + +### app_token + +#### Bitable app + +- 在飞书云文档中打开一篇多维表格,其 URL 中 app_token 是下图框住部分;![app_token.png](../../assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png) + +#### Bitable doc block + +- 调用[获取文档所有块](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document-block/list),在返回结果中检索,其中 bitable.token 字段的值 AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +- + +``` +{ + "bitable": { + "token": "AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx" + }, + "block_id": "Mgeadqo4CoeoOGxI7Lgb4GNicEd", + "block_type": 18, + "parent_id": "YUqpdO2eLo7xJdxy5RQbuQBdctf" +} +``` + +#### Bitable sheet block + +- 调用[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN),在返回结果中检索,其中 blockType 的值为 BITABLE_BLOCK 时,blockToken 字段的值AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +- + +``` +{ + "blockInfo": { + "blockToken": "AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx", + "blockType": "BITABLE_BLOCK" + }, + "columnCount": 0, + "frozenColCount": 0, + "frozenRowCount": 0, + "index": 0, + "rowCount": 0, + "sheetId": "***", + "title": "*** " +} +``` + +### table_id + +#### Bitable app + +- 在 Bitable app 中打开一篇多维表格,其 URL 中 table_id 是下图中框住部分;![table_id.png](../../assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png) +- 对于其它场景的多维表格,需要通过[列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)接口获取; + +### view_id + +- 打开任意一篇多维表格,其 URL 中 view_id 是下图中框住部分;![view_id.png](../../assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png) +- 或者通过[列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)接口获取。暂时无法获取到 Bitable doc block 中表格的 view_id; + +### record_id + +- 需要通过[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)接口获取; + +### field_id + +- 需要通过[列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)接口获取; + +### role_id + +- 需要通过[列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)接口获取; + +### member_id + +- 需要通过[列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)接口获取; + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436428.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436428.md new file mode 100644 index 0000000..5c3dd71 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436428.md @@ -0,0 +1,127 @@ +# 数据结构 + +一篇多维表格可以理解成是一个 app,他的唯一标识就是 `app_token`。 + +app 是由一个个 table 组成,我们称 table 为数据表,他的标识就是 `table_id`。 + +table 由 record(记录) 和 field(字段) 组成, 同时可以拥有多个 view (视图)。 + +## 记录 + +记录由 record 和 fields 2个结构组成。 + +### record结构 + +记录是一个object结构类型。 + +| 参数 | 数据结构 | 描述 | +| ----------- | -------- | ---------- | +| `record_id` | string | 记录的id | +| `fields` | map | 记录的字段 | + +### fields结构 + +fields是一个map,是由字段名和其具体内容的键值对组成。 + +| item | datatype | description | +| ------- | -------- | ------------------------------------------------------------ | +| `key` | `string` | 字段名 | +| `value` | `union` | 某个字段的具体内容,其结构可以是string, boolean, list of string and list of person object | + +#### value结构(不同字段类型对应值的结构) + +| 字段类型 | value结构 | 描述 | +| ------------ | ------------------------------ | ------------------------------------------------------------ | +| 多行文本 | string | 值 | +| 数字 | 写入时为number,列出时为string | 值 | +| 单选 | string | 选项名称 | +| 多选 | array | 包含多个选项名字符串的数组 | +| 日期 | number | Unix 时间戳,单位是毫秒 | +| 复选框 | boolean | 布尔值 | +| 人员 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 电话号码 | string | 电话号码,符合正则表达式`(\+)?\d*`的字符串 | +| 超链接 | object | 具体结构参考: [超链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#超链接) | +| 附件 | object | 具体结构参考: [附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#附件) | +| 单向关联 | array | 包含多个 record_id 字符串的数组 | +| 双向关联 | - | 只支持列出,暂不支持写入 | +| 创建时间 | number | Unix 时间戳,单位是毫秒 | +| 最后更新时间 | number | Unix 时间戳,单位是毫秒 | +| 创建人 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 修改人 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 自动编号 | string | 由自动编号规则组成的字符串 | +| 地理位置 | object | 具体结构参考: [地理位置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#地理位置) | + +##### 人员 + +| 参数 | 数据结构 | 描述 | +| --------- | -------- | -------- | +| `name` | string | 名字 | +| `id` | string | id | +| `en_name` | string | 英文名字 | +| `email` | string | 邮箱 | + +##### 超链接 + +| 参数 | 数据结构 | 描述 | +| ------ | -------- | -------- | +| `text` | string | 文本名称 | +| `link` | string | 超链接 | + +##### 附件 + +| 参数 | 数据结构 | 描述 | +| ------------ | -------- | ------------------------------------------------------------ | +| `file_token` | string | 附件token | +| `name` | string | 附件名称 | +| `type` | string | 附件的 mime 类型, 如: `image/png` | +| `size` | int | 附件大小, 单位: 字节 | +| `url` | string | 附件url,下载请参考:[下载附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/attachment#22daecaf) | +| `tmp_url` | string | 生成附件临时下载链接的url,需access token鉴权 | + +##### 地理位置 + +| 参数 | 数据结构 | 描述 | +| -------------- | -------- | -------- | +| `location` | string | 经纬度 | +| `pname` | string | 省 | +| `cityname` | string | 市 | +| `adname` | string | 区 | +| `address` | string | 详细地址 | +| `name` | string | 地名 | +| `full_address` | string | 完整地址 | + +## 字段 + +字段是一个`object`结构类型。 + +| 名称 | 类型 | 描述 | +| ---------- | ------ | ------------------------------------------------------------ | +| field_id | string | 字段id | +| field_name | string | 字段名 | +| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +| property | object | 字段属性,因字段类型而异 | + +### Property说明 + +参考: [字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide) + +## 视图 + +视图是一个object结构类型。 + +| item | datatype | description | +| ----------- | -------- | ------------------------------------------------------------ | +| `view_id` | `string` | 视图id | +| `view_name` | `string` | 视图名称 | +| `view_type` | `string` | 视图类型,支持grid, kanban, gallery, gantt四种类型,默认为grid类型 | + +## 自定义数据结构 + +### delete_record + +| 参数 | 数据类型 | 描述 | +| ----------- | --------- | ------------ | +| `deleted` | `boolean` | 是否删除成功 | +| `record_id` | `string` | 单条记录的id | + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436454.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436454.md new file mode 100644 index 0000000..0de1c38 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436454.md @@ -0,0 +1,95 @@ +# 记录筛选开发指南 + +在[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)中可以通过查询参数 filter 去筛选出你需要的 records。 + +## 注意事项 + +filter 后的表达式支持[公式语法](https://www.feishu.cn/hc/zh-CN/articles/360049067853),可通过 AND 或 OR 来组合。 + +表达式的语法为: CurrentValue.[字段名],其中首字母 C 和 V 要大写。 + +由于 URL 支持字符集的限制,需要将请求参数编码之后传输,如“+”号要编码为“%2B”。 + +## 常用筛选公式 + +| 逻辑名称 | 表达式 | +| -------- | -------------------------------------------- | +| 为空 | `CurrentValue.[订单号] =""` | +| 不为空 | `NOT(CurrentValue.[订单号] ="")` | +| 等于 | `CurrentValue.[订单号] = "003"` | +| 不等于 | `CurrentValue.[订单号] != "003"` | +| 大于等于 | `CurrentValue.[价格] >= 10.5` | +| 小于等于 | `CurrentValue.[订单号] <= "003"` | +| 包含 | `CurrentValue.[订单号].contains("003")` | +| 不包含 | `NOT(CurrentValue.[订单号].contains("003"))` | +| AND | `表达式1&&表达式2 或者 AND(表达式1,表达式2)` | +| OR | `OR(表达式1,表达式2)` | + +## 常用的逻辑表达式 + +与 + +> AND(CurrentValue.[订单号].contains("004"),CurrentValue.[订单日期]= TODAY()) + +或 + +> OR(CurrentValue.[订单号].contains("004"),CurrentValue.[订单号].contains("009")) + +## 常用的日期表达式 + +今天 + +> CurrentValue.[订单日期] = TODAY() + +昨天 + +> CurrentValue.[订单日期] = TODAY()-1 + +明天 + +> CurrentValue.[订单日期] = TODAY()%2B1 + +本周 + +> AND(TODAY()-(WEEKDAY(TODAY(),2)-1)<=CurrentValue.[订单日期], CurrentValue.[订单日期]<=TODAY()%2B(7-WEEKDAY(TODAY(),2))) + +本月 + +> AND(DATE(YEAR(TODAY()),MONTH(TODAY()),1)<=CurrentValue.[订单日期], CurrentValue.[订单日期]<=DATE(YEAR(TODAY()),MONTH(TODAY())%2B1,0)) + +过去N天 + +> today()-N%2B1 <= CurrentValue.[订单日期]&&CurrentValue.[订单日期] <= today() + +未来N天 + +> today()<= CurrentValue.[订单日期]&&CurrentValue.[订单日期] <= today()%2BN-1 + +在某个日期之内 + +> CurrentValue.[订单日期] > TODATE("2021-06-01")&&CurrentValue.[订单日期] < TODATE("2021-06-31") + +## 字段筛选示例 + +| 字段 | 筛选示例 | +| ------------ | ------------------------------------------------------------ | +| 多行文本 | `CurrentValue.[字段名1]="内容a"` | +| 单选 | `CurrentValue.[字段名1]="选项内容a"` | +| 多选 | `CurrentValue.[字段名1]="选项内容a"` | +| 人员 | `CurrentValue.[人员]="袁志伟"` | +| 电话号码 | `CurrentValue.[电话号码]="+2020202020"` | +| 日期 | `CurrentValue.[订单日期] = TODAY()` | +| 附件 | `CurrentValue.[字段名1]="内容a"` | +| 数字 | `CurrentValue.[字段名1]=1` | +| 复选框 | `CurrentValue.[字段名1]=1` | +| 超链接 | `CurrentValue.[超链接]="超链接的文本值"` | +| 公式 | `CurrentValue.[字段名1]="内容a"`(如果公式返回值为数字,则不需要双引号,如`CurrentValue.[字段名1]=123`) | +| 查找引用 | `CurrentValue.[字段名1]="内容a"` | +| 单向关联 | `CurrentValue.[字段名1]="内容a"` | +| 创建人 | `CurrentValue.[创建人]="人名a"` | +| 创建时间 | `CurrentValue.[字段名1]>TODAY()` | +| 修改人 | `CurrentValue.[修改人]="小飞书"` | +| 最后更新时间 | `CurrentValue.[字段名1]>TODAY()` | +| 自动编号 | `CurrentValue.[自动编号]="001no20220624"` | + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436742.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436742.md new file mode 100644 index 0000000..d9249aa --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436742.md @@ -0,0 +1,649 @@ +# 字段编辑指南 + +## 字段概述 + +字段是一个`object`结构类型。结构如下: + +| 名称 | 类型 | 描述 | +| ---------- | ------ | ------------------------------------------------------------ | +| field_id | string | 字段id | +| field_name | string | 字段名 | +| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +| property | object | 字段属性,因字段类型而异 | + +注意: + +更新字段时为全量更新,`property`会被完全覆盖。在下面的单选、多选字段的[更新字段的请求体示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#更新字段的请求体示例)中有所体现。 + +## Property说明 + +部分类型字段有特殊的属性配置,在下面列出。其他类型字段的`property`均为`null`。 + +### 数字字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| --------- | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| formatter | string | 格式,参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中数字格式与formatter的对应关系) | 否 | 是 | 参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中数字格式与formatter的对应关系) | "0.0" | + +#### 网页中数字格式与formatter的对应关系 + +| 网页中数字格式 | formatter | +| ---------------- | ---------- | +| 整数 | "0" | +| 保留1位小数 | "0.0" | +| 保留2位小数 | "0.00" | +| 保留3位小数 | "0.000" | +| 保留4位小数 | "0.0000" | +| 千分位 | "1,000" | +| 千分位(小数点) | "1,000.00" | +| 百分比 | "%" | +| 百分比(小数点) | "0.00%" | +| 人民币 | "¥" | +| 人民币(小数点) | "¥0.00" | +| 美元 | "$" | +| 美元(小数点) | "$0.00" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "数字", + "type": 2, + "property": { + "formatter": "0.00" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldoMnnvIR", + "field_name": "数字", + "property": { + "formatter": "0.00" + }, + "type": 2 + } + }, + "msg": "Success" +} +``` + +### 单选、多选字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------- | --------------------------------- | -------- | ---- | ------------ | ---------- | ------------------------------- | +| options | app.table.field.property.option[] | 选项列表 | 否 | 否 | - | - | +| ∟id | string | 选项id | 否 | 否 | - | - | +| ∟name | string | 选项名 | 否 | 否 | - | - | +| ∟color | int | 选项颜色 | 否 | 是 | 0~54 | 从上一个选项的color开始依次递增 | + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "单选", + "type": 3, + "property": { + "options": [ + { + "name": "a" + }, + { + "name": "b" + }, + { + "name": "c", + "color": 5 + }, + { + "name": "d" + } + ] + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fld2RxOyB8", + "field_name": "单选", + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", + "name": "a" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 5, + "id": "optDIEs1h0", + "name": "c" + }, + { + "color": 6, + "id": "optZZceUac", + "name": "d" + } + ] + }, + "type": 3 + } + }, + "msg": "Success" +} +``` + +#### 更新字段的请求体示例 + +现在,我想更新选项`a`的`name`为`a++`,选项`b`保持不变,删除选项`c`和选项`d`,新增选项`z`,请求体如下: + +``` +{ + "field_name": "单选", + "type": 3, + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", // 若携带id,id必须是旧的单选、多选字段property中已存在的选项id + "name": "a++" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 6, + "name": "z" // 不携带id,新增一个选项 + } + ] + } +} +``` + +#### 响应体示例 + +因为更新字段是全量更新,选项`c`和选项`d`已删除,响应体如下: + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fld2RxOyB8", + "field_name": "单选", + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", + "name": "a++" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 6, + "id": "opt558YmTi", + "name": "z" + } + ] + }, + "type": 3 + } + }, + "msg": "Success" +} +``` + +### 日期字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------------- | ------- | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------------ | +| date_formatter | string | 日期格式,参考:[日期格式date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | 否 | 是 | 参考:[日期格式date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | "yyyy/MM/dd" | +| auto_fill | boolean | 新纪录自动填写创建时间 | 否 | 否 | - | false | + +#### 网页中日期格式与date_formatter的对应关系 + +| 网页中日期格式 | date_formatter | +| ---------------- | ------------------ | +| 2021/01/30 | "yyyy/MM/dd" | +| 2021/01/30 14:00 | "yyyy/MM/dd HH:mm" | +| 2021-01-30 | "yyyy-MM-dd" | +| 2021-01-30 14:00 | "yyyy-MM-dd HH:mm" | +| 01-30 | "MM-dd" | +| 01/30/2021 | "MM/dd/yyyy" | +| 30/01/2021 | "dd/MM/yyyy" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "日期", + "type": 5, + "property": { + "date_formatter": "yyyy/MM/dd HH:mm", + "auto_fill": false + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldHBDkAfH", + "field_name": "日期", + "property": { + "auto_fill": false, + "date_formatter": "yyyy/MM/dd HH:mm" + }, + "type": 5 + } + }, + "msg": "Success" +} +``` + +### 人员字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------- | ------- | ---------------- | ---- | ------------ | ---------- | ------ | +| multiple | boolean | 允许添加多个成员 | 否 | 否 | - | true | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "人员", + "type": 11, + "property": { + "multiple": true + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldlQDzjyK", + "field_name": "人员", + "property": { + "multiple": true + }, + "type": 11 + } + }, + "msg": "Success" +} +``` + +### 单向关联字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ---------- | ------- | -------------------------------------- | ---- | ------------ | ---------- | ------ | +| multiple | boolean | 允许添加多个记录 | 否 | 否 | - | true | +| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +| table_name | string | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "单向关联", + "type": 18, + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldNdr8VNW", + "field_name": "单向关联", + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "table_name": "数据表2" + }, + "type": 18 + } + }, + "msg": "Success" +} +``` + +### 双向关联字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| --------------- | ------- | -------------------------------------------------- | ---- | ------------ | ---------- | ----------------------- | +| back_field_id | string | 关联的数据表中双向关联字段的id(仅在响应体中返回) | - | - | - | - | +| back_field_name | string | 关联的数据表中双向关联字段的名字 | 否 | 否 | - | 关联的数据表名-本字段名 | +| multiple | boolean | 允许添加多个记录 | 否 | 否 | - | true | +| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +| table_name | String | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "双向关联", + "type": 21, + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "back_field_name": "双向关联-自动生成" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldpfIDIi0", + "field_name": "双向关联", + "property": { + "back_field_id": "fldmQGUnWh", + "back_field_name": "双向关联-自动生成", + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "table_name": "数据表2" + }, + "type": 21 + } + }, + "msg": "Success" +} +``` + +### 公式字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------------------ | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| formatter | string | 格式参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中公式格式与formatter的对应关系) | 否 | 是 | 参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中公式格式与formatter的对应关系) | "" | +| formula_expression | string | 格式参考:[formula](https://www.feishu.cn/hc/zh-CN/articles/360049067853) | 否 | 否 | | "" | + +#### 网页中公式格式与formatter的对应关系 + +| 网页中公式格式 | formatter | +| ---------------- | ------------------ | +| 默认 | "" | +| 整数 | "0" | +| 保留1位小数 | "0.0" | +| 保留2位小数 | "0.00" | +| 千分位 | "1,000" | +| 千分位(小数点) | "1,000.00" | +| 百分比 | "%" | +| 百分比(小数点) | "0.00%" | +| 人民币 | "¥" | +| 人民币(小数点) | "¥0.00" | +| 美元 | "$" | +| 美元(小数点) | "$0.00" | +| 2021/01/30 14:00 | "yyyy/MM/dd HH:mm" | +| 2021/01/30 | "yyyy/MM/dd" | +| 2021-01-30 | "yyyy-MM-dd" | +| 01-30 | "MM-dd" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "公式", + "type": 20, + "property": { + "formatter": "0.00%", + "formula_expression": "IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN(\"飞书\"),\"aaa\",\"bbb\")" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldFuAdYEI", + "field_name": "公式", + "property": { + "formatter": "0.00%", + "formula_expression": "IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN(\"飞书\"),\"aaa\",\"bbb\")" + }, + "type": 20 + } + }, + "msg": "Success" +} +``` + +### 创建时间、最后更新时间字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------------- | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------------ | +| date_formatter | string | 日期格式,参考:[date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | 否 | 是 | 参考:[date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | "yyyy/MM/dd" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "创建时间", + "type": 1001, + "property": { + "date_formatter": "yyyy/MM/dd" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldoblwmUC", + "field_name": "创建时间", + "property": { + "date_formatter": "yyyy/MM/dd" + }, + "type": 1001 + } + }, + "msg": "Success" +} +``` + +### 自动编号字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------------------------- | ---------------------------------------- | ------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| auto_serial | app.field.property.auto_serial | 自动编号 | 否 | 否 | - | - | +| ∟type | string | 自动编号类型 | 是 | 是 | 参考:[auto_serial_type](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中编号类型与auto_serial_type的对应关系) | - | +| reformat_existing_records | bool | 是否将修改应用于已有编号 | 否 | 否 | - | false | +| ∟options | app.field.property.auto_serial.options[] | 自定义编号规则列表 | 否 | 否 | - | - | +| ∟type | string | 规则类型 | 是 | 是 | 参考:[rule_option_type](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中编号规则与rule_option_type的对应关系) | - | +| ∟value | string | 值 | 是 | 否 | - | - | + +#### 网页中编号类型与auto_serial_type的对应关系 + +| 网页中编号类型 | auto_serial_type | +| -------------- | ----------------------- | +| 自定义编号 | "custom" | +| 自增数字 | "auto_increment_number" | + +#### 网页中编号规则与rule_option_type的对应关系 + +| 网页中编号类型 | rule_option_type | 对应的value限制 | +| -------------- | ---------------- | ------------------------------------------------------------ | +| 自增数字 | "system_number" | 1-9 | +| 固定字符 | "fixed_text" | 最大长度:20 | +| 创建日期 | "created_time" | 可选值参考:[created_time](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中创建日期与created_time的对应关系) | + +#### 网页中创建日期与created_time的对应关系 + +| 网页中创建日期 | created_time | +| -------------- | ------------ | +| 20220130 | "yyyyMMdd" | +| 202201 | "yyyyMM" | +| 2022 | "yyyy" | +| 0130 | "MMdd" | +| 01 | "MM" | +| 30 | "dd" | + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "自动编号", + "property": { + "auto_serial": { + "type": "custom", + "reformat_existing_records": true, + "options": [ + { + "type": "system_number", + "value": "3" + }, + { + "type": "fixed_text", + "value": "no" + }, + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + } + }, + "type": 1005 +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "msg": "success", + "data": { + "field": { + "property": { + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "system_number", + "value": "3" + }, + { + "value": "no", + "type": "fixed_text" + }, + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + } + }, + "field_id": "fldmVunQuc", + "field_name": "自动编号", + "type": 1005 + } + } +} +``` + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "自增数字自动编号", + "property": { + "auto_serial": { + "type": "auto_increment_number", + "reformat_existing_records": true + } + }, + "type": 1005 +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "msg": "success", + "data": { + "field": { + "field_name": "自增数字自动编号", + "type": 1005, + "property": { + "auto_serial": { + "type": "auto_increment_number" + } + }, + "field_id": "fldwq16vz2" + } + } +} +``` + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436743.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436743.md new file mode 100644 index 0000000..72d6df3 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436743.md @@ -0,0 +1,163 @@ +# 附件字段说明 + +使用前请仔细阅读[素材概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)。 + +## 数据结构 + +| 字段名 | 字段描述 | +| :--------- | :--------------- | +| file_token | 文件 token | +| name | 文件名称 | +| size | 文件大小 | +| tmp_url | 文件临时下载链接 | +| type | 文件类型 | +| url | 文件的下载 URL | + +**返回 body** + +``` +{ + "任务附件": [ + { + "file_token": "boxcnzm3dPEcutYDPplx5iDak4b", + "name": "Hawaii_1_15Retina_R.jpg", + "size": 5069121, + "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnzm3dPEcutYDPplx5iDak4b", + "type": "image/jpeg", + "url": "https://open.feishu.cn/open-apis/drive/v1/medias/boxcnzm3dPEcutYDPplx5iDak4b/download" + } +] +} +``` + +## 上传附件 + +在多维表格中上传附件分 2 步 + +1.调用[上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all)或[分片上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)接口上传文件,上传成功之后获取到文件的 file_token; + +2.调用[新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)或者[更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)将文件更新到记录中去; + +**请求 body 说明:** + +``` + { + "records": [ + { + "fields": { + "附件": [ + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} + ] + } + }, + { + "fields": { + "附件": [ + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} + ] + } + } + + ] + +} +``` + +**返回 body:** + +``` +{ + "code": 0, + "data": { + "records": [ + { + "fields": { + "附件": [ + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + }, + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + } + ] + }, + "id": "recxgOKlB0" + }, + + { + "fields": { + "附件": [ + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + }, + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + } + ] + }, + "id": "reciGVHpI8" + } + ] + }, + "msg": "Success" +} +``` + +## 下载附件 + +1.调用[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)查询出多维表格中附件的 file_token; + +**返回body** + +``` +{ + "code": 0, + "data": { + "record": { + "fields": { + "人力评估": "8", + "任务执行人": [ + { + "annotation_union_type": "person", + "email": "", + "en_name": "周北北", + "id": "ou_be7f7ff11f5107962c0493f59409508b", + "name": "周北北" + } + ], + "任务描述": "功能开发", + "任务附件": [ + { + "file_token": "boxcn8Ebe2Z68hXTsW8t1TuZCSd", + "name": "2.gif", + "size": 10250625, + "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcn8Ebe2Z68hXTsW8t1TuZCSd", + "type": "image/gif", + "url": "https://open.feishu.cn/open-apis/drive/v1/medias/boxcn8Ebe2Z68hXTsW8t1TuZCSd/download" + } + ], + "对应 OKR": [ + { + "text": "KR 2.2 推进新功能研发,KR 2.3 修补已知功能漏洞", + "type": "text" + } + ], + "截止日期": 1612108800000, + "未命名 1": null, + "状态": "开发中", + "相关部门": [ + "研发" + ] + }, + "id": "reczXt4wo5" + } + }, + "msg": "Success" +} +``` + +2.调用[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download) 下载或者[获取素材临时下载链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url),这2个接口已经支持多维表格。 + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/s.apifox.cn_apidoc_docs-site_532425_api-58954090.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/s.apifox.cn_apidoc_docs-site_532425_api-58954090.md new file mode 100644 index 0000000..46d86d0 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/bitable-md/s.apifox.cn_apidoc_docs-site_532425_api-58954090.md @@ -0,0 +1,352 @@ +# 复制仪表盘 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/dashboards/{block_id}/copy: + post: + summary: 复制仪表盘 + deprecated: false + description: >+ + 该接口用于根据现有仪表盘复制出新的仪表盘 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 400 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 400 | 1254004 | + WrongTableId | table_id + 错误 | + + | 400 | 1254005 | + WrongViewId | view_id + 错误 | + + | 400 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 400 | 1254007 | + EmptyValue | + 空值 | + + | 400 | 1254008 | + EmptyView | + 空视图 | + + | 400 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 400 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254016 | + InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | + InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | + InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | + ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | + EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | + InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | Invalid role name, make sure that it complies + with the specification. | + 自定义角色名无效 | + + | 400 | 1254033 | Duplicated role name, use another name + instead. | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254038 | Invalid name, make sure that it complies with + the specification. | 名称不规范,名称中不能包含 "[]",并且不能超过 100 个字符 | + + | 400 | 1254039 | Duplicated name, use another name + instead. | 名称与现有仪表盘名称重复,更换名称后重试 | + + | 404 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 404 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 404 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 404 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 404 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | Role id is not + found. | role_id + 不存在 | + + | 400 | 1254048 | + MemberNotFound | member + 不存在 | + + | 404 | 1254049 | Form field is not + found. | form_field_id + 不存在 | + + | 404 | 1254050 | Source block is not + found. | 传入了不存在的仪表盘 + block_id | + + | 400 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 400 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 400 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 400 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds + limit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | The role has no + permissions. | 无访问权限, 常由表格开启了高级权限造成, + 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1254607 | Data not ready, please try again + later. | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 400 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/仪表盘 + parameters: + - name: app_token + in: path + description: 多维表格 token + required: true + example: basbcldP5xZeskcHDFZQfeToydb + schema: + type: string + - name: block_id + in: path + description: 多维表格 block_id + required: true + example: blkEsvEEaNllY2UV + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + title: '' + description: "\t 仪表盘名称 示例值:\"Dashboard\"" + required: + - name + x-apifox-orders: + - name + example: + name: New Dashboard + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + block_id: + type: string + description: 多维表格 block_id + name: + type: string + description: block 名称 + required: + - block_id + - name + x-apifox-orders: + - block_id + - name + example: + block_id: blkXsf60PxMdJLQN + name: New Dashboard + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/仪表盘 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58954090-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-1940248.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-1940248.md new file mode 100644 index 0000000..1aa0d04 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-1940248.md @@ -0,0 +1,66 @@ +# 服务端 SDK + +飞书开放平台提供了一系列服务端的原子 API 来实现多元化的功能,但在实际编码过程中,需要考虑一些额外的工作,如访问凭证(access token)的获取与维护、数据加解密、请求验签等。此外,缺少函数调用的语义化描述、类型系统的支持,也会增加编码负担。 + +为解决以上问题,飞书开放平台提供了服务端 SDK,将所有冗长的逻辑内置处理,支持完备的类型系统,对外提供语义化的编程接口,以提高实际的编码体验。 + +SDK 提供的主要能力包括: + +- SDK 支持 **基于长连接的事件回调**,详情见[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case#d286cc88)、[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 + +- SDK 提供了 **结构化的 API 请求入参**。比如发消息 API,SDK 对各种类型的消息都提供了结构化封装。 + + + + ![img](../../assets/images/img_704483242d64efb2212090e79e605dfc683560e4.png) + + + +- SDK 提供了 **完整的应用访问凭证(tenant_access_token)生命周期管理能力**,无需开发者自己获取并刷新应用身份的访问凭证。 + + + + +:::info[] + SDK 仅支持托管应用身份的访问凭证(tenant_access_token),不支持托管用户身份的访问凭证(user_access_token),开发者需自行实现相关逻辑,参考 [获取 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/get-user-access-token) 、[刷新 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/refresh-user-access-token) 。 +::: + +- SDK 内 API 和事件上都添加了文字注释,以及跳转到使用 Demo 和官方文档的链接。 + + + + ![img](../../assets/images/img_9f24b8e8a20a267845c3bc352ad6c8a2bcbd3324.png) + + + +- SDK 提供了简洁易懂的帮助文档。参考 SDK 文档可帮助你了解如何安装 SDK、如何通过 SDK 调用服务端 API、处理订阅的事件及回调。 + + - [Java 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/preparations) + - [Python 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/preparations-before-development) + - [Go 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/preparations) + - [NodeJS 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/preparation-before-development) + - [SDK 常见问题](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/faq) + +## 源码地址 + +你可以进入 GitHub 项目空间查看源码详情。在使用 SDK 的过程中,如果遇到问题,可以给我们提交 Issue。 + +| **GitHub 项目** | **Issues** | **场景示例** | **语言** | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------- | +| [oapi-sdk-go](https://github.com/larksuite/oapi-sdk-go) | [Issues](https://github.com/larksuite/oapi-sdk-go/issues) | [oapi-sdk-go-demo](https://github.com/larksuite/oapi-sdk-go-demo) | Golang >= 1.5 | +| [oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python) | [Issues](https://github.com/larksuite/oapi-sdk-python/issues) | [oapi-sdk-python-demo](https://github.com/larksuite/oapi-sdk-python-demo) | Python >= 3.8 | +| [oapi-sdk-java](https://github.com/larksuite/oapi-sdk-java) | [Issues](https://github.com/larksuite/oapi-sdk-java/issues) | [oapi-sdk-java-demo](https://github.com/larksuite/oapi-sdk-java-demo) | Java >= 1.8 | +| [oapi-sdk-nodejs](https://github.com/larksuite/node-sdk) | [Issues](https://github.com/larksuite/node-sdk/issues) | - | NodeJS >= 10.0.0 | + +## SDK 问题交流群 + +| Java SDK 交流群 | Python SDK 交流群 | Go SDK 交流群 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=a53jb5f6-87de-4974-9ad6-8a88563d0e89)或扫码加入 SDK 交流群。 ![img](../../assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=575k28fa-2c12-400a-80c0-2d8924e00d38)或扫码加入 SDK 交流群。 ![img](../../assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=21cn476d-b859-4c15-9048-5ecf49f1a951)或扫码加入 SDK 交流群。 ![img](../../assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png) | + +NodeJS SDK 问题可直接提交[Issues](https://github.com/larksuite/node-sdk/issues)。 + +## 相关文档 + +- [服务端 API 列表](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/server-api-list) +- [事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list) diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518568.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518568.md new file mode 100644 index 0000000..967c6f8 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518568.md @@ -0,0 +1,33 @@ +# 开发前准备 + +使用 Go SDK 调用服务端 API、处理事件和回调前,请确保你已创建了一个应用、安装了 Go 环境和 Go SDK。本文档介绍使用 Go SDK 开发前的准备工作。 + + + + +:::info[] +对于新手开发者,建议你直接上手体验[开发自动回复机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)或[开发卡片交互机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-a-card-interactive-bot/introduction)教程,在教程示例代码中了解如何调用 API、处理事件和回调。 +::: + +## 创建应用 + +在使用服务端 SDK 之前,你需要确保已在[开发者后台](https://open.feishu.cn/app)创建了一个企业自建应用或商店应用。详情参考[创建企业自建应用](https://open.feishu.cn/document/home/introduction-to-custom-app-development/self-built-application-development-process#a0a7f6b0)或[创建商店应用](https://open.feishu.cn/document/uMzNwEjLzcDMx4yM3ATM/ucjN2YjL3YjN24yN2YjN/step1-create-a-store-application)。了解选择哪种应用,参考[应用类型](https://open.feishu.cn/document/home/app-types-introduction/overview#c3c7ad51)。 + +## 准备开发环境 + +要确保 Go SDK 运行,你需安装 Go 环境。下载地址见 [Go download and install](https://go.dev/doc/install)。 + +## 安装 Go SDK + +运行以下命令,安装 Go SDK。 + +``` +go get -u github.com/larksuite/oapi-sdk-go/v3@latest +``` + +## 后续操作 + +- [调用服务端 API](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis):介绍如何通过 SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。 +- [处理事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-events):介绍如何通过 SDK 封装的长连接方式处理事件、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理事件。 +- [处理回调](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-callback):介绍如何通过 SDK 封装的长连接方式处理回调、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理回调。 +- [场景示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/demo):提供基于 SDK 实现的各类场景的代码示例。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518569.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518569.md new file mode 100644 index 0000000..b0d44cb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518569.md @@ -0,0 +1,245 @@ +# 调用服务端 API + +本文档介绍如何通过 Go SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码,然后参考本文档了解调用 API 的全面流程。 + + + +![img](../../assets/images/img_77e8081c5e3e797636b2e4a32ecddb488801348f.png) + + + +## 步骤一:构建 API Client + +通过 SDK 调用飞书开放接口之前,你需要先在代码中创建一个 API Client。该 API Client 支持指定当前使用的应用信息、日志级别、HTTP 请求超时时间等基本信息。以下为支持的配置项及其具体含义。 + +``` +var client = lark.NewClient("appID", "appSecret", // 默认配置为自建应用 + // lark.WithMarketplaceApp(), // 可设置为商店应用 + lark.WithLogLevel(larkcore.LogLevelDebug), + lark.WithReqTimeout(3*time.Second), + lark.WithEnableTokenCache(true), + lark.WithHelpdeskCredential("id", "token"), + lark.WithHttpClient(http.DefaultClient)) +``` + +| 配置选项 | 配置方式 | 是否必填 | 描述 | +| ------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| app_id 和 app_secret | `lark.NewClient("appID", "appSecret")` | 是 | 应用凭证 App ID 和 App Secret。可在[开发者后台](https://open.feishu.cn/app) > 应用详情页 > **凭证与基础信息** > **应用凭证** 区域获取。![图片名称](../../assets/images/img_2ff482eb48a16372e75c62e539acb11c01c38ffb.png) | +| AppType | `lark.WithMarketplaceApp()` | 否 | 设置 App 类型为商店应用。如果你是 ISV 开发者,则必须设置该选项。关于商店应用的开发指南,可参见 [ISV(商店应用)开发指南](https://bytedance.feishu.cn/docx/DljadpCH3oMlnLxo1kpcS1vmnbg)。 | +| LogLevel | `lark.WithLogLevel(logLevel larkcore.LogLevel)` | 否 | 设置 API Client 的日志输出级别,枚举值如下:LogLevelDebugLogLevelInfo(默认值)LogLevelWarnLogLevelError | +| Logger | `lark.WithLogger(logger larkcore.Logger)` | 否 | 设置API Client 的日志器,默认日志输出到标准输出。你可通过实现下面的 Logger 接口,来设置自定义的日志器。`type Logger interface { Debug(context.Context, ...interface{}) Info(context.Context, ...interface{}) Warn(context.Context, ...interface{}) Error(context.Context, ...interface{})}` | +| LogReqAtDebug | `lark.WithLogReqAtDebug(printReqRespLog bool)` | 否 | 设置是否开启 HTTP 请求参数和响应参数的日志打印开关。开启后,在 debug 模式下会打印 HTTP 请求和响应的 headers、body 等信息。提示:在排查问题时开启该选项,有利于问题的排查。 | +| BaseUrl | `lark.WithOpenBaseUrl(baseUrl string)` | 否 | 设置飞书域名,默认为飞书域名 FeishuBaseUrl。可用域名如下:`// 飞书域名var FeishuBaseUrl = "https://open.feishu.cn"// Lark域名var LarkBaseUrl = "https://open.larksuite.com"` | +| TokenCache | `lark.WithTokenCache(cache larkcore.Cache)` | 否 | 设置 Token 缓存器,用于缓存 Token 和 appTIcket,默认实现为内存。如果你需要定制 Token 缓存器,则需实现如下 Cache 接口。`type Cache interface { Set(ctx context.Context, key string, value string, expireTime time.Duration) error Get(ctx context.Context, key string) (string, error)}`**注意**:对于商店应用的 ISV 开发者而言,如果需要 SDK 来缓存 appTicket,则需要实现该接口,以提供分布式缓存。 | +| EnableTokenCache | `lark.WithEnableTokenCache(enableTokenCache bool)` | 否 | 设置是否开启 TenantAccessToken ([应用访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM))的自动获取与缓存。默认开启,如需关闭可设置为 false。 | +| HelpDeskId、HelpDeskToken | `lark.WithHelpdeskCredential(helpdeskID, helpdeskToken string)` | 否 | 服务台的 ID 和 token。仅在调用服务台业务的 API 时需要配置。可在[服务台管理后台](https://feishu.cn/helpdesk/admin)**设置中心** > **API 凭证** 处获取,详情参见 [服务台接入指南](https://open.feishu.cn/document/ukTMukTMukTM/ugDOyYjL4gjM24CO4IjN)。**注意**:服务台的 ID、Token 只有服务台创建者可以查看到。![img](../../assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png) | +| ReqTimeout | `lark.WithReqTimeout(time time.Duration)` | 否 | 设置 SDK 内置的 Http Client 的请求超时时间。默认为 0 表示永不超时。 | +| HttpClient | `lark.WithHttpClient(httpClient larkcore.HttpClient)` | 否 | 设置 Http Client,用于替换 SDK 提供的默认实现。你可通过实现下面的 HttpClient 接口来设置自定义的 HttpClient。`type HttpClient interface { Do(*http.Request) (*http.Response, error)}` | + +示例配置: + +- 对于自建应用,使用以下代码创建 API Client。 + + ``` + var client = lark.NewClient("appID", "appSecret") // 默认配置为自建应用 + ``` + +- 对于商店应用,需在创建 API Client 时,使用 `lark.WithMarketplaceApp` 方法指定 AppType 为商店应用。了解更多可参考 [ISV(商店应用)开发指南](https://bytedance.feishu.cn/docx/DljadpCH3oMlnLxo1kpcS1vmnbg)。 + + ``` + var client = lark.NewClient("appID", "appSecret",lark.WithMarketplaceApp()) // 设置为商店应用 + ``` + +## 步骤二:构造 API 请求 + +在项目内创建 API Client 后,即可开始调用[飞书开放平台接口](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/server-api-list)。如下图示例,你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码。 + + + +![img](../../assets/images/img_5879690e78fa7a82b661c4606286ca1fc3804345.png) + + + +SDK 使用 **client.** **业务域.** **版本.** **资源** **.方法名称** 来定位具体的 API 方法。以[创建文档](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document/create)接口为例,HTTP URL 为 `https://open.feishu.cn/open-apis/docx/v1/documents`,其中 `docx` 为业务域,`v1` 为版本,`documents` 为资源,相应的创建方法为 `client.Docx.V1.Document.Create()`。 + + + +![img](../../assets/images/img_44427ad80f813abf93524b824cc2765b4ac33fc3.png) + + + +如下代码示例,你可通过 client 调用文档资源的 create 方法,创建一个文档。 + + + +该示例需要你在开发者后台为应用开通[创建及编辑新版文档]或[创建新版文档]权限,否则接口将报 99991672 错误码。 + +``` +package main +import ( // 导入接口所属的业务资源包 + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + client := lark.NewClient("appID", "appSecret") + // 发起创建文档的请求 + resp, err := client.Docx.Document.Create(context.Background(), larkdocx.NewCreateDocumentReqBuilder(). + Body(larkdocx.NewCreateDocumentReqBodyBuilder(). + FolderToken(""). // 文件夹 token,传空表示在根目录创建文档 + Title("title"). // 文档标题 + Build()). + Build()) + //处理错误 + if err != nil { + // 处理 err + return + } + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.LogId()) + return + } + // 业务数据处理 + fmt.Println(larkcore.Prettify(resp.Data)) +} +``` + +其他示例参考 GitHub 代码仓库中的[ im.go 示例](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/api/im/im.go)。 + +## (可选)步骤三:设置请求选项 + +在每次发起 API 调用时,你可以设置请求级别的相关参数,例如传递 userAccessToken(用户访问凭证)、自定义 headers 等。所有请求级别可设置的选项如下表所示。 + +| 配置选项 | 配置方式 | 描述 | +| ----------------------- | ---------------------------------------------------------- | ------------------------------------------------------------ | +| **`Header`** | `larkcore.WithHeaders(header http.Header)` | 设置自定义请求头。在发起请求时,这些请求头会被透传到飞书开放平台服务端。 | +| **`UserAccessToken`** | `larkcore.WithUserAccessToken(userAccessToken string)` | 设置用户 token,当你需要以用户身份发起 API 调用时,需要设置该选项的值。 | +| **`TenantAccessToken`** | `larkcore.WithTenantAccessToken(tenantAccessToken string)` | 设置企业或组织 token,当你自己维护企业或组织 token 时(即创建 client 时 EnableTokenCache 设置为 false),需通过该选项传递企业或组织 token。 | +| **`TenantKey`** | `larkcore.WithTenantKey(tenantKey string)` | 设置企业或组织 key,当你开发商店应用时,必须设置该选项。 | +| **`RequestId`** | `larkcore.WithRequestId(requestId string)` | 设置请求 ID,作为请求的唯一标识。该 ID 会被透传到飞书开放平台服务端。 | +| **`NeedHelpDeskAuth`** | `larkcore.WithNeedHelpDeskAuth()` | 设置添加服务台 helpdesk 的认证 header。 | + +设置自定义请求头的示例代码如下所示。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + client := lark.NewClient("appID", "appSecret") + // 设置自定义请求头 + header := make(http.Header) + header.Add("k1", "v1") + header.Add("k2", "v2") + // 发起请求 + resp, err := client.Docx.Document.Create(context.Background(), larkdocx.NewCreateDocumentReqBuilder(). + Body(larkdocx.NewCreateDocumentReqBodyBuilder(). + FolderToken("token"). + Title("title"). + Build(), + ). + Build(), + larkcore.WithHeaders(header), // 设置自定义 headers + ) + //处理错误 + if err != nil { + // 处理 err + return + } + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.LogId()) + return + } + // 业务数据处理 + fmt.Println(larkcore.Prettify(resp.Data)) +} +``` + +## 步骤四:运行代码 + +完成以上步骤后,即可运行代码调用创建文档 API。若请求成功,预计将返回以下数据。若失败,将返回错误码、错误信息和 Log ID,你可前往开发文档搜索解决方案。 + +``` +{ + Document: { + DocumentId: "IPI4dqnbfoPxL3xhAEhcjXabcef", + RevisionId: 1, + Title: "title" + } +} +``` + +## 常见问题 + +### 如何调用历史版本 API ? + +服务端 API 中存在部分历史版本或未全量开放的接口,由于没有元数据信息,所以不能使用 SDK 内封装好的方法快速调用,此时你可以使用 SDK 提供的原生模式调用 API。以[获取单个用户信息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/get)接口为例,调用示例如下所示: + +``` +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "net/http" + "os" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + var appID, appSecret = os.Getenv("APP_ID"), os.Getenv("APP_SECRET") + var cli = lark.NewClient(appID, appSecret) + // 发起 API 请求 + resp, err := cli.Do(context.Background(), + &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/contact/v3/users/:user_id", + Body: nil, + QueryParams: larkcore.QueryParams{"user_id_type": []string{"open_id"}}, + PathParams: larkcore.PathParams{"user_id": "ou_c245b0a7dff2725cfa2fb104f8b48b9d"}, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}, + }, + ) + // 错误处理 + if err != nil { + fmt.Println(err) + return + } + // 获取请求 ID + fmt.Println(resp.LogId()) + // 处理请求结果 + fmt.Println(resp.StatusCode) // http status code + fmt.Println(resp.Header) // http header + fmt.Println(string(resp.RawBody)) // http body,二进制数据 +} +``` + +了解更多 API 调用示例,参考 GitHub 代码仓库中的 [api.go 示例](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/callrawapi/api.go)。 + +### 如何快速获取接口对应的示例代码? + +飞书开放平台提供了 [API 调试台](https://open.feishu.cn/api-explorer),通过该平台可以快速调试服务端 API,快速获取资源 ID 及生成多语言示例代码的能力,为您节省开发成本。例如,通过 API 调试台调用 [发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create) 接口,在调试台成功完成测试后,可通过 **示例代码** 页面查阅 Go SDK 对应的接口调用代码。 + + + +![img](../../assets/images/img_f644398483f6b691846b875f810b87c5b8d30fa0.png) + + + +### 如何准确选择 API 方法? + +使用 API Client 调用 API 时,对应的方法建议你借助 [API 调试台](https://open.feishu.cn/api-explorer/)获取,可通过指定接口的地址栏参数拼接方法,也可以直接参考接口提供的示例代码。以[通过手机号或邮箱获取用户 ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/batch_get_id)接口为例,获取方式如下图所示。 + + + +![img](../../assets/images/img_46e78ff1d6f554ae8875726b56c2edece62541a4.png) diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518571.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518571.md new file mode 100644 index 0000000..fdc28d2 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518571.md @@ -0,0 +1,290 @@ +# 处理事件 + +通过事件订阅功能,应用可以及时接收飞书中资源数据的变化,并根据变化情况做对应的业务处理,详情参见[事件概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。在应用内订阅事件时,还需要在本地服务端建立与应用的连接,以便接收事件数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理事件;你也可以选择自建 HTTP 服务器处理事件。两种方式介绍如下: + +| 订阅方式 | 介绍 | +| ------------------------ | ------------------------------------------------------------ | +| 使用长连接接收事件 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的事件发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收事件回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续事件推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +| 将事件发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收事件消息的服务器公网地址。后续当应用订阅的事件发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含事件数据。 | + +## (推荐)方式一:使用长连接接收事件 + +如果事件订阅方式需要选择 **使用长连接接收事件**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的事件订阅方式中保存 **使用长连接接收事件** 方式。关于应用内配置事件订阅方式的介绍,参考[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case)。 + + + +![img](../../assets/images/img_4d673f008fffcce4428d24f1913905c4a7f83eba.png) + + + +### 注意事项 + +在开始配置之前,你需要确保已了解以下注意事项: + +- 目前长连接模式仅支持企业自建应用。 +- 与 **将事件发送至开发者服务器** 方式(即自建服务器方式)的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成,否则会触发超时重推机制。 +- 每个应用最多建立 50 个连接(在配置长连接时,每初始化一个 client 就是一个连接)。 +- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 + +### 长连接代码 + +``` +package main +import ( + "context" + "fmt" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkevent "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) +func main() { + // 注册事件回调,OnP2MessageReceiveV1 为接收消息 v2.0;OnCustomizedEvent 内的 message 为接收消息 v1.0。 + eventHandler := dispatcher.NewEventDispatcher("", ""). + OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + fmt.Printf("[ OnP2MessageReceiveV1 access ], data: %s\n", larkcore.Prettify(event)) + return nil + }). + OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { + fmt.Printf("[ OnCustomizedEvent access ], type: message, data: %s\n", string(event.Body)) + return nil + }) + // 创建Client + cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET", + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + // 启动客户端 + err := cli.Start(context.Background()) + if err != nil { + panic(err) + } +} +``` + +代码实现说明: + +1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),注意**两个参数必须填空字符串**。 + +2. 通过 eventHandler 的 OnXXXX() 方法处理不同的事件。上述示例中分别监听了「接收消息 v1.0」和「接收消息 v2.0」两个事件。 + + **说明**:开放平台提供的事件包括 v1.0 和 v2.0 两个版本。两个版本的结构不同。在处理事件时,可通过[事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list)文档或在开发者后台[添加事件](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/subscription-event-case)时,获取事件的类型与版本信息。 + + + + ![img](../../assets/images/img_b584f19e7218e5ce3163d549b65b0a351cdba1fe.png) + + + + 如果是 v1.0 事件,则注册服务器时需要查找并使用 OnCustomizedEvent 方法;如果是 v2.0 事件,则注册服务器时需要查找并使用 onP2xxxx 开头的方法。例如,使用 `onP2MessageReceiveV1` 注册接收消息事件回调时,`P2`便对应的是 v2.0 版本事件结构。 + + + + ![img](../../assets/images/img_004c6c488584e3637d9497b4bf76c93fddada9fe.png) + + + +3. 通过 larkws.NewClient() 初始化长连接客户端,必填参数为应用的 APP_ID 和 APP_SECRET,需登录[开发者后台](https://open.feishu.cn/app),在应用详情页的 **凭证与基础信息** > **应用凭证** 区域获取。 + + + + ![img](../../assets/images/img_ad16e0cdb84b697edbcabd3157ae60ed699379a3.png) + + + +4. 可选参数传入 eventHandler,同时可设置日志级别。 + +5. 通过 cli.Start() 启动客户端,如连接成功,控制台会打印 "connected to wss://xxxxx",主线程将阻塞,直到进程结束。 + + + + ![img](../../assets/images/img_ce63ed1c5a8fb02e95d691a01e57e59405865815.png) + + + +## 方式二:将事件发送至开发者服务器 + +如果事件订阅方式选择 **将事件发送至开发者服务器**,则需要设置事件请求地址,后续在事件发生时,开放平台会向该地址发送包含事件 JSON 数据的 HTTP POST 请求。为此你需启动一个 HTTP 服务器接收并处理事件。 + + + +![img](../../assets/images/img_679c4aceff414bfc299dbaeb850dd2313cdb3201.png) + + + +### 选择一:使用 Go SDK 原生 HTTP 服务器处理事件 + +订阅事件后,你可以使用下面代码,对飞书开放平台推送的事件进行处理。以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器: + +``` +package main +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) +func main() { + // 注册消息处理器 + // 用于签名验证和消息解密,默认可以传递为空串。但如果你在开发者后台 > 事件与回调 > 加密策略中开启了加密,则必须传递 Encrypt Key 和 Verification Token + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") + handler = handler.OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + // 处理消息 event,这里简单打印消息的内容 + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { + // 原生消息体 + fmt.Println(string(event.Body)) + fmt.Println(larkcore.Prettify(event.Header)) + fmt.Println(larkcore.Prettify(event.RequestURI)) + fmt.Println(event.RequestId()) + // 处理消息 + cipherEventJsonStr, err := handler.ParseReq(ctx, event) + if err != nil { + // 错误处理 + return err + } + plainEventJsonStr, err := handler.DecryptEvent(ctx, cipherEventJsonStr) + if err != nil { + // 错误处理 + return err + } + // 处理解密后的 消息体 + fmt.Println(plainEventJsonStr) + return nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +其中需要注意:EventDispatcher.newBuilder 方法的参数用于签名验证和消息解密,默认可以传递为空串。但如果你在[开发者后台](https://open.feishu.cn/app) > **事件与回调** > **加密策略**中开启了加密,则必须传递 Encrypt Key 和 Verification Token。 + + + +![img](../../assets/images/img_dfcf17b29763178f183ee726d9f93e227c13ebd6.png) + + + +了解更多事件订阅示例,参考 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/event/event.go)。 + +### 选择二:集成 Gin 框架处理事件 + +如果你当前应用使用的是 Gin Web 框架,并且不希望使用 Go SDK 的原生 HTTP 服务器,你可以参考以下集成步骤,将当前应用的 Gin 服务与 SDK 进行集成。 + +1. 安装集成包。 + + 把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 + + ``` + go get -u github.com/larksuite/oapi-sdk-gin + ``` + +2. 进行代码集成。集成示例如下: + + ``` + import ( + "context" + "fmt" + + "github.com/gin-gonic/gin" + "github.com/larksuite/oapi-sdk-gin" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" + ) + + func main() { + // 注册消息处理器 + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnP2MessageReadV1(func(ctx context.Context, event *larkim.P2MessageReadV1) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnP2UserCreatedV3(func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }) + + ... + + // 在已有 Gin 实例上注册消息处理路由 + gin.POST("/webhook/event", sdkginext.NewEventHandlerFunc(handler)) + } + ``` + +### 选择三:集成 hertz 框架处理事件 + +详情请参见[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 + +## (可选)在消息处理器内向对应用户发送消息 + +在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。 + + + +对于商店应用的 ISV 开发者,当需要在消息处理器内向对应企业或组织的用户发送消息时,需要先从事件回调数据中获取企业或组织 key,然后使用如下方式调用消息 API 进行消息发送。 + +``` +import ( + "context" + "fmt" + lark "github.com/larksuite/oapi-sdk-go/v3" + "net/http" + "os" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + var appID, appSecret = os.Getenv("APP_ID"), os.Getenv("APP_SECRET") + var cli = lark.NewClient(appID, appSecret, lark.WithLogReqAtDebug(true), lark.WithLogLevel(larkcore.LogLevelDebug)) + // 注册消息处理器 + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + // 处理消息 event,这里简单打印消息的内容 + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + // 获取企业或组织 key 并发送消息 + tenantKey := event.TenantKey() + // 商店应用给指定企业或组织的用户发送消息 + resp, err := cli.Im.Message.Create(context.Background(), larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(larkim.ReceiveIdTypeOpenId). + Body(larkim.NewCreateMessageReqBodyBuilder(). + MsgType(larkim.MsgTypePost). + ReceiveId("ou_c245b0a7dff2725cfa2fb104f8babcef"). + Content("text"). + Build()). + Build(), larkcore.WithTenantKey(tenantKey)) + // 发送结果处理,resp,err + fmt.Println(resp, err) + return nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518573.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518573.md new file mode 100644 index 0000000..6ddf891 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518573.md @@ -0,0 +1,384 @@ +# 处理回调 + +通过回调订阅功能,应用可以及时接收并处理飞书中特定的交互行为(例如,飞书卡片交互、链接预览等),并根据交互结果做对应的业务处理,详情参见[回调概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/callback-overview)。在应用内订阅回调时,还需要在本地服务端建立与应用的连接,以便接收回调数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理回调;你也可以选择自建 HTTP 服务器处理回调。两种方式介绍如下: + +| 订阅方式 | 介绍 | +| ------------------------ | ------------------------------------------------------------ | +| 使用长连接接收回调 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的回调发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续回调推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +| 将回调发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收回调消息的服务器公网地址。后续当应用订阅的回调发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含回调数据。 | + +## 注意事项 + +开放平台 SDK 仅支持对象类型的卡片回传参数,不支持字符串类型。 + + + +![img](../../assets/images/img_55990417f8118de94187eb5006484ad6b0c34e87.png) + + + +``` +{ + "behaviors": [ + { // 声明交互类型是卡片回传交互。 + "type": "callback", + "value": { + // 回传交互数据。开放平台 SDK 仅支持对象类型的卡片回传参数。 + "key": "value" + } + } + ] +} +``` + +## (推荐)方式一:使用长连接接收回调 + +如果回调订阅方式需要选择 **使用长连接接收回调**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的回调订阅方式中保存 **使用长连接接收回调** 方式。关于应用内配置回调订阅方式的介绍,参考[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 + + + +![img](../../assets/images/img_4c9cc48d695e73d892c9da4c2e566365b9937dc1.png) + + + +### 使用限制 + +- 长连接模式仅支持企业自建应用。 +- [消息卡片回传交互(旧)](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调不支持 **使用长连接接收回调** 订阅方式,只能选择 **将回调发送至开发者服务器** 订阅方式。 +- 每个应用最多建立 50 个连接(在配置长连接时,每初始化一个 client 就是一个连接)。 + +### 注意事项 + +- 与 **将回调发送至开发者服务器** 方式的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成。 +- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 + +### 长连接代码 + +``` +package main +import ( + "context" + "fmt" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) +func main() { + // 注册回调 + eventHandler := dispatcher.NewEventDispatcher("", ""). + // 监听「卡片回传交互 card.action.trigger」 + OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { + fmt.Printf("[ OnP2CardActionTrigger access ], data: %s\n", larkcore.Prettify(event)) + return nil, nil + }). + // 监听「拉取链接预览数据 url.preview.get」 + OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { + fmt.Printf("[ OnP2URLPreviewAction access ], data: %s\n", larkcore.Prettify(event)) + return nil, nil + }) + // 创建Client + cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET", + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + // 建立长连接 + err := cli.Start(context.Background()) + if err != nil { + panic(err) + } +} +``` + +代码实现说明: + +1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),**注意两个参数必须填空字符串**。 + +2. 通过 eventHandler 的 OnXXXX() 方法监听不同的回调类型,上述示例中监听了[卡片回传交互](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)和 [拉取链接预览数据](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/development-link-preview/pull-link-preview-data-callback-structure) 两个回调。 + +3. 通过 larkws.NewClient() 初始化长连接客户端,必填参数为应用的 APP_ID 和 APP_SECRET,可在[开发者后台](https://open.feishu.cn/app)的应用详情页内,进入 **基础信息 > 凭证与基础信息** 页面,获取应用的 APP_ID 和 APP_SECRET。 + + + + ![img](../../assets/images/img_3081ff12c2b38a28452241099b5188852ee1636a.png) + + + +4. 可选参数传入 eventHandler,同时可设置日志级别。 + +5. 通过 cli.Start() 启动客户端,如连接成功,控制台会打印 `connected to wss://xxxxx`,主线程将阻塞,直到进程结束。 + + + + ![img](../../assets/images/img_14898d1baed2eb032eb48a98ec19154f6a50cdd1.png) + + + +## 方式二:将回调发送至开发者服务器 + +如果回调订阅方式选择 **将回调发送至开发者服务器**,则需要设置回调请求网址,并订阅回调。例如,你配置了可交互的飞书卡片(原消息卡片),当用户在卡片内进行交互后,飞书服务器会向请求网址回调包含 JSON 数据的 HTTP POST 请求。因此,你需要启动一个 HTTP 服务器接收回调数据。 + + + +![img](../../assets/images/img_364d682b8f54707e57ef6316e20c3c982faf16cd.png) + + + +### 基于新版卡片回传交互处理 + +配置卡片回调地址并订阅新版[卡片回传交互回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)后,你可以使用下面代码,对飞书开放平台推送的卡片行为进行处理,以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。关于如何完整处理卡片回调,可参考[处理卡片回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/handle-card-callbacks)。 + + + +![img](../../assets/images/img_dec71c02ec7fca171c02f759e29e67365e8d3e75.png) + + + +``` +package main +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" +) +func main() { + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") + handler.OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { + fmt.Println("receive card action") + fmt.Println(larkcore.Prettify(event)) + return nil, nil + }).OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { + fmt.Println(event) + return nil, nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, + larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动服务 + err := http.ListenAndServe(":7777", nil) + if err != nil { + panic(err) + } +} +``` + +### 基于旧版卡片回传交互处理 + +配置卡片回调地址并订阅旧版[消息卡片回传交互](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调后,你可选择以下方式对旧版卡片回调进行处理。 + + + +![img](../../assets/images/img_beba130b4d3356c65c5d3c8794963c7687b86acd.png) + + + +- **选择一**:使用 Go SDK 原生 HTTP 服务器处理回调 + + 以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。 + + ``` + import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + ) + func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("verificationToken", "eventEncryptKey", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + // 处理卡片行为, 这里简单打印卡片内容 + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + // 无返回值示例 + return nil, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } + } + ``` + + 如上代码中,如果不需要处理器内返回业务结果至飞书服务端,则直接使用示例中的无返回值用法。如需了解其他卡片回调示例,参见 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/card/card.go)。 + +- **选择二**:集成 Gin 框架处理回调: + + 如果你当前使用的是 Gin Web 框架,并且不希望使用 Go SDK 提供的 原生 Http Server,则可以使用以下方式,把当前应用的 Gin 服务与 SDK 进行集成。 + + 1. 安装集成包。把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 + + ``` + go get -u github.com/larksuite/oapi-sdk-gin + ``` + + 2. 进行代码集成。集成示例如下: + + ``` + import ( + "context" + "fmt" + + "github.com/gin-gonic/gin" + "github.com/larksuite/oapi-sdk-gin" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + ) + + + func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + return nil, nil + }) + ... + // 在已有的 Gin 实例上注册卡片处理路由 + gin.POST("/webhook/card", sdkginext.NewCardActionHandlerFunc(cardHandler)) + ... + } + ``` + +- **选择三**:集成 hertz 框架处理回调:详情参考[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 + +## (可选)返回卡片消息 + +如果你需要在卡片处理器内同步返回用于更新卡片的消息体,则可以使用以下方式进行处理。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 创建卡片信息 + messageCard := larkcard.NewMessageCard(). + Config(config). + Header(header). + Elements([]larkcard.MessageCardElement{divElement, processPersonElement}). + CardLink(cardLink). + Build() + return messageCard, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +## (可选)返回自定义消息 + +如果你需要在卡片处理器内返回自定义的内容,则可以使用以下方式进行处理。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 创建 http body + body := make(map[string]interface{}) + body["content"] = "hello" + i18n := make(map[string]string) + i18n["zh_cn"] = "你好" + i18n["en_us"] = "hello" + i18n["ja_jp"] = "こんにちは" + body["i18n"] = i18n + + // 创建自定义消息:http状态码,body内容 + resp := &larkcard.CustomResp{ + StatusCode: 400, + Body: body, + } + return resp, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +## (可选)在卡片行为处理器内向对应用户发送消息 + +在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。如果你是商店应用的开发者,当需要在卡片处理器内向指定企业或组织的用户发送消息时,需要先从消息卡片中获取企业或组织 key,然后使用以下方式调用消息 API 进行消息发送。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + + // 处理卡片行为, 这里简单打印卡片内容 + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 获取企业或组织 key 并发送消息 + tenanKey := cardAction.TenantKey + + // ISV 给指定企业或组织中的用户发送消息 + resp, err := client.Im.Message.Create(context.Background(), larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(larkim.ReceiveIdTypeOpenId). + Body(larkim.NewCreateMessageReqBodyBuilder(). + MsgType(larkim.MsgTypePost). + ReceiveId("ou_c245b0a7dff2725cfa2fb104f8b48b9d"). + Content("text"). + Build(), larkcore.WithTenantKey(tenanKey)). + Build()) + + // 发送结果处理,resp,err + + return nil, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518577.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518577.md new file mode 100644 index 0000000..f73b2f4 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518577.md @@ -0,0 +1,556 @@ +# 场景示例 + +飞书开放平台基于 SDK,封装了常用的 API 组合调用及业务场景示例供你参考。在 [oapi-sdk-go-demo](https://github.com/larksuite/oapi-sdk-go-demo) 中包含了以下多种场景示例代码。 + +## [发送文件消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_file.go) + +发送文件消息,使用到两个OpenAPI:[上传文件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 + +``` +package im + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) + +type SendFileRequest struct { + FileType string + FileName string + File io.Reader + Duration int + ReceiveIdType string + ReceiveId string + Uuid string +} + +type SendFileResponse struct { + *larkcore.CodeError + CreateFileResponse *larkim.CreateFileRespData + CreateMessageResponse *larkim.CreateMessageRespData +} + +// SendFile 发送文件消息 +func SendFile(client *lark.Client, request *SendFileRequest) (*SendFileResponse, error) { + // 上传文件 + createFileReq := larkim.NewCreateFileReqBuilder(). + Body(larkim.NewCreateFileReqBodyBuilder(). + FileType(request.FileType). + FileName(request.FileName). + Duration(request.Duration). + File(request.File). + Build()). + Build() + createFileResp, err := client.Im.File.Create(context.Background(), createFileReq) + if err != nil { + return nil, err + } + if !createFileResp.Success() { + fmt.Printf("client.Im.File.Create failed, code: %d, msg: %s, log_id: %s\n", + createFileResp.Code, createFileResp.Msg, createFileResp.RequestId()) + return nil, createFileResp.CodeError + } + + // 发送消息 + bs, err := json.Marshal(createFileResp.Data) + if err != nil { + return nil, err + } + createMessageReq := larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(request.ReceiveIdType). + Body(larkim.NewCreateMessageReqBodyBuilder(). + ReceiveId(request.ReceiveId). + MsgType("file"). + Content(string(bs)). + Uuid(request.Uuid). + Build()). + Build() + + createMessageResp, err := client.Im.Message.Create(context.Background(), createMessageReq) + if err != nil { + return nil, err + } + if !createMessageResp.Success() { + fmt.Printf("client.Im.Message.Create failed, code: %d, msg: %s, log_id: %s\n", + createMessageResp.Code, createMessageResp.Msg, createMessageResp.RequestId()) + return nil, createMessageResp.CodeError + } + + // 返回结果 + return &SendFileResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateFileResponse: createFileResp.Data, + CreateMessageResponse: createMessageResp.Data, + }, nil +} +``` + +## [发送图片消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_image.go) + +发送图片消息,使用到两个OpenAPI:[上传图片](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 + +``` +package im + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) + +type SendImageRequest struct { + Image io.Reader + ReceiveIdType string + ReceiveId string + Uuid string +} + +type SendImageResponse struct { + *larkcore.CodeError + CreateImageResponse *larkim.CreateImageRespData + CreateMessageResponse *larkim.CreateMessageRespData +} + +// SendImage 发送图片消息 +func SendImage(client *lark.Client, request *SendImageRequest) (*SendImageResponse, error) { + // 上传图片 + createImageReq := larkim.NewCreateImageReqBuilder(). + Body(larkim.NewCreateImageReqBodyBuilder(). + ImageType("message"). + Image(request.Image). + Build()). + Build() + createImageResp, err := client.Im.Image.Create(context.Background(), createImageReq) + if err != nil { + return nil, err + } + if !createImageResp.Success() { + fmt.Printf("client.Im.Image.Create failed, code: %d, msg: %s, log_id: %s\n", + createImageResp.Code, createImageResp.Msg, createImageResp.RequestId()) + return nil, createImageResp.CodeError + } + + // 发送消息 + bs, err := json.Marshal(createImageResp.Data) + if err != nil { + return nil, err + } + createMessageReq := larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(request.ReceiveIdType). + Body(larkim.NewCreateMessageReqBodyBuilder(). + ReceiveId(request.ReceiveId). + MsgType("image"). + Content(string(bs)). + Uuid(request.Uuid). + Build()). + Build() + + createMessageResp, err := client.Im.Message.Create(context.Background(), createMessageReq) + if err != nil { + return nil, err + } + if !createMessageResp.Success() { + fmt.Printf("client.Im.Message.Create failed, code: %d, msg: %s, log_id: %s\n", + createMessageResp.Code, createMessageResp.Msg, createMessageResp.RequestId()) + return nil, createMessageResp.CodeError + } + + // 返回结果 + return &SendImageResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateImageResponse: createImageResp.Data, + CreateMessageResponse: createMessageResp.Data, + }, nil +} +``` + +## [获取部门下所有用户列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/contact/list_user_by_department.go) + +获取部门下所有用户列表,使用到两个OpenAPI:[获取子部门列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/children)和[获取部门直属用户列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/find_by_department)。 + +``` +package contact + +import ( + "context" + "fmt" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkcontact "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" +) + +type ListUserByDepartmentRequest struct { + DepartmentId string +} + +type ListUserByDepartmentResponse struct { + *larkcore.CodeError + ChildrenDepartmentResponse *larkcontact.ChildrenDepartmentRespData + FindByDepartmentUserResponse []*larkcontact.User +} + +// ListUserByDepartment 获取部门下所有用户列表 +func ListUserByDepartment(client *lark.Client, request *ListUserByDepartmentRequest) (*ListUserByDepartmentResponse, error) { + // 获取子部门列表 + childrenDepartmentReq := larkcontact.NewChildrenDepartmentReqBuilder(). + DepartmentIdType("open_department_id"). + DepartmentId(request.DepartmentId). + Build() + + childrenDepartmentResp, err := client.Contact.Department.Children(context.Background(), childrenDepartmentReq) + + if err != nil { + return nil, err + } + if !childrenDepartmentResp.Success() { + fmt.Printf("client.Contact.Department.Children failed, code: %d, msg: %s, log_id: %s\n", + childrenDepartmentResp.Code, childrenDepartmentResp.Msg, childrenDepartmentResp.RequestId()) + return nil, childrenDepartmentResp.CodeError + } + + // 获取部门直属用户列表 + users := make([]*larkcontact.User, 0) + openDepartmentIds := []string{request.DepartmentId} + for _, item := range childrenDepartmentResp.Data.Items { + openDepartmentIds = append(openDepartmentIds, *item.OpenDepartmentId) + } + + for _, id := range openDepartmentIds { + findByDepartmentUserReq := larkcontact.NewFindByDepartmentUserReqBuilder(). + DepartmentId(id). + Build() + + findByDepartmentUserResp, err := client.Contact.User.FindByDepartment(context.Background(), findByDepartmentUserReq) + + if err != nil { + return nil, err + } + if !findByDepartmentUserResp.Success() { + fmt.Printf("client.Contact.User.FindByDepartment failed, code: %d, msg: %s, log_id: %s\n", + findByDepartmentUserResp.Code, findByDepartmentUserResp.Msg, findByDepartmentUserResp.RequestId()) + return nil, findByDepartmentUserResp.CodeError + } + + users = append(users, findByDepartmentUserResp.Data.Items...) + } + + // 返回结果 + return &ListUserByDepartmentResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ChildrenDepartmentResponse: childrenDepartmentResp.Data, + FindByDepartmentUserResponse: users, + }, nil +} +``` + +## [创建多维表格同时添加数据表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/base/create_app_and_tables.go) + +创建多维表格同时添加数据表,使用到两个 OpenAPI:[创建多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/create)和[新增一个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create): + +``` +package base + +import ( + "context" + "fmt" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkbitable "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +type CreateAppAndTablesRequest struct { + Name string + FolderToken string + Tables []*larkbitable.ReqTable +} + +type CreateAppAndTablesResponse struct { + *larkcore.CodeError + CreateAppResponse *larkbitable.CreateAppRespData + CreateAppTablesResponse []*larkbitable.CreateAppTableRespData +} + +// CreateAppAndTables 创建多维表格同时添加数据表 +func CreateAppAndTables(client *lark.Client, request *CreateAppAndTablesRequest) (*CreateAppAndTablesResponse, error) { + // 创建多维表格 + createAppReq := larkbitable.NewCreateAppReqBuilder(). + ReqApp(larkbitable.NewReqAppBuilder(). + Name(request.Name). + FolderToken(request.FolderToken). + Build()). + Build() + + createAppResp, err := client.Bitable.App.Create(context.Background(), createAppReq) + if err != nil { + return nil, err + } + if !createAppResp.Success() { + fmt.Printf("client.Bitable.App.Create failed, code: %d, msg: %s, log_id: %s\n", + createAppResp.Code, createAppResp.Msg, createAppResp.RequestId()) + return nil, createAppResp.CodeError + } + + // 添加数据表 + tables := make([]*larkbitable.CreateAppTableRespData, 0) + for _, table := range request.Tables { + req := larkbitable.NewCreateAppTableReqBuilder(). + AppToken(*createAppResp.Data.App.AppToken). + Body(larkbitable.NewCreateAppTableReqBodyBuilder(). + Table(table). + Build()). + Build() + + createAppTableResp, err := client.Bitable.AppTable.Create(context.Background(), req) + if err != nil { + return nil, err + } + if !createAppTableResp.Success() { + fmt.Printf("client.Bitable.AppTable.Create failed, code: %d, msg: %s, log_id: %s\n", + createAppTableResp.Code, createAppTableResp.Msg, createAppTableResp.RequestId()) + return nil, createAppTableResp.CodeError + } + + tables = append(tables, createAppTableResp.Data) + } + + // 返回结果 + return &CreateAppAndTablesResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateAppResponse: createAppResp.Data, + CreateAppTablesResponse: tables, + }, nil +} +``` + +## [复制粘贴某个范围的单元格数据](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/copy_and_paste_by_range.go) + +复制粘贴某个范围的单元格数据,使用到两个OpenAPI:[读取单个范围](https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN)和[向单个范围写入数据](https://open.feishu.cn/document/ukTMukTMukTM/uAjMzUjLwIzM14CMyMTN)。 + +``` +package sheets + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" +) + +type CopyAndPasteByRangeRequest struct { + SpreadsheetToken string + SrcRange string + DstRange string +} + +type CopyAndPasteRangeResponse struct { + *larkcore.CodeError + ReadResponse *SpreadsheetRespData + WriteResponse *SpreadsheetRespData +} + +// CopyAndPasteRange 复制粘贴某个范围的单元格数据 +func CopyAndPasteRange(client *lark.Client, request *CopyAndPasteByRangeRequest) (*CopyAndPasteRangeResponse, error) { + // 读取单个范围 + readResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values/%s", request.SpreadsheetToken, request.SrcRange), + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + readSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(readResp.RawBody, readSpreadsheetResp) + if err != nil { + return nil, err + } + readSpreadsheetResp.ApiResp = readResp + if readSpreadsheetResp.Code != 0 { + fmt.Printf("read spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + readSpreadsheetResp.Code, readSpreadsheetResp.Msg, readSpreadsheetResp.RequestId()) + return nil, readSpreadsheetResp.CodeError + } + + // 向单个范围写入数据 + valueRange := map[string]interface{}{} + valueRange["range"] = request.DstRange + valueRange["values"] = readSpreadsheetResp.Data.ValueRange.Values + body := map[string]interface{}{} + body["valueRange"] = valueRange + + writeResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodPut, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values", request.SpreadsheetToken), + Body: body, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + writeSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(writeResp.RawBody, writeSpreadsheetResp) + if err != nil { + return nil, err + } + writeSpreadsheetResp.ApiResp = writeResp + if writeSpreadsheetResp.Code != 0 { + fmt.Printf("write spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + writeSpreadsheetResp.Code, writeSpreadsheetResp.Msg, writeSpreadsheetResp.RequestId()) + return nil, writeSpreadsheetResp.CodeError + } + + // 返回结果 + return &CopyAndPasteRangeResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + WriteResponse: writeSpreadsheetResp.Data, + }, nil +} +``` + +## [下载指定范围单元格的所有素材列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/download_media_by_range.go) + +下载指定范围单元格的所有素材列表,使用到两个OpenAPI:[读取单个范围](https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN)和[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download): + +``` +package sheets + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1" +) + +type DownloadMediaByRangeRequest struct { + SpreadsheetToken string + Range string +} + +type DownloadMediaByRangeResponse struct { + *larkcore.CodeError + ReadResponse *SpreadsheetRespData + DownloadMediaResponse []*larkdrive.DownloadMediaResp +} + +func DownloadMediaByRange(client *lark.Client, request *DownloadMediaByRangeRequest) (*DownloadMediaByRangeResponse, error) { + // 读取单个范围 + readResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values/%s", request.SpreadsheetToken, request.Range), + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + readSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(readResp.RawBody, readSpreadsheetResp) + if err != nil { + return nil, err + } + readSpreadsheetResp.ApiResp = readResp + if readSpreadsheetResp.Code != 0 { + fmt.Printf("read spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + readSpreadsheetResp.Code, readSpreadsheetResp.Msg, readSpreadsheetResp.RequestId()) + return nil, readSpreadsheetResp.CodeError + } + + // 下载文件 + files := make([]*larkdrive.DownloadMediaResp, 0) + values := readSpreadsheetResp.Data.ValueRange.Values + tokens := parseFileToken(values, make(map[string]bool)) + for _, token := range tokens { + downloadMediaReq := larkdrive.NewDownloadMediaReqBuilder(). + FileToken(token). + Build() + + downloadMediaResp, err := client.Drive.Media.Download(context.Background(), downloadMediaReq) + if err != nil { + return nil, err + } + if !downloadMediaResp.Success() { + fmt.Printf("client.Drive.Media.Download failed, code: %d, msg: %s, log_id: %s\n", + downloadMediaResp.Code, downloadMediaResp.Msg, downloadMediaResp.RequestId()) + return nil, downloadMediaResp.CodeError + } + + files = append(files, downloadMediaResp) + } + + // 返回结果 + return &DownloadMediaByRangeResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + DownloadMediaResponse: files, + }, nil +} + +func parseFileToken(values []interface{}, tokens map[string]bool) []string { + if len(values) == 0 { + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res + } + for _, i := range values { + kind := reflect.TypeOf(i).Kind() + if kind == reflect.Slice { + parseFileToken(i.([]interface{}), tokens) + } else if kind == reflect.Map { + m := i.(map[string]interface{}) + if val, ok := m["fileToken"]; ok { + tokens[val.(string)] = true + } + } + } + + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res +} +``` diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518657.md b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518657.md new file mode 100644 index 0000000..fe139e1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518657.md @@ -0,0 +1,109 @@ +# 常见问题 + +本文档汇集使用服务端 SDK 可能出现的常见问题与解决方案。 + +### API 调试台内获取 tenant_access_token/app_access_token 的示例代码,为什么提示找不到方法? + +服务端 SDK 内已经封装了获取和缓存 tenant_access_token/app_access_token 的逻辑,在构建 API Client 时传入应用的 App ID 和 App Secret 即可,不需要手动获取 Token。 + +### API 调试台内成功调用 API 后,使用示例代码调用失败是什么原因? + +API 调试台中的示例代码是根据调试台内设置的参数自动生成的,如果存在代码问题,请先在调试台内配置好参数再使用代码,同时注意应用的 App ID 和 App Secret 需要手动配置。 + + + +![img](../../assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png) + + + +应用的 App ID 和 App Secret 需登录[开发者后台](https://open.feishu.cn/app),在应用详情页的 **凭证与基础信息** > **应用凭证** 区域获取。 + + + +![img](../../assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png) + + + +### 如何查看某个接口在 SDK 是否支持? + +你可以直接查询接口文档,例如[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create),有如下图所示的 **尝试一下** 按钮表示支持(不支持的 API 没有该按钮)。 + + + +![img](../../assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png) + + + +点击按钮后可以调试 API、查阅示例代码。 + + + +![img](../../assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png) + + + +### SDK 不支持直接调用的接口、历史版本的接口,如何才能调用? + +不同语言的 SDK 均提供了原生 API 调用方式,使用该方式可以通过传入 API 的 HTTP Method、URL 以及参数来调用。具体操作参见各 SDK 使用指南。 + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 使用下载导出文件接口时,文件名包含特殊字符导致下载报错如何解决? + +系统逻辑存在特殊字符校验,你可以先使用 SDK 提供的原生模式调用 API。详情参考: + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 如何配置私有部署的飞书服务器或者代理服务器连接? + +Java 示例代码以及配置说明,参考以下代码注释。 + +``` +import com.lark.oapi.Client; +import com.lark.oapi.core.cache.LocalCache; +import com.lark.oapi.core.enums.BaseUrlEnum; +import com.lark.oapi.core.httpclient.OkHttpTransport; +import com.lark.oapi.core.response.RawResponse; +import com.lark.oapi.core.token.AccessTokenType; +import com.lark.oapi.okhttp.OkHttpClient; +import java.net.Proxy; +import java.util.concurrent.TimeUnit; +@Test +void init() { + Proxy proxy = Proxy.NO_PROXY; // 自定义代理服务器 + Client client = Client.newBuilder("appId", "appSecret") + .openBaseUrl(BaseUrlEnum.FeiShu) // 设置域名,默认为飞书,支持重载String,设置私有部署飞书服务器 + .httpTransport(new OkHttpTransport( + new OkHttpClient().newBuilder() + .readTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .callTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .proxy(proxy) // 设置使用代理服务器访问飞书服务器 + .build() + )) + .tokenCache(LocalCache.getInstance()) // 默认实现,本地带时间过期的缓存;可以自己实现ICache的接口,例如Redis缓存等 + .logReqAtDebug(true) // 在 debug 模式下会打印 http 请求和响应的 headers,body 等信息。 + .build(); +} +``` + +### 调用接口失败,有 code 和 logid 该如何排查? + +- 方式一:打开[飞书开发文档](https://open.larkoffice.com/document/home/index),在搜索栏输入错误码(code)或者日志 ID(logid)查询。 + + + + ![img](../../assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png) + + + +- 方式二:如果问题始终无法解决,请咨询[技术支持](https://applink.feishu.cn/TLJpeNdW)。 + +### 接收事件时为什么重复收到事件体数据? + +开放平台推送事件数据后,你的服务器需要在 3 秒内以 HTTP 200 状态码进行响应,否则开放平台认为本次推送失败,并会重新推送事件数据。详情参见[事件推送周期和频次](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM#9cd4c9b1)。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/tmp/doc-436424-export.html b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/tmp/doc-436424-export.html new file mode 100644 index 0000000..b5287c7 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/offline-docs-v2/tmp/doc-436424-export.html @@ -0,0 +1,34 @@ +概述 - 飞书 API
diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/meta.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/meta.txt new file mode 100644 index 0000000..1657b6b --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/meta.txt @@ -0,0 +1,3 @@ +LINES=18211 +MID_START=8986 +END_START=17971 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-api.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-api.txt new file mode 100644 index 0000000..5a2a572 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-api.txt @@ -0,0 +1,180 @@ +14: bitable-md/ # 多维表格文档与全部 API 子页原文(49页) +23:## 3. Golang SDK 调用说明(基于 API 参考文档整理) +72:### 3.4 历史/未封装 API 的原生调用 +94:1. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/apiall/bitablev1/`(Bitable v1 全量 API 样例) +125:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +144:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +166:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +186:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +211:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +232:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +253:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +290:> *通过 API 在飞书表格(Sheets)中新建数据表暂时无法在页面看到,后续会支持; +294:目前开放多维表格在App、数据表、视图、字段、记录、高级权限设置和高级权限协作者 7 种内容的 API 。 +309:> 同一时刻,对同一篇多维表格最好只请求一次 API 写操作。 +325:- 多维表格大部分接口都支持通过 +339: 两种身份进行调用。但仍然有部分接口只支持其中一种身份,请开发者在调用前,仔细阅读对应接口的说明文档。 +379:- 每个接口都有接口调用的频率限制,可参考[频控策略](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)。 +380:- 对于接口的批量操作,单次最高 500 条记录,且响应状态是全部成功或者失败,不存在部分结果。 +382:### 接口报错 +384:当请求不符合某些特定条件时会报错,如果因为部分参数不符合要求而导致报错,意味着当次请求所有的内容提交都失败了,不会对线上的数据造成影响。具体可参考:[服务端错误码说明](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN) +388:| 接口类型 | 支持 | 不支持 | +397:**API 地址**:https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +447:- 对于其它场景的多维表格,需要通过[列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)接口获取; +452:- 或者通过[列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)接口获取。暂时无法获取到 Bitable doc block 中表格的 view_id; +456:- 需要通过[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)接口获取; +460:- 需要通过[列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)接口获取; +464:- 需要通过[列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)接口获取; +468:- 需要通过[列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)接口获取; +1410:1.调用[上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all)或[分片上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)接口上传文件,上传成功之后获取到文件的 file_token; +1534:2.调用[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download) 下载或者[获取素材临时下载链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url),这2个接口已经支持多维表格。 +1547:多维表格的 **所有者 或者 有可管理权限** 的用户可通过 API 设置高级权限,管理高级权限的协作者,针对每个数据表设置谁可以查看、编辑指定的行,或是指定可以编辑的列。使用前请阅读[使用多维表格高级权限](https://www.feishu.cn/hc/zh-CN/articles/588604550568)。 +1549:高级权限接口分为 **自定义角色** 和 **协作者** 两部分。 +1553:调用高级权限的接口前,请先确保多维表格已开启高级权限。可以通过[更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)开启高级权限。 +1558:- 开启高级权限有延迟,开启高级权限后立即调用高级权限的接口时遇到 `OperationTypeError` 的报错请重试。 +1559:- 高级权限的协作者与云文档权限协作者为不同权限身份,添加高级权限协作者之后,为保证文档权限设置正常,建议再通过 [增加协作者权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) 接口新增文档权限。 +1573:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +1584:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +1616:| 字段权限要求 | 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请获取用户 user ID仅自建应用 | +1938:## OpenAPI Specification +1954: 该接口支持调用频率上限为 20 QPS +1957: ### 错误码 +1960: | HTTP状态码 | 错误码 | 描述 | +2067: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2102: responses: +2112: description: 错误码,非 0 表示失败 +2212:## OpenAPI Specification +2231: 此接口非原子操作,先修改多维表格名字,后开关高级权限。可能存在部分成功的情况 +2233: 该接口支持调用频率上限为 10 QPS +2239: ### 错误码 +2242: | HTTP状态码 | 错误码 | 描述 | +2275: | 200 | 1254200 | internal error | +2283: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2315: requestBody: +2333: responses: +2343: description: 错误码,非 0 表示失败 +2437:## OpenAPI Specification +2451: 该接口用于更新数据表的基本信息,包括数据表的名称等。 +2454: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) +2458: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) +2461: ### 错误码 +2464: | HTTP状态码 | 错误码 | 描述 | +2520: requestBody: +2530: 如果名称为空或和旧名称相同,接口仍然会返回成功,但是名称不会被更改。 示例值:"数据表的新名称" 数据校验规则: +2536: responses: +2546: description: 错误码,非 0 表示失败 +2619:## OpenAPI Specification +2635: 该接口支持调用频率上限为 20 QPS +2637: 关于云文档接口的 AccessToken 调用说明详见 [云文档接口快速入门] +2643: ### 错误码 +2646: | HTTP状态码 | 错误码 | 描述 | +2753: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2804: responses: +2814: description: 错误码,非 0 表示失败 +2914:## OpenAPI Specification +2930: 该接口支持调用频率上限为 10 QPS +2933: 关于云文档接口的 AccessToken 调用说明详见 +2934: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +2937: ### 错误码 +2940: | HTTP状态码 | 错误码 | 描述 | +3050: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3101: requestBody: +3125: responses: +3135: description: 错误码,非 0 表示失败 +3203:## OpenAPI Specification +3219: 该接口支持调用频率上限为 10 QPS +3222: 关于云文档接口的 AccessToken 调用说明详见 +3223: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +3226: ### 错误码 +3229: | HTTP状态码 | 错误码 | 描述 | +3339: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3390: requestBody: +3410: responses: +3420: description: 错误码,非 0 表示失败 +3497:## OpenAPI Specification +3513: 关于云文档接口的 AccessToken 调用说明详见 +3514: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +3517: ### 错误码 +3520: | HTTP状态码 | 错误码 | 描述 | +3630: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3654: 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +3675: responses: +3685: description: 错误码,非 0 表示失败 +3752:## OpenAPI Specification +3769: 该接口支持调用频率上限为 10 QPS +3773: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) +3776: ### 错误码 +3779: | HTTP状态码 | 错误码 | 描述 | +3889: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3913: 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +3927: requestBody: +3943: responses: +3953: description: 错误码,非 0 表示失败 +4020:## OpenAPI Specification +4034: 该接口用于根据现有仪表盘复制出新的仪表盘 +4037: ### 错误码 +4040: | HTTP状态码 | 错误码 | +4240: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4252: 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +4295: requestBody: +4311: responses: +4380:## OpenAPI Specification +4397: 该接口支持调用频率上限为 20 QPS +4400: ### 错误码 +4403: | HTTP状态码 | 错误码 | 描述 | +4543: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4595: responses: +4605: description: 错误码,非 0 表示失败 +4706:## OpenAPI Specification +4720: 该接口用于增量修改视图信息 +4723: ### 错误码 +4726: | HTTP状态码 | 错误码 | 描述 | +4869: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4896: | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +4922: requestBody: +4988: responses: +4998: description: 错误码,非 0 表示失败 +5166:## OpenAPI Specification +5180: 该接口根据 view_id 检索现有视图 +5183: ### 错误码 +5186: | HTTP状态码 | 错误码 | 描述 | +5329: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +5356: | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +5382: responses: +5392: description: 错误码,非 0 表示失败 +5557:## OpenAPI Specification +5573: 该接口支持调用频率上限为 20 QPS +5575: 关于云文档接口的 AccessToken 调用说明详见 +5576: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +5579: ### 错误码 +5582: | HTTP状态码 | 错误码 | 描述 | +5710: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +5734: 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +5771: responses: +5781: description: 错误码,非 0 表示失败 +5881:## OpenAPI Specification +5897: 该接口支持调用频率上限为 10 QPS +5899: 关于云文档接口的 AccessToken 调用说明详见 +5900: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +5903: ### 错误码 +5906: | HTTP状态码 | 错误码 | 描述 | +6034: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +6058: 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +6079: requestBody: +6099: responses: +6109: description: 错误码,非 0 表示失败 +6223:## OpenAPI Specification +6239: 该接口支持调用频率上限为 10 QPS +6241: 关于云文档接口的 AccessToken 调用说明详见 +6242: [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) +6245: ### 错误码 +6248: | HTTP状态码 | 错误码 | 描述 | +6379: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +6403: 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | +6431: responses: +6441: description: 错误码,非 0 表示失败 +6508:## OpenAPI Specification +6522: 该接口用于更新表单中的元数据项 +6524: 该接口支持调用频率上限为 10 QPS +6527: ### 错误码 +6530: | HTTP状态码 | 错误码 | 描述 | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-db.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-db.txt new file mode 100644 index 0000000..7c424fe --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-db.txt @@ -0,0 +1,180 @@ +1:# 飞书多维表格开发文档-完整参考 v2(完全离线版) +14: bitable-md/ # 多维表格文档与全部 API 子页原文(49页) +20: manifest.csv # 文档索引清单 +95:2. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/api/bitable2.go`(复杂字段示例) +109:多维表格是一个表格,也是无数个应用,千人千面,万人万解。 +111:## 资源:多维表格应用 App +113:每个多维表格都有唯一 app_token 作为标识。(这里的 app 指一个多维表格,而不是指开发者创建的应用) +115:### 字段说明 +119:| app_token | string | 一个多维表格的唯一标识。 **示例值**:"bascnKMKGS5oD3lmCHq9euO8cGh"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +121:### 方法列表 +123:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +127:| [获取多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get)`GET` /open-apis/bitable/v1/apps/:app_token | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +128:| [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)`PUT` /open-apis/bitable/v1/apps/:app_token | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +130:## 资源:数据表 Table +132:多维表格的数据容器,一个多维表格中至少有一个数据表,也可能有多个数据表。每个数据表都有唯一标识 table_id。table_id 在一个多维表格 App 中唯一,在全局不一定唯一。 +134:### 字段说明 +138:| table_id | string | 一个数据表的唯一标识。 **示例值**:"tblTONn0A0CbGRDX"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +140:### 方法列表 +142:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +146:| [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +147:| [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +148:| [新增多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +149:| [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +150:| [删除多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +154:数据表的呈现布局。一个数据表至少有一个视图,可能有多个视图。每个视图都有唯一标识 view_id,view_id 在一个多维表格中唯一,在全局不一定唯一。 +156:### 字段说明 +160:| view_id | string | 一个视图的唯一标识。 **示例值**:"vewhNUNwqB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +162:### 方法列表 +164:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +168:| [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +169:| [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +170:| [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +174:数据表中的每一行数据都是 Record。每条记录都有唯一标识 record_id,record_id 在一个多维表格中唯一,在全局不一定唯一。 +176:### 字段说明 +180:| record_id | string | 一行记录的唯一标识。 **示例值**:"recn0hoyXL"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +182:### 方法列表 +184:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +188:| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +189:| [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +190:| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +191:| [新增多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +192:| [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +193:| [更新多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +194:| [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +195:| [删除多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +197:## 资源:字段 Field +199:多维表格的字段。每个字段都有唯一标识 field_id,field_id 在一个多维表格内唯一,在全局不一定唯一。 +201:### 字段说明 +205:| field_id | string | 一列字段的唯一标识。 **示例值**:"fldwJ4YrtB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +207:### 方法列表 +209:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +213:| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +214:| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +215:| [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +216:| [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +222:### 字段说明 +226:| role_id | string | 一条自定义权限的唯一标识。 **示例值**:"rolJOiPRqp"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | +228:### 方法列表 +230:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +234:| [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +235:| [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +236:| [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +237:| [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +243:### 字段说明 +247:| member_id | string | 一条自定义权限下的一位协作者的唯一标识。 **示例值**:"ou_xxxxxxxxxxx"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | +249:### 方法列表 +251:> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) +255:| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +256:| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +257:| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +270:多维表格(Bitable)是飞书云文档下的一个产品。它可以是一个表格,也可以是无数个应用。 +274:一篇多维表格可以理解成是一个应用(app),标记该应用的唯一标识叫 apptoken; +276:每篇多维表格是由有多个数据表(table)组成的,标记该数据表的唯一标识叫 tableid; +280:可以作为一个独立应用存在,也可以作为一个模块(block)与飞书文档、飞书表格结合在一起。 +282:| 飞书云文档中 | 飞书文档中 | 飞书表格中 | +285:| 即在"**飞书云文档**"中新建的多维表格 | 即在"**飞书文档**"中插入的多维表格 | 即在"**飞书表格**"中新建的多维表格 | +288:| ![飞书云文档中](offline-docs-v2/assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png) | ![飞书文档中](offline-docs-v2/assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png) | ![飞书表格中](offline-docs-v2/assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png) | +290:> *通过 API 在飞书表格(Sheets)中新建数据表暂时无法在页面看到,后续会支持; +294:目前开放多维表格在App、数据表、视图、字段、记录、高级权限设置和高级权限协作者 7 种内容的 API 。 +296:记录可以狭义的理解为表格行; +298:字段可以狭义的理解为表格的列; +300:| 记录* | 字段 | 视图 | 数据表 | App | 权限 | 高级权限设置 | 高级权限协作者 | +302:| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) [记录筛选开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/filter) [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get) [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [新增多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) [更新多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update) [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete) [删除多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete) | [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete) | [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list) [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create) [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete) | [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list) [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create) [新增多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create) [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete) [删除多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete) | [获取元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get) [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update) [新建多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uQTNzUjL0UzM14CN1MTN) [复制多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uYTNzUjL2UzM14iN1MTN) [删除多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/[删除文件](/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/delete)) | [增加权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) [移除权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/delete) [更新权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/update) [列出列表](https://open.feishu.cn/document/ukTMukTMukTM/uATN3UjLwUzN14CM1cTN) [转移拥有者](https://open.feishu.cn/document/ukTMukTMukTM/uQzNzUjL0czM14CN3MTN) [判断是否有权限](https://open.feishu.cn/document/ukTMukTMukTM/uYzN3UjL2czN14iN3cTN) [更新文档设置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-public/patch) | [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list) [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create) [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete) [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update) | [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list) [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create) [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete) | +303:| 最多 20000条/记录 | 最多150个/字段 | 最多200个/视图 | 最多100个/表格 | -- | -- | 最多30条/自定义权限 | 最多200个/自定义权限协作者 | +309:> 同一时刻,对同一篇多维表格最好只请求一次 API 写操作。 +325:- 多维表格大部分接口都支持通过 +349: 前,请确保你所使用的应用在云文档的协作者列表里。现阶段,你可以通过使用 +357: 来创建一篇多维表格,再使用 +386:## 5.字段类型 +392:| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) | 全支持 | -- | +393:| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) | 多行文本、单选、多选、日期、数字、人员、附件、单向关联、双向关联、复选框、超链接、公式(不支持设置公式表达式)、创建人、修改人、创建时间、最后更新时间、自动编号、电话号码、地理位置 | 查找引用 | +403:- 在飞书云文档中打开一篇多维表格,其 URL 中 app_token 是下图框住部分;![app_token.png](offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png) +407:- 调用[获取文档所有块](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document-block/list),在返回结果中检索,其中 bitable.token 字段的值 AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +423:- 调用[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN),在返回结果中检索,其中 blockType 的值为 BITABLE_BLOCK 时,blockToken 字段的值AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +432: "columnCount": 0, +446:- 在 Bitable app 中打开一篇多维表格,其 URL 中 table_id 是下图中框住部分;![table_id.png](offline-docs-v2/assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png) +447:- 对于其它场景的多维表格,需要通过[列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)接口获取; +451:- 打开任意一篇多维表格,其 URL 中 view_id 是下图中框住部分;![view_id.png](offline-docs-v2/assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png) +452:- 或者通过[列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)接口获取。暂时无法获取到 Bitable doc block 中表格的 view_id; +460:- 需要通过[列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)接口获取; +481:一篇多维表格可以理解成是一个 app,他的唯一标识就是 `app_token`。 +483:app 是由一个个 table 组成,我们称 table 为数据表,他的标识就是 `table_id`。 +485:table 由 record(记录) 和 field(字段) 组成, 同时可以拥有多个 view (视图)。 +498:| `fields` | map | 记录的字段 | +502:fields是一个map,是由字段名和其具体内容的键值对组成。 +506:| `key` | `string` | 字段名 | +507:| `value` | `union` | 某个字段的具体内容,其结构可以是string, boolean, list of string and list of person object | +509:#### value结构(不同字段类型对应值的结构) +511:| 字段类型 | value结构 | 描述 | +520:| 电话号码 | string | 电话号码,符合正则表达式`(\+)?\d*`的字符串 | +571:## 字段 +573:字段是一个`object`结构类型。 +577:| field_id | string | 字段id | +578:| field_name | string | 字段名 | +579:| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +580:| property | object | 字段属性,因字段类型而异 | +584:参考: [字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide) +620:filter 后的表达式支持[公式语法](https://www.feishu.cn/hc/zh-CN/articles/360049067853),可通过 AND 或 OR 来组合。 +622:表达式的语法为: CurrentValue.[字段名],其中首字母 C 和 V 要大写。 +628:| 逻辑名称 | 表达式 | +638:| AND | `表达式1&&表达式2 或者 AND(表达式1,表达式2)` | +639:| OR | `OR(表达式1,表达式2)` | +641:## 常用的逻辑表达式 +651:## 常用的日期表达式 +685:## 字段筛选示例 +687:| 字段 | 筛选示例 | +689:| 多行文本 | `CurrentValue.[字段名1]="内容a"` | +690:| 单选 | `CurrentValue.[字段名1]="选项内容a"` | +691:| 多选 | `CurrentValue.[字段名1]="选项内容a"` | +695:| 附件 | `CurrentValue.[字段名1]="内容a"` | +696:| 数字 | `CurrentValue.[字段名1]=1` | +697:| 复选框 | `CurrentValue.[字段名1]=1` | +699:| 公式 | `CurrentValue.[字段名1]="内容a"`(如果公式返回值为数字,则不需要双引号,如`CurrentValue.[字段名1]=123`) | +700:| 查找引用 | `CurrentValue.[字段名1]="内容a"` | +701:| 单向关联 | `CurrentValue.[字段名1]="内容a"` | +703:| 创建时间 | `CurrentValue.[字段名1]>TODAY()` | +705:| 最后更新时间 | `CurrentValue.[字段名1]>TODAY()` | +713:### A.5 字段编辑指南 +717:# 字段编辑指南 +719:## 字段概述 +721:字段是一个`object`结构类型。结构如下: +725:| field_id | string | 字段id | +726:| field_name | string | 字段名 | +727:| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +728:| property | object | 字段属性,因字段类型而异 | +732:更新字段时为全量更新,`property`会被完全覆盖。在下面的单选、多选字段的[更新字段的请求体示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#更新字段的请求体示例)中有所体现。 +736:部分类型字段有特殊的属性配置,在下面列出。其他类型字段的`property`均为`null`。 +738:### 数字字段 +764:#### 新增、更新字段的请求体示例 +795:### 单选、多选字段 +801:| options | app.table.field.property.option[] | 选项列表 | 否 | 否 | - | - | +806:#### 新增字段的请求体示例 +872:#### 更新字段的请求体示例 +884: "id": "optpeuQVqp", // 若携带id,id必须是旧的单选、多选字段property中已存在的选项id +903:因为更新字段是全量更新,选项`c`和选项`d`已删除,响应体如下: +938:### 日期字段 +959:#### 新增、更新字段的请求体示例 +992:### 人员字段 +1000:#### 新增、更新字段的请求体示例 +1031:### 单向关联字段 +1038:| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +1039:| table_name | string | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | +1041:#### 新增、更新字段的请求体示例 +1066: "table_name": "数据表2" +1075:### 双向关联字段 +1081:| back_field_id | string | 关联的数据表中双向关联字段的id(仅在响应体中返回) | - | - | - | - | +1082:| back_field_name | string | 关联的数据表中双向关联字段的名字 | 否 | 否 | - | 关联的数据表名-本字段名 | +1084:| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +1085:| table_name | String | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | +1087:#### 新增、更新字段的请求体示例 +1115: "table_name": "数据表2" +1124:### 公式字段 +1154:#### 新增、更新字段的请求体示例 +1187:### 创建时间、最后更新时间字段 +1195:#### 新增、更新字段的请求体示例 +1226:### 自动编号字段 +1235:| ∟options | app.field.property.auto_serial.options[] | 自定义编号规则列表 | 否 | 否 | - | - | +1265:#### 新增字段的请求体示例 +1329:#### 新增字段的请求体示例 +1370:### A.6 附件字段说明 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-deps.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-deps.txt new file mode 100644 index 0000000..0cdf4d0 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-deps.txt @@ -0,0 +1,220 @@ +6:- 目标:提供不依赖在线链接的本地离线资料包(Bitable 全子页 + Go SDK 指南 + Go SDK 示例代码)。 +15: go-sdk-md/ # Golang SDK 指南原文(7页) +17: oapi-sdk-go/ # 官方 Go SDK 仓库(离线) +23:## 3. Golang SDK 调用说明(基于 API 参考文档整理) +39:1. SDK 已托管 tenant_access_token/app_access_token 的获取与缓存(可关闭后手动传 token)。 +40:2. 用户态调用用 `larkcore.WithUserAccessToken(...)`。 +41:3. 商店应用调用需补 `larkcore.WithTenantKey(...)`。 +43:### 3.2 Bitable v1 调用范式 +45:SDK 方法映射规则:`client.Bitable.V1.<资源>.<动作>`。 +67:1. `larkcore.WithUserAccessToken(...)`:用户态调用。 +72:### 3.4 历史/未封装 API 的原生调用 +74:当 SDK 暂未提供强类型方法时,可用 `client.Do()`: +88:1. 推荐优先使用 SDK 长连接模式(WebSocket),本地开发可免内网穿透。 +280:可以作为一个独立应用存在,也可以作为一个模块(block)与飞书文档、飞书表格结合在一起。 +321: 前,请确保你的应用已经是文档的所有者或者协作者,否则会调用失败。 +339: 两种身份进行调用。但仍然有部分接口只支持其中一种身份,请开发者在调用前,仔细阅读对应接口的说明文档。 +379:- 每个接口都有接口调用的频率限制,可参考[频控策略](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)。 +407:- 调用[获取文档所有块](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document-block/list),在返回结果中检索,其中 bitable.token 字段的值 AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +423:- 调用[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN),在返回结果中检索,其中 blockType 的值为 BITABLE_BLOCK 时,blockToken 字段的值AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +1410:1.调用[上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all)或[分片上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)接口上传文件,上传成功之后获取到文件的 file_token; +1412:2.调用[新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)或者[更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)将文件更新到记录中去; +1483:1.调用[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)查询出多维表格中附件的 file_token; +1534:2.调用[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download) 下载或者[获取素材临时下载链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url),这2个接口已经支持多维表格。 +1553:调用高级权限的接口前,请先确保多维表格已开启高级权限。可以通过[更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)开启高级权限。 +1558:- 开启高级权限有延迟,开启高级权限后立即调用高级权限的接口时遇到 `OperationTypeError` 的报错请重试。 +1954: 该接口支持调用频率上限为 20 QPS +2067: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2233: 该接口支持调用频率上限为 10 QPS +2283: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2454: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) +2457: 首次调用请参考 +2635: 该接口支持调用频率上限为 20 QPS +2637: 关于云文档接口的 AccessToken 调用说明详见 [云文档接口快速入门] +2753: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +2930: 该接口支持调用频率上限为 10 QPS +2933: 关于云文档接口的 AccessToken 调用说明详见 +3050: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3219: 该接口支持调用频率上限为 10 QPS +3222: 关于云文档接口的 AccessToken 调用说明详见 +3339: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3513: 关于云文档接口的 AccessToken 调用说明详见 +3630: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +3769: 该接口支持调用频率上限为 10 QPS +3772: 首次调用请参考 +3889: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4240: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4397: 该接口支持调用频率上限为 20 QPS +4543: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +4869: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +5329: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +5573: 该接口支持调用频率上限为 20 QPS +5575: 关于云文档接口的 AccessToken 调用说明详见 +5710: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +5897: 该接口支持调用频率上限为 10 QPS +5899: 关于云文档接口的 AccessToken 调用说明详见 +6034: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +6239: 该接口支持调用频率上限为 10 QPS +6241: 关于云文档接口的 AccessToken 调用说明详见 +6379: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +6524: 该接口支持调用频率上限为 10 QPS +6655: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +6885: 该接口支持调用频率上限为 20 QPS +7031: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +7230: 该接口支持调用频率上限为 10 QPS +7367: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +7594: 该接口支持调用频率上限为 20 QPS +7731: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +7948: 该接口支持调用频率上限为 20 QPS +8064: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +8529: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率),1000 QPM(Query Per +8533: 首次调用请参考 +8674: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +9268: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) +9271: 首次调用请参考 +9452: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +9842: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) +9845: 首次调用请参考 +9977: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +10307: 该接口支持调用频率上限为 10 QPS +10310: 关于云文档接口的 AccessToken 调用说明详见 +10457: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +10629: 该接口用于在数据表中新增多条记录,单次调用最多新增 500 条记录。 +10632: 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) +10635: 首次调用请参考 +10816: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +11217: 该接口用于更新数据表中的多条记录,单次调用最多更新 500 条记录。 +11219: 该接口支持调用频率上限为 10 QPS +11222: 关于云文档接口的 AccessToken 调用说明详见 +11393: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +11763: 该接口支持调用频率上限为 10 QPS +11765: 关于云文档接口的 AccessToken 调用说明详见 +11912: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +12108: 该接口支持调用频率上限为 20 QPS +12111: 关于云文档接口的 AccessToken 调用说明详见 +12243: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +12678: 该接口支持调用频率上限为 10 QPS +12681: 首次调用请参考 +12938: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +13147: 该接口支持调用频率上限为 10 QPS +13149: 关于云文档接口的 AccessToken 调用说明详见 +13400: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +13618: 该接口支持调用频率上限为 10 QPS +13620: 关于云文档接口的 AccessToken 调用说明详见 +13791: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +14004: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +14435: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +14723: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +14919: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +15439: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +15640: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +15856: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +16141: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +16350: 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | +16471:## 5. 附录 B:Golang SDK 指南原文(离线) +16475:### B.1 服务端 SDK +16479:# 服务端 SDK +16481:飞书开放平台提供了一系列服务端的原子 API 来实现多元化的功能,但在实际编码过程中,需要考虑一些额外的工作,如访问凭证(access token)的获取与维护、数据加解密、请求验签等。此外,缺少函数调用的语义化描述、类型系统的支持,也会增加编码负担。 +16483:为解决以上问题,飞书开放平台提供了服务端 SDK,将所有冗长的逻辑内置处理,支持完备的类型系统,对外提供语义化的编程接口,以提高实际的编码体验。 +16485:SDK 提供的主要能力包括: +16487:- SDK 支持 **基于长连接的事件回调**,详情见[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case#d286cc88)、[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +16489:- SDK 提供了 **结构化的 API 请求入参**。比如发消息 API,SDK 对各种类型的消息都提供了结构化封装。 +16497:- SDK 提供了 **完整的应用访问凭证(tenant_access_token)生命周期管理能力**,无需开发者自己获取并刷新应用身份的访问凭证。 +16503: SDK 仅支持托管应用身份的访问凭证(tenant_access_token),不支持托管用户身份的访问凭证(user_access_token),开发者需自行实现相关逻辑,参考 [获取 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/get-user-access-token) 、[刷新 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/refresh-user-access-token) 。 +16506:- SDK 内 API 和事件上都添加了文字注释,以及跳转到使用 Demo 和官方文档的链接。 +16514:- SDK 提供了简洁易懂的帮助文档。参考 SDK 文档可帮助你了解如何安装 SDK、如何通过 SDK 调用服务端 API、处理订阅的事件及回调。 +16520: - [SDK 常见问题](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/faq) +16524:你可以进入 GitHub 项目空间查看源码详情。在使用 SDK 的过程中,如果遇到问题,可以给我们提交 Issue。 +16533:## SDK 问题交流群 +16535:| Java SDK 交流群 | Python SDK 交流群 | Go SDK 交流群 | +16537:| [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=a53jb5f6-87de-4974-9ad6-8a88563d0e89)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=575k28fa-2c12-400a-80c0-2d8924e00d38)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=21cn476d-b859-4c15-9048-5ecf49f1a951)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png) | +16539:NodeJS SDK 问题可直接提交[Issues](https://github.com/larksuite/node-sdk/issues)。 +16555:使用 Go SDK 调用服务端 API、处理事件和回调前,请确保你已创建了一个应用、安装了 Go 环境和 Go SDK。本文档介绍使用 Go SDK 开发前的准备工作。 +16561:对于新手开发者,建议你直接上手体验[开发自动回复机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)或[开发卡片交互机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-a-card-interactive-bot/introduction)教程,在教程示例代码中了解如何调用 API、处理事件和回调。 +16566:在使用服务端 SDK 之前,你需要确保已在[开发者后台](https://open.feishu.cn/app)创建了一个企业自建应用或商店应用。详情参考[创建企业自建应用](https://open.feishu.cn/document/home/introduction-to-custom-app-development/self-built-application-development-process#a0a7f6b0)或[创建商店应用](https://open.feishu.cn/document/uMzNwEjLzcDMx4yM3ATM/ucjN2YjL3YjN24yN2YjN/step1-create-a-store-application)。了解选择哪种应用,参考[应用类型](https://open.feishu.cn/document/home/app-types-introduction/overview#c3c7ad51)。 +16570:要确保 Go SDK 运行,你需安装 Go 环境。下载地址见 [Go download and install](https://go.dev/doc/install)。 +16572:## 安装 Go SDK +16574:运行以下命令,安装 Go SDK。 +16582:- [调用服务端 API](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis):介绍如何通过 SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。 +16583:- [处理事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-events):介绍如何通过 SDK 封装的长连接方式处理事件、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理事件。 +16584:- [处理回调](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-callback):介绍如何通过 SDK 封装的长连接方式处理回调、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理回调。 +16585:- [场景示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/demo):提供基于 SDK 实现的各类场景的代码示例。 +16590:### B.3 调用服务端 API +16594:# 调用服务端 API +16596:本文档介绍如何通过 Go SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码,然后参考本文档了解调用 API 的全面流程。 +16606:通过 SDK 调用飞书开放接口之前,你需要先在代码中创建一个 API Client。该 API Client 支持指定当前使用的应用信息、日志级别、HTTP 请求超时时间等基本信息。以下为支持的配置项及其具体含义。 +16626:| TokenCache | `lark.WithTokenCache(cache larkcore.Cache)` | 否 | 设置 Token 缓存器,用于缓存 Token 和 appTIcket,默认实现为内存。如果你需要定制 Token 缓存器,则需实现如下 Cache 接口。`type Cache interface { Set(ctx context.Context, key string, value string, expireTime time.Duration) error Get(ctx context.Context, key string) (string, error)}`**注意**:对于商店应用的 ISV 开发者而言,如果需要 SDK 来缓存 appTicket,则需要实现该接口,以提供分布式缓存。 | +16628:| HelpDeskId、HelpDeskToken | `lark.WithHelpdeskCredential(helpdeskID, helpdeskToken string)` | 否 | 服务台的 ID 和 token。仅在调用服务台业务的 API 时需要配置。可在[服务台管理后台](https://feishu.cn/helpdesk/admin)**设置中心** > **API 凭证** 处获取,详情参见 [服务台接入指南](https://open.feishu.cn/document/ukTMukTMukTM/ugDOyYjL4gjM24CO4IjN)。**注意**:服务台的 ID、Token 只有服务台创建者可以查看到。![img](offline-docs-v2/assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png) | +16629:| ReqTimeout | `lark.WithReqTimeout(time time.Duration)` | 否 | 设置 SDK 内置的 Http Client 的请求超时时间。默认为 0 表示永不超时。 | +16630:| HttpClient | `lark.WithHttpClient(httpClient larkcore.HttpClient)` | 否 | 设置 Http Client,用于替换 SDK 提供的默认实现。你可通过实现下面的 HttpClient 接口来设置自定义的 HttpClient。`type HttpClient interface { Do(*http.Request) (*http.Response, error)}` | +16648:在项目内创建 API Client 后,即可开始调用[飞书开放平台接口](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/server-api-list)。如下图示例,你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码。 +16656:SDK 使用 **client.** **业务域.** **版本.** **资源** **.方法名称** 来定位具体的 API 方法。以[创建文档](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document/create)接口为例,HTTP URL 为 `https://open.feishu.cn/open-apis/docx/v1/documents`,其中 `docx` 为业务域,`v1` 为版本,`documents` 为资源,相应的创建方法为 `client.Docx.V1.Document.Create()`。 +16664:如下代码示例,你可通过 client 调用文档资源的 create 方法,创建一个文档。 +16672:import ( // 导入接口所属的业务资源包 +16677: "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +16708:在每次发起 API 调用时,你可以设置请求级别的相关参数,例如传递 userAccessToken(用户访问凭证)、自定义 headers 等。所有请求级别可设置的选项如下表所示。 +16713:| **`UserAccessToken`** | `larkcore.WithUserAccessToken(userAccessToken string)` | 设置用户 token,当你需要以用户身份发起 API 调用时,需要设置该选项的值。 | +16722:import ( +16728: "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +16764:完成以上步骤后,即可运行代码调用创建文档 API。若请求成功,预计将返回以下数据。若失败,将返回错误码、错误信息和 Log ID,你可前往开发文档搜索解决方案。 +16778:### 如何调用历史版本 API ? +16780:服务端 API 中存在部分历史版本或未全量开放的接口,由于没有元数据信息,所以不能使用 SDK 内封装好的方法快速调用,此时你可以使用 SDK 提供的原生模式调用 API。以[获取单个用户信息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/get)接口为例,调用示例如下所示: +16783:import ( +16820:了解更多 API 调用示例,参考 GitHub 代码仓库中的 [api.go 示例](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/callrawapi/api.go)。 +16824:飞书开放平台提供了 [API 调试台](https://open.feishu.cn/api-explorer),通过该平台可以快速调试服务端 API,快速获取资源 ID 及生成多语言示例代码的能力,为您节省开发成本。例如,通过 API 调试台调用 [发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create) 接口,在调试台成功完成测试后,可通过 **示例代码** 页面查阅 Go SDK 对应的接口调用代码。 +16834:使用 API Client 调用 API 时,对应的方法建议你借助 [API 调试台](https://open.feishu.cn/api-explorer/)获取,可通过指定接口的地址栏参数拼接方法,也可以直接参考接口提供的示例代码。以[通过手机号或邮箱获取用户 ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/batch_get_id)接口为例,获取方式如下图所示。 +16849:通过事件订阅功能,应用可以及时接收飞书中资源数据的变化,并根据变化情况做对应的业务处理,详情参见[事件概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。在应用内订阅事件时,还需要在本地服务端建立与应用的连接,以便接收事件数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理事件;你也可以选择自建 HTTP 服务器处理事件。两种方式介绍如下: +16853:| 使用长连接接收事件 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的事件发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收事件回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续事件推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +16858:如果事件订阅方式需要选择 **使用长连接接收事件**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的事件订阅方式中保存 **使用长连接接收事件** 方式。关于应用内配置事件订阅方式的介绍,参考[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case)。 +16879:import ( +16885: larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +16962:### 选择一:使用 Go SDK 原生 HTTP 服务器处理事件 +16964:订阅事件后,你可以使用下面代码,对飞书开放平台推送的事件进行处理。以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器: +16968:import ( +16976: "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +17028:### 选择二:集成 Gin 框架处理事件 +17030:如果你当前应用使用的是 Gin Web 框架,并且不希望使用 Go SDK 的原生 HTTP 服务器,你可以参考以下集成步骤,将当前应用的 Gin 服务与 SDK 进行集成。 +17032:1. 安装集成包。 +17034: 把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 +17040:2. 进行代码集成。集成示例如下: +17043: import ( +17052: "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" +17053: "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +17079:### 选择三:集成 hertz 框架处理事件 +17081:详情请参见[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 +17089:对于商店应用的 ISV 开发者,当需要在消息处理器内向对应企业或组织的用户发送消息时,需要先从事件回调数据中获取企业或组织 key,然后使用如下方式调用消息 API 进行消息发送。 +17092:import ( +17102: "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +17147:通过回调订阅功能,应用可以及时接收并处理飞书中特定的交互行为(例如,飞书卡片交互、链接预览等),并根据交互结果做对应的业务处理,详情参见[回调概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/callback-overview)。在应用内订阅回调时,还需要在本地服务端建立与应用的连接,以便接收回调数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理回调;你也可以选择自建 HTTP 服务器处理回调。两种方式介绍如下: +17151:| 使用长连接接收回调 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的回调发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续回调推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +17156:开放平台 SDK 仅支持对象类型的卡片回传参数,不支持字符串类型。 +17170: // 回传交互数据。开放平台 SDK 仅支持对象类型的卡片回传参数。 +17180:如果回调订阅方式需要选择 **使用长连接接收回调**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的回调订阅方式中保存 **使用长连接接收回调** 方式。关于应用内配置回调订阅方式的介绍,参考[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +17203:import ( +17273:配置卡片回调地址并订阅新版[卡片回传交互回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)后,你可以使用下面代码,对飞书开放平台推送的卡片行为进行处理,以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。关于如何完整处理卡片回调,可参考[处理卡片回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/handle-card-callbacks)。 +17283:import ( +17324:- **选择一**:使用 Go SDK 原生 HTTP 服务器处理回调 +17326: 以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。 +17329: import ( +17358:- **选择二**:集成 Gin 框架处理回调: +17360: 如果你当前使用的是 Gin Web 框架,并且不希望使用 Go SDK 提供的 原生 Http Server,则可以使用以下方式,把当前应用的 Gin 服务与 SDK 进行集成。 +17362: 1. 安装集成包。把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 +17368: 2. 进行代码集成。集成示例如下: +17371: import ( +17397:- **选择三**:集成 hertz 框架处理回调:详情参考[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 +17404:import ( +17442:import ( +17484:在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。如果你是商店应用的开发者,当需要在卡片处理器内向指定企业或组织的用户发送消息时,需要先从消息卡片中获取企业或组织 key,然后使用以下方式调用消息 API 进行消息发送。 +17487:import ( +17539:飞书开放平台基于 SDK,封装了常用的 API 组合调用及业务场景示例供你参考。在 [oapi-sdk-go-demo](https://github.com/larksuite/oapi-sdk-go-demo) 中包含了以下多种场景示例代码。 +17548:import ( +17556: "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +17640:import ( +17648: "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +17727:import ( +17733: larkcontact "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" +17810:import ( +17816: larkbitable "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +17893:import ( +17987:import ( +17996: larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1" diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-events.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-events.txt new file mode 100644 index 0000000..a9de741 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-events.txt @@ -0,0 +1,174 @@ +86:### 3.5 事件与回调处理 +1609:## 事件 +1613:| 事件类型 | drive.file.bitable_field_changed_v1 | +1619:### 事件体 +1623:| schema | string | 事件模式 | +1624:| header | event_header | 事件头 | +1625:| event_id | string | 事件 ID | +1626:| event_type | string | 事件类型 | +1627:| create_time | string | 事件创建时间戳(单位:毫秒) | +1628:| token | string | 事件 Token | +1631:| event | - | - | +1693:| subscriber_id_list | user_id[] | 订阅用户id列表 | +1699:### 事件体示例 +1705: "event_id": "5e3702a84e847582be8db7fb73283c02", +1706: "event_type": "drive.file.bitable_field_changed_v1", +1712: "event": { +1796: "subscriber_id_list": [ +1817:了解事件订阅的使用场景和配置流程,请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) +1819:被订阅的多维表格记录发生变更将会触发此事件,**公式字段的值变化不会触发事件**。 +1828:如何订阅文档请点击查看 [订阅云文档事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/subscribe)。 +1844: "schema": "2.0", // 事件格式的版本。无此字段的即为1.0 +1846: "event_id": "85ec04b2f6cff27a1bf249b26fbabcef", // 事件的唯一标识 +1848: "create_time": "1652677457000", // 事件发送的时间 +1849: "event_type": "drive.file.bitable_record_changed_v1", // 事件类型 +1853: "event": { +1915: "subscriber_id_list": [ // 订阅的用户列表 +9343: complies with the specification. | 幂等键格式错误,需要传入 uuid +9483: client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 +10707: complies with the specification. | 幂等键格式错误,需要传入 uuid +10847: client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 +10893: description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 +12777: complies with the specification. | 幂等键格式错误,需要传入 uuid +12965: client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 +13005: description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 +16487:- SDK 支持 **基于长连接的事件回调**,详情见[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case#d286cc88)、[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +16489:- SDK 提供了 **结构化的 API 请求入参**。比如发消息 API,SDK 对各种类型的消息都提供了结构化封装。 +16506:- SDK 内 API 和事件上都添加了文字注释,以及跳转到使用 Demo 和官方文档的链接。 +16514:- SDK 提供了简洁易懂的帮助文档。参考 SDK 文档可帮助你了解如何安装 SDK、如何通过 SDK 调用服务端 API、处理订阅的事件及回调。 +16544:- [事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list) +16555:使用 Go SDK 调用服务端 API、处理事件和回调前,请确保你已创建了一个应用、安装了 Go 环境和 Go SDK。本文档介绍使用 Go SDK 开发前的准备工作。 +16561:对于新手开发者,建议你直接上手体验[开发自动回复机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)或[开发卡片交互机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-a-card-interactive-bot/introduction)教程,在教程示例代码中了解如何调用 API、处理事件和回调。 +16583:- [处理事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-events):介绍如何通过 SDK 封装的长连接方式处理事件、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理事件。 +16824:飞书开放平台提供了 [API 调试台](https://open.feishu.cn/api-explorer),通过该平台可以快速调试服务端 API,快速获取资源 ID 及生成多语言示例代码的能力,为您节省开发成本。例如,通过 API 调试台调用 [发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create) 接口,在调试台成功完成测试后,可通过 **示例代码** 页面查阅 Go SDK 对应的接口调用代码。 +16843:### B.4 处理事件 +16847:# 处理事件 +16849:通过事件订阅功能,应用可以及时接收飞书中资源数据的变化,并根据变化情况做对应的业务处理,详情参见[事件概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。在应用内订阅事件时,还需要在本地服务端建立与应用的连接,以便接收事件数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理事件;你也可以选择自建 HTTP 服务器处理事件。两种方式介绍如下: +16853:| 使用长连接接收事件 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的事件发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收事件回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续事件推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +16854:| 将事件发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收事件消息的服务器公网地址。后续当应用订阅的事件发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含事件数据。 | +16856:## (推荐)方式一:使用长连接接收事件 +16858:如果事件订阅方式需要选择 **使用长连接接收事件**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的事件订阅方式中保存 **使用长连接接收事件** 方式。关于应用内配置事件订阅方式的介绍,参考[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case)。 +16871:- 与 **将事件发送至开发者服务器** 方式(即自建服务器方式)的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成,否则会触发超时重推机制。 +16873:- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 +16883: larkevent "github.com/larksuite/oapi-sdk-go/v3/event" +16884: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +16889: // 注册事件回调,OnP2MessageReceiveV1 为接收消息 v2.0;OnCustomizedEvent 内的 message 为接收消息 v1.0。 +16890: eventHandler := dispatcher.NewEventDispatcher("", ""). +16891: OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { +16892: fmt.Printf("[ OnP2MessageReceiveV1 access ], data: %s\n", larkcore.Prettify(event)) +16895: OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { +16896: fmt.Printf("[ OnCustomizedEvent access ], type: message, data: %s\n", string(event.Body)) +16901: larkws.WithEventHandler(eventHandler), +16914:1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),注意**两个参数必须填空字符串**。 +16916:2. 通过 eventHandler 的 OnXXXX() 方法处理不同的事件。上述示例中分别监听了「接收消息 v1.0」和「接收消息 v2.0」两个事件。 +16918: **说明**:开放平台提供的事件包括 v1.0 和 v2.0 两个版本。两个版本的结构不同。在处理事件时,可通过[事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list)文档或在开发者后台[添加事件](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/subscription-event-case)时,获取事件的类型与版本信息。 +16926: 如果是 v1.0 事件,则注册服务器时需要查找并使用 OnCustomizedEvent 方法;如果是 v2.0 事件,则注册服务器时需要查找并使用 onP2xxxx 开头的方法。例如,使用 `onP2MessageReceiveV1` 注册接收消息事件回调时,`P2`便对应的是 v2.0 版本事件结构。 +16942:4. 可选参数传入 eventHandler,同时可设置日志级别。 +16952:## 方式二:将事件发送至开发者服务器 +16954:如果事件订阅方式选择 **将事件发送至开发者服务器**,则需要设置事件请求地址,后续在事件发生时,开放平台会向该地址发送包含事件 JSON 数据的 HTTP POST 请求。为此你需启动一个 HTTP 服务器接收并处理事件。 +16962:### 选择一:使用 Go SDK 原生 HTTP 服务器处理事件 +16964:订阅事件后,你可以使用下面代码,对飞书开放平台推送的事件进行处理。以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器: +16974: "github.com/larksuite/oapi-sdk-go/v3/event" +16975: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +16979: // 注册消息处理器 +16980: // 用于签名验证和消息解密,默认可以传递为空串。但如果你在开发者后台 > 事件与回调 > 加密策略中开启了加密,则必须传递 Encrypt Key 和 Verification Token +16981: handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") +16982: handler = handler.OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { +16983: // 处理消息 event,这里简单打印消息的内容 +16984: fmt.Println(larkcore.Prettify(event)) +16985: fmt.Println(event.RequestId()) +16987: }).OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { +16988: // 原生消息体 +16989: fmt.Println(string(event.Body)) +16990: fmt.Println(larkcore.Prettify(event.Header)) +16991: fmt.Println(larkcore.Prettify(event.RequestURI)) +16992: fmt.Println(event.RequestId()) +16993: // 处理消息 +16994: cipherEventJsonStr, err := handler.ParseReq(ctx, event) +17004: // 处理解密后的 消息体 +17009: http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17018:其中需要注意:EventDispatcher.newBuilder 方法的参数用于签名验证和消息解密,默认可以传递为空串。但如果你在[开发者后台](https://open.feishu.cn/app) > **事件与回调** > **加密策略**中开启了加密,则必须传递 Encrypt Key 和 Verification Token。 +17026:了解更多事件订阅示例,参考 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/event/event.go)。 +17028:### 选择二:集成 Gin 框架处理事件 +17051: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +17057: // 注册消息处理器 +17058: handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { +17059: fmt.Println(larkcore.Prettify(event)) +17060: fmt.Println(event.RequestId()) +17062: }).OnP2MessageReadV1(func(ctx context.Context, event *larkim.P2MessageReadV1) error { +17063: fmt.Println(larkcore.Prettify(event)) +17064: fmt.Println(event.RequestId()) +17066: }).OnP2UserCreatedV3(func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error { +17067: fmt.Println(larkcore.Prettify(event)) +17068: fmt.Println(event.RequestId()) +17074: // 在已有 Gin 实例上注册消息处理路由 +17075: gin.POST("/webhook/event", sdkginext.NewEventHandlerFunc(handler)) +17079:### 选择三:集成 hertz 框架处理事件 +17083:## (可选)在消息处理器内向对应用户发送消息 +17085:在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。 +17089:对于商店应用的 ISV 开发者,当需要在消息处理器内向对应企业或组织的用户发送消息时,需要先从事件回调数据中获取企业或组织 key,然后使用如下方式调用消息 API 进行消息发送。 +17100: "github.com/larksuite/oapi-sdk-go/v3/event" +17101: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +17108: // 注册消息处理器 +17109: handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { +17110: // 处理消息 event,这里简单打印消息的内容 +17111: fmt.Println(larkcore.Prettify(event)) +17112: fmt.Println(event.RequestId()) +17113: // 获取企业或组织 key 并发送消息 +17114: tenantKey := event.TenantKey() +17115: // 商店应用给指定企业或组织的用户发送消息 +17129: http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17147:通过回调订阅功能,应用可以及时接收并处理飞书中特定的交互行为(例如,飞书卡片交互、链接预览等),并根据交互结果做对应的业务处理,详情参见[回调概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/callback-overview)。在应用内订阅回调时,还需要在本地服务端建立与应用的连接,以便接收回调数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理回调;你也可以选择自建 HTTP 服务器处理回调。两种方式介绍如下: +17151:| 使用长连接接收回调 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的回调发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续回调推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +17152:| 将回调发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收回调消息的服务器公网地址。后续当应用订阅的回调发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含回调数据。 | +17180:如果回调订阅方式需要选择 **使用长连接接收回调**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的回调订阅方式中保存 **使用长连接接收回调** 方式。关于应用内配置回调订阅方式的介绍,参考[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +17191:- [消息卡片回传交互(旧)](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调不支持 **使用长连接接收回调** 订阅方式,只能选择 **将回调发送至开发者服务器** 订阅方式。 +17196:- 与 **将回调发送至开发者服务器** 方式的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成。 +17197:- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 +17207: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +17208: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" +17213: eventHandler := dispatcher.NewEventDispatcher("", ""). +17215: OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { +17216: fmt.Printf("[ OnP2CardActionTrigger access ], data: %s\n", larkcore.Prettify(event)) +17220: OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { +17221: fmt.Printf("[ OnP2URLPreviewAction access ], data: %s\n", larkcore.Prettify(event)) +17226: larkws.WithEventHandler(eventHandler), +17239:1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),**注意两个参数必须填空字符串**。 +17241:2. 通过 eventHandler 的 OnXXXX() 方法监听不同的回调类型,上述示例中监听了[卡片回传交互](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)和 [拉取链接预览数据](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/development-link-preview/pull-link-preview-data-callback-structure) 两个回调。 +17251:4. 可选参数传入 eventHandler,同时可设置日志级别。 +17263:如果回调订阅方式选择 **将回调发送至开发者服务器**,则需要设置回调请求网址,并订阅回调。例如,你配置了可交互的飞书卡片(原消息卡片),当用户在卡片内进行交互后,飞书服务器会向请求网址回调包含 JSON 数据的 HTTP POST 请求。因此,你需要启动一个 HTTP 服务器接收回调数据。 +17289: "github.com/larksuite/oapi-sdk-go/v3/event" +17290: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" +17291: "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" +17294: handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") +17295: handler.OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { +17297: fmt.Println(larkcore.Prettify(event)) +17299: }).OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { +17300: fmt.Println(event) +17304: http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, +17305: larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17316:配置卡片回调地址并订阅旧版[消息卡片回传交互](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调后,你可选择以下方式对旧版卡片回调进行处理。 +17339: cardHandler := larkcard.NewCardActionHandler("verificationToken", "eventEncryptKey", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { +17347: http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17399:## (可选)返回卡片消息 +17401:如果你需要在卡片处理器内同步返回用于更新卡片的消息体,则可以使用以下方式进行处理。 +17428: http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17437:## (可选)返回自定义消息 +17465: // 创建自定义消息:http状态码,body内容 +17473: http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17482:## (可选)在卡片行为处理器内向对应用户发送消息 +17484:在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。如果你是商店应用的开发者,当需要在卡片处理器内向指定企业或组织的用户发送消息时,需要先从消息卡片中获取企业或组织 key,然后使用以下方式调用消息 API 进行消息发送。 +17503: // 获取企业或组织 key 并发送消息 +17506: // ISV 给指定企业或组织中的用户发送消息 +17521: http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) +17541:## [发送文件消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_file.go) +17543:发送文件消息,使用到两个OpenAPI:[上传文件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 +17575:// SendFile 发送文件消息 +17596: // 发送消息 +17633:## [发送图片消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_image.go) +17635:发送图片消息,使用到两个OpenAPI:[上传图片](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 +17664:// SendImage 发送图片消息 +17683: // 发送消息 +18129:你可以直接查询接口文档,例如[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create),有如下图所示的 **尝试一下** 按钮表示支持(不支持的 API 没有该按钮)。 +18207:### 接收事件时为什么重复收到事件体数据? +18209:开放平台推送事件数据后,你的服务器需要在 3 秒内以 HTTP 200 状态码进行响应,否则开放平台认为本次推送失败,并会重新推送事件数据。详情参见[事件推送周期和频次](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM#9cd4c9b1)。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-security.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-security.txt new file mode 100644 index 0000000..ef610ae --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-security.txt @@ -0,0 +1,180 @@ +39:1. SDK 已托管 tenant_access_token/app_access_token 的获取与缓存(可关闭后手动传 token)。 +49: AppToken("app_token"). +68:2. `larkcore.WithTenantAccessToken(...)`:手动传租户 token。 +113:每个多维表格都有唯一 app_token 作为标识。(这里的 app 指一个多维表格,而不是指开发者创建的应用) +119:| app_token | string | 一个多维表格的唯一标识。 **示例值**:"bascnKMKGS5oD3lmCHq9euO8cGh"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +125:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +127:| [获取多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get)`GET` /open-apis/bitable/v1/apps/:app_token | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +128:| [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)`PUT` /open-apis/bitable/v1/apps/:app_token | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +138:| table_id | string | 一个数据表的唯一标识。 **示例值**:"tblTONn0A0CbGRDX"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +144:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +146:| [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +147:| [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +148:| [新增多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +149:| [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +150:| [删除多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +160:| view_id | string | 一个视图的唯一标识。 **示例值**:"vewhNUNwqB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +166:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +168:| [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +169:| [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +170:| [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +180:| record_id | string | 一行记录的唯一标识。 **示例值**:"recn0hoyXL"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +186:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +188:| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +189:| [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +190:| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +191:| [新增多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +192:| [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +193:| [更新多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +194:| [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +195:| [删除多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +205:| field_id | string | 一列字段的唯一标识。 **示例值**:"fldwJ4YrtB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | +211:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +213:| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +214:| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +215:| [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +216:| [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +218:## 资源:自定义权限 Role +220:高级权限的规则设置。 +226:| role_id | string | 一条自定义权限的唯一标识。 **示例值**:"rolJOiPRqp"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | +232:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +234:| [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +235:| [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +236:| [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +237:| [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +239:## 资源:自定义权限的协作者 Member +241:高级权限下的协作者。 +247:| member_id | string | 一条自定义权限下的一位协作者的唯一标识。 **示例值**:"ou_xxxxxxxxxxx"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | +253:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +255:| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +256:| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +257:| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +274:一篇多维表格可以理解成是一个应用(app),标记该应用的唯一标识叫 apptoken; +294:目前开放多维表格在App、数据表、视图、字段、记录、高级权限设置和高级权限协作者 7 种内容的 API 。 +300:| 记录* | 字段 | 视图 | 数据表 | App | 权限 | 高级权限设置 | 高级权限协作者 | +302:| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) [记录筛选开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/filter) [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get) [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [新增多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) [更新多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update) [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete) [删除多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete) | [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete) | [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list) [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create) [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete) | [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list) [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create) [新增多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create) [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete) [删除多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete) | [获取元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get) [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update) [新建多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uQTNzUjL0UzM14CN1MTN) [复制多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uYTNzUjL2UzM14iN1MTN) [删除多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/[删除文件](/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/delete)) | [增加权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) [移除权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/delete) [更新权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/update) [列出列表](https://open.feishu.cn/document/ukTMukTMukTM/uATN3UjLwUzN14CM1cTN) [转移拥有者](https://open.feishu.cn/document/ukTMukTMukTM/uQzNzUjL0czM14CN3MTN) [判断是否有权限](https://open.feishu.cn/document/ukTMukTMukTM/uYzN3UjL2czN14iN3cTN) [更新文档设置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-public/patch) | [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list) [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create) [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete) [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update) | [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list) [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create) [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete) | +303:| 最多 20000条/记录 | 最多150个/字段 | 最多200个/视图 | 最多100个/表格 | -- | -- | 最多30条/自定义权限 | 最多200个/自定义权限协作者 | +311:## 3.鉴权 +317: tenant_access_token +327: user_access_token +335: tenant_access_token +345: tenant_access_token +353: tenant_access_token +361: tenant_access_token +369:| **user_access_token** | **tenant_access_token** | +371:| **用户身份鉴权** token 有效期为7200秒 当该token被刷新之后,老的 token 随即失效 | **应用身份鉴权** token 有效时间2小时 当token有效期<30分,可刷新得到新token 在2小时之内,新老token同时有效 | +397:**API 地址**:https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id +399:### app_token +403:- 在飞书云文档中打开一篇多维表格,其 URL 中 app_token 是下图框住部分;![app_token.png](offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png) +407:- 调用[获取文档所有块](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document-block/list),在返回结果中检索,其中 bitable.token 字段的值 AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +413: "token": "AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx" +423:- 调用[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN),在返回结果中检索,其中 blockType 的值为 BITABLE_BLOCK 时,blockToken 字段的值AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +462:### role_id +464:- 需要通过[列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)接口获取; +468:- 需要通过[列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)接口获取; +481:一篇多维表格可以理解成是一个 app,他的唯一标识就是 `app_token`。 +552:| `file_token` | string | 附件token | +557:| `tmp_url` | string | 生成附件临时下载链接的url,需access token鉴权 | +1382:| file_token | 文件 token | +1395: "file_token": "boxcnzm3dPEcutYDPplx5iDak4b", +1398: "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnzm3dPEcutYDPplx5iDak4b", +1410:1.调用[上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all)或[分片上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)接口上传文件,上传成功之后获取到文件的 file_token; +1422: {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, +1423: {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} +1430: {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, +1431: {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} +1452: "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" +1455: "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" +1466: "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" +1469: "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" +1483:1.调用[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)查询出多维表格中附件的 file_token; +1506: "file_token": "boxcn8Ebe2Z68hXTsW8t1TuZCSd", +1509: "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcn8Ebe2Z68hXTsW8t1TuZCSd", +1547:多维表格的 **所有者 或者 有可管理权限** 的用户可通过 API 设置高级权限,管理高级权限的协作者,针对每个数据表设置谁可以查看、编辑指定的行,或是指定可以编辑的列。使用前请阅读[使用多维表格高级权限](https://www.feishu.cn/hc/zh-CN/articles/588604550568)。 +1549:高级权限接口分为 **自定义角色** 和 **协作者** 两部分。 +1553:调用高级权限的接口前,请先确保多维表格已开启高级权限。可以通过[更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)开启高级权限。 +1557:- 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限。 +1558:- 开启高级权限有延迟,开启高级权限后立即调用高级权限的接口时遇到 `OperationTypeError` 的报错请重试。 +1559:- 高级权限的协作者与云文档权限协作者为不同权限身份,添加高级权限协作者之后,为保证文档权限设置正常,建议再通过 [增加协作者权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) 接口新增文档权限。 +1561:开启高级权限后,首先设置自定义角色,完成设置后可管理自定义的协作者。 +1565:暂不支持仪表盘权限 +1573:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +1575:| [列出自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1576:| [新增自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1577:| [更新自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1578:| [删除自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1584:| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +1586:| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1587:| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1588:| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +1615:| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | +1616:| 字段权限要求 | 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请获取用户 user ID仅自建应用 | +1628:| token | string | 事件 Token | +1630:| tenant_key | string | 租户 Key | +1633:| file_token | string | 文档token | +1637:| user_id | string | 用户的 user id**字段权限要求**:获取用户 user ID仅自建应用 | +1708: "token": "rvaYgkND1GOiu5MM0E1rncYC6PLtF7JV", +1710: "tenant_key": "2ca1d211f64f6438" +1714: "file_token": "bascntUPmnoH9kZbGJ8RWeabcef", +1826:| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | +1847: "token": "L3bzVf0sz7qb9XoTavpsHe0uJv7abcef", // 即 Verification Token +1850: "tenant_key": "736588c9260abcef", // 企业标识 +1908: "file_token": "bascnItn6oHUSEL8RDUdF6abcef", // 多维表格 token +1947: /bitable/v1/apps/{app_token}: +1952: 通过 app_token 获取多维表格元数据 +1976: app_token 错误 | +2006: app_token 不存在 | +2070: 多维表格未开启高级权限或不支持开启高级权限 | +2095: - name: app_token +2097: description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" +2122: app_token: +2124: description: 多维表格的 app_token +2134: - app_token +2139: - app_token +2162: app_token: appbcbWCzen6D8dezhoCH2RpMAh +2221: /bitable/v1/apps/{app_token}: +2226: 通过 app_token 更新多维表格元数据 +2229: 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限 +2231: 此接口非原子操作,先修改多维表格名字,后开关高级权限。可能存在部分成功的情况 +2236: 可以单独修改名字或开关高级权限,请求体中不填的参数不受影响 +2258: app_token 错误 | +2270: app_token 不存在 | +2286: 多维表格未开启高级权限或不支持开启高级权限 | +2289: 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | +2309: - name: app_token +2311: description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" +2326: description: 多维表格是否开启高级权限 示例值:true +2353: app_token: +2355: description: 多维表格的 app_token +2361: description: 多维表格是否已开启高级权限 +2363: - app_token +2367: - app_token +2388: app_token: appbcbWCzen6D8dezhoCH2RpMAh +2446: /bitable/v1/apps/{app_token}/tables/{table_id}: +2477: app_token 错误 | +2489: app_token 不存在 | +2498: 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | +2506: - name: app_token +2509: 多维表格的唯一标识符 app_token 参数说明 示例值:"XrgTb4y1haKYnasu0xXb1g7lcSg" +2628: /bitable/v1/apps/{app_token}/tables: +2633: 根据 app_token,获取多维表格下的所有数据表 +2662: app_token 错误 | +2692: app_token 不存在 | +2756: 多维表格未开启高级权限或不支持开启高级权限 | +2781: - name: app_token +2783: description: bitable app token +2788: - name: page_token +2791: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 +2792: page_token 获取查询结果 示例值:"tblsRc9GRRXKqhvW" +2824: page_token: +2827: 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 +2828: page_token +2849: - page_token +2862: page_token: tblKz5D60T4JlfcT +2923: /bitable/v1/apps/{app_token}/tables: +2956: app_token 错误 | +2989: app_token 不存在 | +3053: 多维表格未开启高级权限或不支持开启高级权限 | +3078: - name: app_token +3080: description: bitable app token +3096: user_id,字段权限要求: 获取用户 user ID diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-state.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-state.txt new file mode 100644 index 0000000..c3823fb --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/scan-state.txt @@ -0,0 +1,34 @@ +86:### 3.5 事件与回调处理 +89:2. 若用 HTTP 回调模式,服务端需在 3 秒内响应。 +1838:回调结构中的 `field_value` 字段为 JSON 序列化后的字符串,序列化前的结构请查看 [数据结构](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure) +1840:## 回调示例 +16487:- SDK 支持 **基于长连接的事件回调**,详情见[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case#d286cc88)、[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +16514:- SDK 提供了简洁易懂的帮助文档。参考 SDK 文档可帮助你了解如何安装 SDK、如何通过 SDK 调用服务端 API、处理订阅的事件及回调。 +16555:使用 Go SDK 调用服务端 API、处理事件和回调前,请确保你已创建了一个应用、安装了 Go 环境和 Go SDK。本文档介绍使用 Go SDK 开发前的准备工作。 +16561:对于新手开发者,建议你直接上手体验[开发自动回复机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)或[开发卡片交互机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-a-card-interactive-bot/introduction)教程,在教程示例代码中了解如何调用 API、处理事件和回调。 +16584:- [处理回调](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-callback):介绍如何通过 SDK 封装的长连接方式处理回调、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理回调。 +16853:| 使用长连接接收事件 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的事件发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收事件回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续事件推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +16889: // 注册事件回调,OnP2MessageReceiveV1 为接收消息 v2.0;OnCustomizedEvent 内的 message 为接收消息 v1.0。 +16926: 如果是 v1.0 事件,则注册服务器时需要查找并使用 OnCustomizedEvent 方法;如果是 v2.0 事件,则注册服务器时需要查找并使用 onP2xxxx 开头的方法。例如,使用 `onP2MessageReceiveV1` 注册接收消息事件回调时,`P2`便对应的是 v2.0 版本事件结构。 +16980: // 用于签名验证和消息解密,默认可以传递为空串。但如果你在开发者后台 > 事件与回调 > 加密策略中开启了加密,则必须传递 Encrypt Key 和 Verification Token +17018:其中需要注意:EventDispatcher.newBuilder 方法的参数用于签名验证和消息解密,默认可以传递为空串。但如果你在[开发者后台](https://open.feishu.cn/app) > **事件与回调** > **加密策略**中开启了加密,则必须传递 Encrypt Key 和 Verification Token。 +17089:对于商店应用的 ISV 开发者,当需要在消息处理器内向对应企业或组织的用户发送消息时,需要先从事件回调数据中获取企业或组织 key,然后使用如下方式调用消息 API 进行消息发送。 +17141:### B.5 处理回调 +17145:# 处理回调 +17147:通过回调订阅功能,应用可以及时接收并处理飞书中特定的交互行为(例如,飞书卡片交互、链接预览等),并根据交互结果做对应的业务处理,详情参见[回调概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/callback-overview)。在应用内订阅回调时,还需要在本地服务端建立与应用的连接,以便接收回调数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理回调;你也可以选择自建 HTTP 服务器处理回调。两种方式介绍如下: +17151:| 使用长连接接收回调 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的回调发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续回调推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +17152:| 将回调发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收回调消息的服务器公网地址。后续当应用订阅的回调发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含回调数据。 | +17178:## (推荐)方式一:使用长连接接收回调 +17180:如果回调订阅方式需要选择 **使用长连接接收回调**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的回调订阅方式中保存 **使用长连接接收回调** 方式。关于应用内配置回调订阅方式的介绍,参考[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 +17191:- [消息卡片回传交互(旧)](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调不支持 **使用长连接接收回调** 订阅方式,只能选择 **将回调发送至开发者服务器** 订阅方式。 +17196:- 与 **将回调发送至开发者服务器** 方式的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成。 +17212: // 注册回调 +17241:2. 通过 eventHandler 的 OnXXXX() 方法监听不同的回调类型,上述示例中监听了[卡片回传交互](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)和 [拉取链接预览数据](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/development-link-preview/pull-link-preview-data-callback-structure) 两个回调。 +17261:## 方式二:将回调发送至开发者服务器 +17263:如果回调订阅方式选择 **将回调发送至开发者服务器**,则需要设置回调请求网址,并订阅回调。例如,你配置了可交互的飞书卡片(原消息卡片),当用户在卡片内进行交互后,飞书服务器会向请求网址回调包含 JSON 数据的 HTTP POST 请求。因此,你需要启动一个 HTTP 服务器接收回调数据。 +17273:配置卡片回调地址并订阅新版[卡片回传交互回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)后,你可以使用下面代码,对飞书开放平台推送的卡片行为进行处理,以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。关于如何完整处理卡片回调,可参考[处理卡片回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/handle-card-callbacks)。 +17316:配置卡片回调地址并订阅旧版[消息卡片回传交互](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调后,你可选择以下方式对旧版卡片回调进行处理。 +17324:- **选择一**:使用 Go SDK 原生 HTTP 服务器处理回调 +17356: 如上代码中,如果不需要处理器内返回业务结果至飞书服务端,则直接使用示例中的无返回值用法。如需了解其他卡片回调示例,参见 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/card/card.go)。 +17358:- **选择二**:集成 Gin 框架处理回调: +17397:- **选择三**:集成 hertz 框架处理回调:详情参考[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-end.md b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-end.md new file mode 100644 index 0000000..bef3c01 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-end.md @@ -0,0 +1,240 @@ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + WriteResponse: writeSpreadsheetResp.Data, + }, nil +} +``` + +## [下载指定范围单元格的所有素材列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/download_media_by_range.go) + +下载指定范围单元格的所有素材列表,使用到两个OpenAPI:[读取单个范围](https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN)和[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download): + +``` +package sheets + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1" +) + +type DownloadMediaByRangeRequest struct { + SpreadsheetToken string + Range string +} + +type DownloadMediaByRangeResponse struct { + *larkcore.CodeError + ReadResponse *SpreadsheetRespData + DownloadMediaResponse []*larkdrive.DownloadMediaResp +} + +func DownloadMediaByRange(client *lark.Client, request *DownloadMediaByRangeRequest) (*DownloadMediaByRangeResponse, error) { + // 读取单个范围 + readResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values/%s", request.SpreadsheetToken, request.Range), + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + readSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(readResp.RawBody, readSpreadsheetResp) + if err != nil { + return nil, err + } + readSpreadsheetResp.ApiResp = readResp + if readSpreadsheetResp.Code != 0 { + fmt.Printf("read spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + readSpreadsheetResp.Code, readSpreadsheetResp.Msg, readSpreadsheetResp.RequestId()) + return nil, readSpreadsheetResp.CodeError + } + + // 下载文件 + files := make([]*larkdrive.DownloadMediaResp, 0) + values := readSpreadsheetResp.Data.ValueRange.Values + tokens := parseFileToken(values, make(map[string]bool)) + for _, token := range tokens { + downloadMediaReq := larkdrive.NewDownloadMediaReqBuilder(). + FileToken(token). + Build() + + downloadMediaResp, err := client.Drive.Media.Download(context.Background(), downloadMediaReq) + if err != nil { + return nil, err + } + if !downloadMediaResp.Success() { + fmt.Printf("client.Drive.Media.Download failed, code: %d, msg: %s, log_id: %s\n", + downloadMediaResp.Code, downloadMediaResp.Msg, downloadMediaResp.RequestId()) + return nil, downloadMediaResp.CodeError + } + + files = append(files, downloadMediaResp) + } + + // 返回结果 + return &DownloadMediaByRangeResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + DownloadMediaResponse: files, + }, nil +} + +func parseFileToken(values []interface{}, tokens map[string]bool) []string { + if len(values) == 0 { + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res + } + for _, i := range values { + kind := reflect.TypeOf(i).Kind() + if kind == reflect.Slice { + parseFileToken(i.([]interface{}), tokens) + } else if kind == reflect.Map { + m := i.(map[string]interface{}) + if val, ok := m["fileToken"]; ok { + tokens[val.(string)] = true + } + } + } + + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res +} +``` + + +--- + +### B.7 常见问题 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518657.md` + +# 常见问题 + +本文档汇集使用服务端 SDK 可能出现的常见问题与解决方案。 + +### API 调试台内获取 tenant_access_token/app_access_token 的示例代码,为什么提示找不到方法? + +服务端 SDK 内已经封装了获取和缓存 tenant_access_token/app_access_token 的逻辑,在构建 API Client 时传入应用的 App ID 和 App Secret 即可,不需要手动获取 Token。 + +### API 调试台内成功调用 API 后,使用示例代码调用失败是什么原因? + +API 调试台中的示例代码是根据调试台内设置的参数自动生成的,如果存在代码问题,请先在调试台内配置好参数再使用代码,同时注意应用的 App ID 和 App Secret 需要手动配置。 + + + +![img](offline-docs-v2/assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png) + + + +应用的 App ID 和 App Secret 需登录[开发者后台](https://open.feishu.cn/app),在应用详情页的 **凭证与基础信息** > **应用凭证** 区域获取。 + + + +![img](offline-docs-v2/assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png) + + + +### 如何查看某个接口在 SDK 是否支持? + +你可以直接查询接口文档,例如[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create),有如下图所示的 **尝试一下** 按钮表示支持(不支持的 API 没有该按钮)。 + + + +![img](offline-docs-v2/assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png) + + + +点击按钮后可以调试 API、查阅示例代码。 + + + +![img](offline-docs-v2/assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png) + + + +### SDK 不支持直接调用的接口、历史版本的接口,如何才能调用? + +不同语言的 SDK 均提供了原生 API 调用方式,使用该方式可以通过传入 API 的 HTTP Method、URL 以及参数来调用。具体操作参见各 SDK 使用指南。 + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 使用下载导出文件接口时,文件名包含特殊字符导致下载报错如何解决? + +系统逻辑存在特殊字符校验,你可以先使用 SDK 提供的原生模式调用 API。详情参考: + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 如何配置私有部署的飞书服务器或者代理服务器连接? + +Java 示例代码以及配置说明,参考以下代码注释。 + +``` +import com.lark.oapi.Client; +import com.lark.oapi.core.cache.LocalCache; +import com.lark.oapi.core.enums.BaseUrlEnum; +import com.lark.oapi.core.httpclient.OkHttpTransport; +import com.lark.oapi.core.response.RawResponse; +import com.lark.oapi.core.token.AccessTokenType; +import com.lark.oapi.okhttp.OkHttpClient; +import java.net.Proxy; +import java.util.concurrent.TimeUnit; +@Test +void init() { + Proxy proxy = Proxy.NO_PROXY; // 自定义代理服务器 + Client client = Client.newBuilder("appId", "appSecret") + .openBaseUrl(BaseUrlEnum.FeiShu) // 设置域名,默认为飞书,支持重载String,设置私有部署飞书服务器 + .httpTransport(new OkHttpTransport( + new OkHttpClient().newBuilder() + .readTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .callTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .proxy(proxy) // 设置使用代理服务器访问飞书服务器 + .build() + )) + .tokenCache(LocalCache.getInstance()) // 默认实现,本地带时间过期的缓存;可以自己实现ICache的接口,例如Redis缓存等 + .logReqAtDebug(true) // 在 debug 模式下会打印 http 请求和响应的 headers,body 等信息。 + .build(); +} +``` + +### 调用接口失败,有 code 和 logid 该如何排查? + +- 方式一:打开[飞书开发文档](https://open.larkoffice.com/document/home/index),在搜索栏输入错误码(code)或者日志 ID(logid)查询。 + + + + ![img](offline-docs-v2/assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png) + + + +- 方式二:如果问题始终无法解决,请咨询[技术支持](https://applink.feishu.cn/TLJpeNdW)。 + +### 接收事件时为什么重复收到事件体数据? + +开放平台推送事件数据后,你的服务器需要在 3 秒内以 HTTP 200 状态码进行响应,否则开放平台认为本次推送失败,并会重新推送事件数据。详情参见[事件推送周期和频次](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM#9cd4c9b1)。 + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-mid.md b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-mid.md new file mode 100644 index 0000000..4041b3a --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-mid.md @@ -0,0 +1,240 @@ + - table_id + - record_ids + - text + - type + 多行文本: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + mentionType: + type: string + mentionNotify: + type: boolean + name: + type: string + token: + type: string + link: + type: string + required: + - text + - type + - mentionType + - token + - link + x-apifox-orders: + - text + - type + - mentionType + - mentionNotify + - name + - token + - link + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + required: + - has_more + - items + - page_token + - total + x-apifox-orders: + - has_more + - items + - page_token + - total + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + has_more: false + items: + - fields: + 人力耗时: '64' + 人力评估: '8' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 我是最大的功能开发🥕 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + name: 2.gif + size: 10250625 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnkQWfV4XbHwzDngmezMGzXe + type: image/gif + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnkQWfV4XbHwzDngmezMGzXe/download + 对应 OKR: + - text: 新功能评审 + type: text + 截止日期: 1612108800000 + 文档地址: + link: https://bytedance.feishu.cn/drive/home/ + text: 文档备份 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: recn0hoyXL + - fields: + 人力耗时: '16' + 人力评估: '2' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 新功能评审 + 任务附件: + - file_token: boxcnGk0FfG678EEurDN7dRyxag + name: Hawaii_1_15Retina_R.jpg + size: 5069121 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnGk0FfG678EEurDN7dRyxag + type: image/jpeg + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnGk0FfG678EEurDN7dRyxag/download + 对应 OKR: + - text: 我是最大的功能开发🥕 + type: text + 截止日期: 1612368000000 + 文档地址: + link: https://www.baidu.com/ + text: 百度一下,你就知道 + 是否完成: true + 状态: 未进行 + 相关部门: + - 产品 + - 设计 + - 研发 + 多行文本: + - text: hello + type: text + - mentionType: User + mentionNotify: false + name: test + text: '@test' + token: ou_sfsdfsdfsdfsdfdsfsdfdsf + type: mention + - link: >- + https://test-sasdfsfsd.feishu-boe.cn/base/basbcq2aFvW8nFJpfOXa1111111 + mentionType: Bitable + text: 未命名多维表格 + token: basbcq2aFvW8nFJpfOXalx57ffb + type: mention + - text: 测试链接标题 + link: https://www.baidu.com/ + type: url + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: reciKaDyVO + page_token: reciKaDyVO + total: 2 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020910-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-start.md b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-start.md new file mode 100644 index 0000000..f16040f --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/snippet-start.md @@ -0,0 +1,180 @@ +# 飞书多维表格开发文档-完整参考 v2(完全离线版) + +## 1. 版本说明 + +- 生成时间:2026-03-23 10:36:14 +- 目标:提供不依赖在线链接的本地离线资料包(Bitable 全子页 + Go SDK 指南 + Go SDK 示例代码)。 +- 文档位置:`offline-docs-v2` 目录。 + +## 2. 离线资料目录 + +```text +offline-docs-v2/ + sources/ + bitable-md/ # 多维表格文档与全部 API 子页原文(49页) + go-sdk-md/ # Golang SDK 指南原文(7页) + go-sdk-examples/ + oapi-sdk-go/ # 官方 Go SDK 仓库(离线) + oapi-sdk-go-demo/ # 官方场景示例仓库(离线) + bitablev1-curated/ # 与 Bitable 直接相关的精选示例 + manifest.csv # 文档索引清单 +``` + +## 3. Golang SDK 调用说明(基于 API 参考文档整理) + +### 3.1 安装与初始化 + +```bash +go get -u github.com/larksuite/oapi-sdk-go/v3@latest +``` + +```go +client := lark.NewClient("appID", "appSecret", + // lark.WithMarketplaceApp(), // 商店应用时启用 + lark.WithEnableTokenCache(true), // 默认启用 +) +``` + +关键点: +1. SDK 已托管 tenant_access_token/app_access_token 的获取与缓存(可关闭后手动传 token)。 +2. 用户态调用用 `larkcore.WithUserAccessToken(...)`。 +3. 商店应用调用需补 `larkcore.WithTenantKey(...)`。 + +### 3.2 Bitable v1 调用范式 + +SDK 方法映射规则:`client.Bitable.V1.<资源>.<动作>`。 + +```go +req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken("app_token"). + TableId("table_id"). + PageSize(20). + Build() + +resp, err := client.Bitable.V1.AppTableRecord.List(context.Background(), req) +if err != nil { + panic(err) +} +if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return +} +fmt.Println(larkcore.Prettify(resp.Data)) +``` + +### 3.3 请求级选项 + +1. `larkcore.WithUserAccessToken(...)`:用户态调用。 +2. `larkcore.WithTenantAccessToken(...)`:手动传租户 token。 +3. `larkcore.WithTenantKey(...)`:商店应用必须设置。 +4. `larkcore.WithHeaders(...)`:透传自定义 Header。 + +### 3.4 历史/未封装 API 的原生调用 + +当 SDK 暂未提供强类型方法时,可用 `client.Do()`: + +```go +resp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/contact/v3/users/:user_id", + PathParams: larkcore.PathParams{"user_id": "ou_xxx"}, + QueryParams: larkcore.QueryParams{"user_id_type": []string{"open_id"}}, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}, +}) +``` + +### 3.5 事件与回调处理 + +1. 推荐优先使用 SDK 长连接模式(WebSocket),本地开发可免内网穿透。 +2. 若用 HTTP 回调模式,服务端需在 3 秒内响应。 +3. 长连接模式是集群分发,不是广播;同应用多实例时由其中一个实例消费。 + +### 3.6 本地 Go 示例代码位置 + +1. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/apiall/bitablev1/`(Bitable v1 全量 API 样例) +2. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/api/bitable2.go`(复杂字段示例) +3. `offline-docs-v2/go-sdk-examples/oapi-sdk-go-demo/`(官方场景化 Demo) +4. `offline-docs-v2/go-sdk-examples/bitablev1-curated/`(精选拷贝,便于直接查看) + +## 4. 附录 A:Bitable 文档原文(离线) + +--- + +### A.1 概述 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436424.md` + +# 概述 + +多维表格是一个表格,也是无数个应用,千人千面,万人万解。 + +## 资源:多维表格应用 App + +每个多维表格都有唯一 app_token 作为标识。(这里的 app 指一个多维表格,而不是指开发者创建的应用) + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| app_token | string | 一个多维表格的唯一标识。 **示例值**:"bascnKMKGS5oD3lmCHq9euO8cGh"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [获取多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get)`GET` /open-apis/bitable/v1/apps/:app_token | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)`PUT` /open-apis/bitable/v1/apps/:app_token | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:数据表 Table + +多维表格的数据容器,一个多维表格中至少有一个数据表,也可能有多个数据表。每个数据表都有唯一标识 table_id。table_id 在一个多维表格 App 中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| -------- | ------ | ------------------------------------------------------------ | +| table_id | string | 一个数据表的唯一标识。 **示例值**:"tblTONn0A0CbGRDX"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:视图 View + +数据表的呈现布局。一个数据表至少有一个视图,可能有多个视图。每个视图都有唯一标识 view_id,view_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| ------- | ------ | ------------------------------------------------------------ | +| view_id | string | 一个视图的唯一标识。 **示例值**:"vewhNUNwqB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:记录 Record + +数据表中的每一行数据都是 Record。每条记录都有唯一标识 record_id,record_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| record_id | string | 一行记录的唯一标识。 **示例值**:"recn0hoyXL"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/toc.txt b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/toc.txt new file mode 100644 index 0000000..a540498 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/tmp-dds-scan/toc.txt @@ -0,0 +1,331 @@ +1:# 飞书多维表格开发文档-完整参考 v2(完全离线版) +3:## 1. 版本说明 +9:## 2. 离线资料目录 +23:## 3. Golang SDK 调用说明(基于 API 参考文档整理) +25:### 3.1 安装与初始化 +43:### 3.2 Bitable v1 调用范式 +65:### 3.3 请求级选项 +72:### 3.4 历史/未封装 API 的原生调用 +86:### 3.5 事件与回调处理 +92:### 3.6 本地 Go 示例代码位置 +99:## 4. 附录 A:Bitable 文档原文(离线) +103:### A.1 概述 +107:# 概述 +111:## 资源:多维表格应用 App +115:### 字段说明 +121:### 方法列表 +130:## 资源:数据表 Table +134:### 字段说明 +140:### 方法列表 +152:## 资源:视图 View +156:### 字段说明 +162:### 方法列表 +172:## 资源:记录 Record +176:### 字段说明 +182:### 方法列表 +197:## 资源:字段 Field +201:### 字段说明 +207:### 方法列表 +218:## 资源:自定义权限 Role +222:### 字段说明 +228:### 方法列表 +239:## 资源:自定义权限的协作者 Member +243:### 字段说明 +249:### 方法列表 +264:### A.2 接入指南 +268:# 接入指南 +272:## 1.形态 +292:## 2.内容 +311:## 3.鉴权 +375:## 4.限制 +377:### QPS 限制 +382:### 接口报错 +386:## 5.字段类型 +395:## 6.参数说明 +399:### app_token +401:#### Bitable app +405:#### Bitable doc block +421:#### Bitable sheet block +442:### table_id +444:#### Bitable app +449:### view_id +454:### record_id +458:### field_id +462:### role_id +466:### member_id +475:### A.3 数据结构 +479:# 数据结构 +487:## 记录 +491:### record结构 +500:### fields结构 +509:#### value结构(不同字段类型对应值的结构) +532:##### 人员 +541:##### 超链接 +548:##### 附件 +559:##### 地理位置 +571:## 字段 +582:### Property说明 +586:## 视图 +596:## 自定义数据结构 +598:### delete_record +610:### A.4 记录筛选开发指南 +614:# 记录筛选开发指南 +618:## 注意事项 +626:## 常用筛选公式 +641:## 常用的逻辑表达式 +651:## 常用的日期表达式 +685:## 字段筛选示例 +713:### A.5 字段编辑指南 +717:# 字段编辑指南 +719:## 字段概述 +734:## Property说明 +738:### 数字字段 +740:#### Property结构 +746:#### 网页中数字格式与formatter的对应关系 +764:#### 新增、更新字段的请求体示例 +776:#### 响应体示例 +795:### 单选、多选字段 +797:#### Property结构 +806:#### 新增字段的请求体示例 +832:#### 响应体示例 +872:#### 更新字段的请求体示例 +901:#### 响应体示例 +938:### 日期字段 +940:#### Property结构 +947:#### 网页中日期格式与date_formatter的对应关系 +959:#### 新增、更新字段的请求体示例 +972:#### 响应体示例 +992:### 人员字段 +994:#### Property结构 +1000:#### 新增、更新字段的请求体示例 +1012:#### 响应体示例 +1031:### 单向关联字段 +1033:#### Property结构 +1041:#### 新增、更新字段的请求体示例 +1054:#### 响应体示例 +1075:### 双向关联字段 +1077:#### Property结构 +1087:#### 新增、更新字段的请求体示例 +1101:#### 响应体示例 +1124:### 公式字段 +1126:#### Property结构 +1133:#### 网页中公式格式与formatter的对应关系 +1154:#### 新增、更新字段的请求体示例 +1167:#### 响应体示例 +1187:### 创建时间、最后更新时间字段 +1189:#### Property结构 +1195:#### 新增、更新字段的请求体示例 +1207:#### 响应体示例 +1226:### 自动编号字段 +1228:#### Property结构 +1239:#### 网页中编号类型与auto_serial_type的对应关系 +1246:#### 网页中编号规则与rule_option_type的对应关系 +1254:#### 网页中创建日期与created_time的对应关系 +1265:#### 新增字段的请求体示例 +1294:#### 响应体示例 +1329:#### 新增字段的请求体示例 +1344:#### 响应体示例 +1370:### A.6 附件字段说明 +1374:# 附件字段说明 +1378:## 数据结构 +1406:## 上传附件 +1481:## 下载附件 +1541:### A.7 概述 +1545:# 概述 +1551:## 注意事项 +1567:## 方法列表 +1569:### 设置自定义角色 +1580:### 管理自定义角色的协作者 +1595:### A.8 多维表格字段变更 +1599:# 多维表格字段变更 +1609:## 事件 +1619:### 事件体 +1699:### 事件体示例 +1811:### A.9 多维表格记录变更 +1815:# 多维表格记录变更 +1821:## 概述 +1830:## 支持的记录变更类型 +1840:## 回调示例 +1932:### A.10 获取多维表格元数据 +1936:# 获取多维表格元数据 +1938:## OpenAPI Specification +2206:### A.11 更新多维表格元数据 +2210:# 更新多维表格元数据 +2212:## OpenAPI Specification +2431:### A.12 更新数据表 +2435:# 更新数据表 +2437:## OpenAPI Specification +2613:### A.13 列出数据表 +2617:# 列出数据表 +2619:## OpenAPI Specification +2908:### A.14 新增数据表 +2912:# 新增数据表 +2914:## OpenAPI Specification +3197:### A.15 新增多个数据表 +3201:# 新增多个数据表 +3203:## OpenAPI Specification +3491:### A.16 删除一个数据表 +3495:# 删除一个数据表 +3497:## OpenAPI Specification +3746:### A.17 删除多个数据表 +3750:# 删除多个数据表 +3752:## OpenAPI Specification +4014:### A.18 复制仪表盘 +4018:# 复制仪表盘 +4020:## OpenAPI Specification +4374:### A.19 列出仪表盘 +4378:# 列出仪表盘 +4380:## OpenAPI Specification +4700:### A.20 更新视图 +4704:# 更新视图 +4706:## OpenAPI Specification +5160:### A.21 检索视图 +5164:# 检索视图 +5166:## OpenAPI Specification +5551:### A.22 列出视图 +5555:# 列出视图 +5557:## OpenAPI Specification +5875:### A.23 新增视图 +5879:# 新增视图 +5881:## OpenAPI Specification +6217:### A.24 删除视图 +6221:# 删除视图 +6223:## OpenAPI Specification +6502:### A.25 更新表单元数据 +6506:# 更新表单元数据 +6508:## OpenAPI Specification +6863:### A.26 获取表单元数据 +6867:# 获取表单元数据 +6869:## OpenAPI Specification +7208:### A.27 更新表单问题 +7212:# 更新表单问题 +7214:## OpenAPI Specification +7572:### A.28 列出表单问题 +7576:# 列出表单问题 +7578:## OpenAPI Specification +7926:### A.29 检索记录 +7930:# 检索记录 +7932:## OpenAPI Specification +8506:### A.30 列出记录 +8510:# 列出记录 +8512:## OpenAPI Specification +9245:### A.31 新增记录 +9249:# 新增记录 +9251:## OpenAPI Specification +9819:### A.32 更新记录 +9823:# 更新记录 +9825:## OpenAPI Specification +10285:### A.33 删除记录 +10289:# 删除记录 +10291:## OpenAPI Specification +10609:### A.34 新增多条记录 +10613:# 新增多条记录 +10615:## OpenAPI Specification +11197:### A.35 更新多条记录 +11201:# 更新多条记录 +11203:## OpenAPI Specification +11741:### A.36 删除多条记录 +11745:# 删除多条记录 +11747:## OpenAPI Specification +12086:### A.37 列出字段 +12090:# 列出字段 +12092:## OpenAPI Specification +12655:### A.38 新增字段 +12659:# 新增字段 +12661:## OpenAPI Specification +13125:### A.39 更新字段 +13129:# 更新字段 +13131:## OpenAPI Specification +13596:### A.40 删除字段 +13600:# 删除字段 +13602:## OpenAPI Specification +13935:### A.41 列出自定义角色 +13939:# 列出自定义角色 +13941:## OpenAPI Specification +14354:### A.42 新增自定义角色 +14358:# 新增自定义角色 +14360:## OpenAPI Specification +14654:### A.43 删除自定义角色 +14658:# 删除自定义角色 +14660:## OpenAPI Specification +14835:### A.44 更新自定义角色 +14839:# 更新自定义角色 +14841:## OpenAPI Specification +15373:### A.45 批量删除协作者 +15377:# 批量删除协作者 +15379:## OpenAPI Specification +15574:### A.46 批量新增协作者 +15578:# 批量新增协作者 +15580:## OpenAPI Specification +15781:### A.47 列出协作者 +15785:# 列出协作者 +15787:## OpenAPI Specification +16066:### A.48 新增协作者 +16070:# 新增协作者 +16072:## OpenAPI Specification +16277:### A.49 删除协作者 +16281:# 删除协作者 +16283:## OpenAPI Specification +16471:## 5. 附录 B:Golang SDK 指南原文(离线) +16475:### B.1 服务端 SDK +16479:# 服务端 SDK +16522:## 源码地址 +16533:## SDK 问题交流群 +16541:## 相关文档 +16549:### B.2 开发前准备 +16553:# 开发前准备 +16564:## 创建应用 +16568:## 准备开发环境 +16572:## 安装 Go SDK +16580:## 后续操作 +16590:### B.3 调用服务端 API +16594:# 调用服务端 API +16604:## 步骤一:构建 API Client +16646:## 步骤二:构造 API 请求 +16706:## (可选)步骤三:设置请求选项 +16762:## 步骤四:运行代码 +16776:## 常见问题 +16778:### 如何调用历史版本 API ? +16822:### 如何快速获取接口对应的示例代码? +16832:### 如何准确选择 API 方法? +16843:### B.4 处理事件 +16847:# 处理事件 +16856:## (推荐)方式一:使用长连接接收事件 +16866:### 注意事项 +16875:### 长连接代码 +16952:## 方式二:将事件发送至开发者服务器 +16962:### 选择一:使用 Go SDK 原生 HTTP 服务器处理事件 +17028:### 选择二:集成 Gin 框架处理事件 +17079:### 选择三:集成 hertz 框架处理事件 +17083:## (可选)在消息处理器内向对应用户发送消息 +17141:### B.5 处理回调 +17145:# 处理回调 +17154:## 注意事项 +17178:## (推荐)方式一:使用长连接接收回调 +17188:### 使用限制 +17194:### 注意事项 +17199:### 长连接代码 +17261:## 方式二:将回调发送至开发者服务器 +17271:### 基于新版卡片回传交互处理 +17314:### 基于旧版卡片回传交互处理 +17399:## (可选)返回卡片消息 +17437:## (可选)返回自定义消息 +17482:## (可选)在卡片行为处理器内向对应用户发送消息 +17533:### B.6 场景示例 +17537:# 场景示例 +17541:## [发送文件消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_file.go) +17633:## [发送图片消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_image.go) +17720:## [获取部门下所有用户列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/contact/list_user_by_department.go) +17803:## [创建多维表格同时添加数据表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/base/create_app_and_tables.go) +17886:## [复制粘贴某个范围的单元格数据](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/copy_and_paste_by_range.go) +17980:## [下载指定范围单元格的所有素材列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/download_media_by_range.go) +18097:### B.7 常见问题 +18101:# 常见问题 +18105:### API 调试台内获取 tenant_access_token/app_access_token 的示例代码,为什么提示找不到方法? +18109:### API 调试台内成功调用 API 后,使用示例代码调用失败是什么原因? +18127:### 如何查看某个接口在 SDK 是否支持? +18145:### SDK 不支持直接调用的接口、历史版本的接口,如何才能调用? +18154:### 使用下载导出文件接口时,文件名包含特殊字符导致下载报错如何解决? +18163:### 如何配置私有部署的飞书服务器或者代理服务器连接? +18195:### 调用接口失败,有 code 和 logid 该如何排查? +18207:### 接收事件时为什么重复收到事件体数据? diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/金山多维表格-结构.md b/18-基础架构及交付部署特战队/10-飞书多维表格/金山多维表格-结构.md new file mode 100644 index 0000000..a860b07 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/金山多维表格-结构.md @@ -0,0 +1,146 @@ +# 金山多维表格 - 结构定义 + +本文件记录了金山多维表格中各业务表的结构定义。 + +--- + +## 1. 项目基本信息表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 项目名称 | MultiLineText | | | true | true | FieldDescriptors+GetFields | +| 行业组接口人 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 行业组接口人电话 | Phone | | | false | true | FieldDescriptors+GetFields | +| 项目性质 | SingleSelect | | 试用 | false | true | FieldDescriptors+GetFields | +| 部署飞服平台 | SingleSelect | | | false | true | FieldDescriptors+GetFields | +| 飞服平台版本 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 部署监管平台 | SingleSelect | | | false | true | FieldDescriptors+GetFields | +| 监管平台版本 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 部署AI能力 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 期望部署优先级 | SingleSelect | | | false | true | FieldDescriptors+GetFields | +| 期望部署日期 | Date | | | false | true | FieldDescriptors+GetFields | +| 是否需要出差 | SingleSelect | | 不需要 | false | true | FieldDescriptors+GetFields | +| 部署资源信息 | Attachment | | | false | true | FieldDescriptors+GetFields | +| 特殊要求备注 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 项目本地化部署升级信息表 | OneWayLink | | | false | false | FieldDescriptors+GetFields | +| 项目本地化部署状态表 | Link | | | false | false | FieldDescriptors+GetFields | +| 填写ID | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 提交时间 | Date | | | false | true | FieldDescriptors+GetFields | +| 答题时间(秒) | Number | | | false | true | FieldDescriptors+GetFields | +| 提交者 | Contact | | | false | true | FieldDescriptors+GetFields | + +--- + +## 2. 项目本地化部署升级信息表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 项目名称 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 关联项目 | OneWayLink | | | false | false | FieldDescriptors+GetFields | +| 期望升级开始时间 | Date | | | false | true | FieldDescriptors+GetFields | +| 部署资源信息 | Attachment | | | false | true | FieldDescriptors+GetFields | +| 项目本地化部署状态表 | Link | | | false | false | FieldDescriptors+GetFields | +| 升级飞服平台 | SingleSelect | | | false | true | FieldDescriptors+GetFields | +| 升级飞服版本 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 升级监管平台 | SingleSelect | | | false | true | FieldDescriptors+GetFields | +| 升级监管版本 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 备注 | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 填写ID | MultiLineText | | | false | true | FieldDescriptors+GetFields | +| 提交时间 | Date | | | false | true | FieldDescriptors+GetFields | +| 答题时间(秒) | Number | | | false | true | FieldDescriptors+GetFields | +| 提交者 | Contact | | | false | true | FieldDescriptors+GetFields | + +--- + +## 3. 项目本地化部署状态表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 项目名称 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 部署平台 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 部署编号 | CustomAutoNumber | | | false | false | FieldDescriptors+GetFields | +| 关联项目 | Link | | | false | false | FieldDescriptors+GetFields | +| 关联升级记录 | Link | | | false | false | FieldDescriptors+GetFields | +| 来源类型 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 部署状态 | SingleSelect | | 排期中 | false | false | FieldDescriptors+GetFields | +| 部署结果 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 部署优先级 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 当前进度 | Formula | | | false | false | FieldDescriptors+GetFields | +| 命名空间 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 计划开始时间 | Date | | | false | false | FieldDescriptors+GetFields | +| 计划结束时间 | Date | | | false | false | FieldDescriptors+GetFields | +| 实际开始时间 | Date | | | false | false | FieldDescriptors+GetFields | +| 实际结束时间 | Date | | | false | false | FieldDescriptors+GetFields | +| 部署负责人 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 部署人电话 | Phone | | | false | false | FieldDescriptors+GetFields | +| 部署人员-金山 | Contact | | | false | false | FieldDescriptors+GetFields | +| 备注 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 项目部署环境信息表 | Link | | | false | false | FieldDescriptors+GetFields | +| 项目部署网络信息表 | Link | | | false | false | FieldDescriptors+GetFields | +| 项目部署中间件信息表 | Link | | | false | false | FieldDescriptors+GetFields | +| 项目部署业务信息表 | Link | | | false | false | FieldDescriptors+GetFields | +| 需求来源人-金山 | Contact | | | false | false | FieldDescriptors+GetFields | +| 需求来源人 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 创建部署信息 | Button | | | false | false | FieldDescriptors+GetFields | +| 查询数据编号 | MultiLineText | | | false | false | FieldDescriptors+GetFields | + +--- + +## 4. 项目部署环境信息表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 项目名称 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 公网IP | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 能否访问公网 | Checkbox | | | false | false | FieldDescriptors+GetFields | +| 内网IP | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| SSH端口 | Number | | | false | false | FieldDescriptors+GetFields | +| SSH用户名 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 主机功能 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| CPU架构 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 操作系统 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| CPU核心数 | Number | | | false | false | FieldDescriptors+GetFields | +| CPU型号 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 内存大小(GB) | Number | | | false | false | FieldDescriptors+GetFields | +| 系统盘大小(GB) | Number | | | false | false | FieldDescriptors+GetFields | +| 数据盘大小(GB) | Number | | | false | false | FieldDescriptors+GetFields | +| GPU信息 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 备注信息 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 所属部署 | Link | | | false | false | FieldDescriptors+GetFields | + +--- + +## 5. 项目部署网络信息表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 访问地址 | Url | | | false | false | FieldDescriptors+GetFields | +| 项目名称 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 是否开启SSL | Checkbox | | | false | false | FieldDescriptors+GetFields | +| 端口信息说明 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 网络环境 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 主机管理方式 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 管理后台地址 | Url | | | false | false | FieldDescriptors+GetFields | +| VPN下载地址 | Url | | | false | false | FieldDescriptors+GetFields | +| VPN账号信息存储位置 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 备注 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 所属部署 | Link | | | false | false | FieldDescriptors+GetFields | + +--- + +## 6. 项目部署中间件信息表 + +| 字段名称 | 字段类型 | 字段描述 | 默认值 | 唯一值 | 同步字段 | 定义来源 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 项目名称 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 所属部署 | Link | | | false | false | FieldDescriptors+GetFields | +| 中间件类型 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 中间件版本 | MultiLineText | | | false | false | FieldDescriptors+GetFields | +| 部署方式 | SingleSelect | | | false | false | FieldDescriptors+GetFields | +| 存储大小(GB) | Number | | | false | false | FieldDescriptors+GetFields | +| 备注 | MultiLineText | | | false | false | FieldDescriptors+GetFields | + +--- + +> [!NOTE] +> 为了保持表格简洁且易于阅读,已省略 `字段完整定义JSON` 和 `GetFields原始JSON` 两个技术字段。如需查看完整的 JSON 定义,请参考原始文档或系统导出的 TSV 数据。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考-v2.md b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考-v2.md new file mode 100644 index 0000000..cb03cd1 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考-v2.md @@ -0,0 +1,18211 @@ +# 飞书多维表格开发文档-完整参考 v2(完全离线版) + +## 1. 版本说明 + +- 生成时间:2026-03-23 10:36:14 +- 目标:提供不依赖在线链接的本地离线资料包(Bitable 全子页 + Go SDK 指南 + Go SDK 示例代码)。 +- 文档位置:`offline-docs-v2` 目录。 + +## 2. 离线资料目录 + +```text +offline-docs-v2/ + sources/ + bitable-md/ # 多维表格文档与全部 API 子页原文(49页) + go-sdk-md/ # Golang SDK 指南原文(7页) + go-sdk-examples/ + oapi-sdk-go/ # 官方 Go SDK 仓库(离线) + oapi-sdk-go-demo/ # 官方场景示例仓库(离线) + bitablev1-curated/ # 与 Bitable 直接相关的精选示例 + manifest.csv # 文档索引清单 +``` + +## 3. Golang SDK 调用说明(基于 API 参考文档整理) + +### 3.1 安装与初始化 + +```bash +go get -u github.com/larksuite/oapi-sdk-go/v3@latest +``` + +```go +client := lark.NewClient("appID", "appSecret", + // lark.WithMarketplaceApp(), // 商店应用时启用 + lark.WithEnableTokenCache(true), // 默认启用 +) +``` + +关键点: +1. SDK 已托管 tenant_access_token/app_access_token 的获取与缓存(可关闭后手动传 token)。 +2. 用户态调用用 `larkcore.WithUserAccessToken(...)`。 +3. 商店应用调用需补 `larkcore.WithTenantKey(...)`。 + +### 3.2 Bitable v1 调用范式 + +SDK 方法映射规则:`client.Bitable.V1.<资源>.<动作>`。 + +```go +req := larkbitable.NewListAppTableRecordReqBuilder(). + AppToken("app_token"). + TableId("table_id"). + PageSize(20). + Build() + +resp, err := client.Bitable.V1.AppTableRecord.List(context.Background(), req) +if err != nil { + panic(err) +} +if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.RequestId()) + return +} +fmt.Println(larkcore.Prettify(resp.Data)) +``` + +### 3.3 请求级选项 + +1. `larkcore.WithUserAccessToken(...)`:用户态调用。 +2. `larkcore.WithTenantAccessToken(...)`:手动传租户 token。 +3. `larkcore.WithTenantKey(...)`:商店应用必须设置。 +4. `larkcore.WithHeaders(...)`:透传自定义 Header。 + +### 3.4 历史/未封装 API 的原生调用 + +当 SDK 暂未提供强类型方法时,可用 `client.Do()`: + +```go +resp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/contact/v3/users/:user_id", + PathParams: larkcore.PathParams{"user_id": "ou_xxx"}, + QueryParams: larkcore.QueryParams{"user_id_type": []string{"open_id"}}, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}, +}) +``` + +### 3.5 事件与回调处理 + +1. 推荐优先使用 SDK 长连接模式(WebSocket),本地开发可免内网穿透。 +2. 若用 HTTP 回调模式,服务端需在 3 秒内响应。 +3. 长连接模式是集群分发,不是广播;同应用多实例时由其中一个实例消费。 + +### 3.6 本地 Go 示例代码位置 + +1. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/apiall/bitablev1/`(Bitable v1 全量 API 样例) +2. `offline-docs-v2/go-sdk-examples/oapi-sdk-go/sample/api/bitable2.go`(复杂字段示例) +3. `offline-docs-v2/go-sdk-examples/oapi-sdk-go-demo/`(官方场景化 Demo) +4. `offline-docs-v2/go-sdk-examples/bitablev1-curated/`(精选拷贝,便于直接查看) + +## 4. 附录 A:Bitable 文档原文(离线) + +--- + +### A.1 概述 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436424.md` + +# 概述 + +多维表格是一个表格,也是无数个应用,千人千面,万人万解。 + +## 资源:多维表格应用 App + +每个多维表格都有唯一 app_token 作为标识。(这里的 app 指一个多维表格,而不是指开发者创建的应用) + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| app_token | string | 一个多维表格的唯一标识。 **示例值**:"bascnKMKGS5oD3lmCHq9euO8cGh"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [获取多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get)`GET` /open-apis/bitable/v1/apps/:app_token | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)`PUT` /open-apis/bitable/v1/apps/:app_token | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:数据表 Table + +多维表格的数据容器,一个多维表格中至少有一个数据表,也可能有多个数据表。每个数据表都有唯一标识 table_id。table_id 在一个多维表格 App 中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| -------- | ------ | ------------------------------------------------------------ | +| table_id | string | 一个数据表的唯一标识。 **示例值**:"tblTONn0A0CbGRDX"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除多个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:视图 View + +数据表的呈现布局。一个数据表至少有一个视图,可能有多个视图。每个视图都有唯一标识 view_id,view_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| ------- | ------ | ------------------------------------------------------------ | +| view_id | string | 一个视图的唯一标识。 **示例值**:"vewhNUNwqB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:记录 Record + +数据表中的每一行数据都是 Record。每条记录都有唯一标识 record_id,record_id 在一个多维表格中唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| record_id | string | 一行记录的唯一标识。 **示例值**:"recn0hoyXL"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除多条记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:字段 Field + +多维表格的字段。每个字段都有唯一标识 field_id,field_id 在一个多维表格内唯一,在全局不一定唯一。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| -------- | ------ | ------------------------------------------------------------ | +| field_id | string | 一列字段的唯一标识。 **示例值**:"fldwJ4YrtB"**字段权限要求(任选其一)**: 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)`GET` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论和导出多维表格查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create)`POST` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update)`PUT` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/tables/:table_id/fields/:field_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:自定义权限 Role + +高级权限的规则设置。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| ------- | ------ | ------------------------------------------------------------ | +| role_id | string | 一条自定义权限的唯一标识。 **示例值**:"rolJOiPRqp"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +## 资源:自定义权限的协作者 Member + +高级权限下的协作者。 + +### 字段说明 + +| 名称 | 类型 | 描述 | +| --------- | ------ | ------------------------------------------------------------ | +| member_id | string | 一条自定义权限下的一位协作者的唯一标识。 **示例值**:"ou_xxxxxxxxxxx"**字段权限要求(任选其一)**: 查看、评论、编辑和管理多维表格 | + +### 方法列表 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview) + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + + + + +--- + +### A.2 接入指南 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436427.md` + +# 接入指南 + +多维表格(Bitable)是飞书云文档下的一个产品。它可以是一个表格,也可以是无数个应用。 + +## 1.形态 + +一篇多维表格可以理解成是一个应用(app),标记该应用的唯一标识叫 apptoken; + +每篇多维表格是由有多个数据表(table)组成的,标记该数据表的唯一标识叫 tableid; + +作为一个应用它会有多种形态存在; + +可以作为一个独立应用存在,也可以作为一个模块(block)与飞书文档、飞书表格结合在一起。 + +| 飞书云文档中 | 飞书文档中 | 飞书表格中 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| Bitable app | Bitable doc block | Bitable sheet block | +| 即在"**飞书云文档**"中新建的多维表格 | 即在"**飞书文档**"中插入的多维表格 | 即在"**飞书表格**"中新建的多维表格 | +| URL 以 **feishu.cn/base** 开头 | URL 以 **feishu.cn/docs**、**feishu.cn/docx** 开头 | URL 以 **feishu.cn/sheets** 开头 | +| 支持 | 支持 | 支持 | +| ![飞书云文档中](offline-docs-v2/assets/images/img_0263eec675e1e77dd0a8f1baa3d82385b625e51c.png) | ![飞书文档中](offline-docs-v2/assets/images/img_d009bf21c8c600b8d8a24bd616de8d61e9c1c38f.png) | ![飞书表格中](offline-docs-v2/assets/images/img_7e889ad8c1d1a942f60d28c125fc6043b0f91573.png) | + +> *通过 API 在飞书表格(Sheets)中新建数据表暂时无法在页面看到,后续会支持; + +## 2.内容 + +目前开放多维表格在App、数据表、视图、字段、记录、高级权限设置和高级权限协作者 7 种内容的 API 。 + +记录可以狭义的理解为表格行; + +字段可以狭义的理解为表格的列; + +| 记录* | 字段 | 视图 | 数据表 | App | 权限 | 高级权限设置 | 高级权限协作者 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) [记录筛选开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/filter) [检索记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/get) [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [新增多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) [更新多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_update) [删除记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/delete) [删除多记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/batch_delete) | [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) [删除字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/delete) | [列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list) [新增视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/create) [删除视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/delete) | [列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list) [新增数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create) [新增多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_create) [删除数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/delete) [删除多数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/batch_delete) | [获取元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get) [更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update) [新建多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uQTNzUjL0UzM14CN1MTN) [复制多维表格](https://open.feishu.cn/document/ukTMukTMukTM/uYTNzUjL2UzM14iN1MTN) [删除多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/[删除文件](/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/delete)) | [增加权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) [移除权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/delete) [更新权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/update) [列出列表](https://open.feishu.cn/document/ukTMukTMukTM/uATN3UjLwUzN14CM1cTN) [转移拥有者](https://open.feishu.cn/document/ukTMukTMukTM/uQzNzUjL0czM14CN3MTN) [判断是否有权限](https://open.feishu.cn/document/ukTMukTMukTM/uYzN3UjL2czN14iN3cTN) [更新文档设置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-public/patch) | [列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list) [新增自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create) [删除自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete) [更新自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update) | [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list) [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create) [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete) | +| 最多 20000条/记录 | 最多150个/字段 | 最多200个/视图 | 最多100个/表格 | -- | -- | 最多30条/自定义权限 | 最多200个/自定义权限协作者 | + +> 注意:列出记录一次最多支持列出 500 条; +> +> 操作多条记录(限制在 500 条/次以下)的结果是全部成功或者全部失败,不存在部分结果。 +> +> 同一时刻,对同一篇多维表格最好只请求一次 API 写操作。 + +## 3.鉴权 + + + +- 在使用 + + tenant_access_token + + + + 前,请确保你的应用已经是文档的所有者或者协作者,否则会调用失败。 + + + +- 多维表格大部分接口都支持通过 + + user_access_token + + + + 和 + + + + tenant_access_token + + + + 两种身份进行调用。但仍然有部分接口只支持其中一种身份,请开发者在调用前,仔细阅读对应接口的说明文档。 + + + +- 使用 + + tenant_access_token + + + + 前,请确保你所使用的应用在云文档的协作者列表里。现阶段,你可以通过使用 + + + + tenant_access_token + + + + 来创建一篇多维表格,再使用 + + + + tenant_access_token + + + + 来进行进一步的操作。 + + + +| **user_access_token** | **tenant_access_token** | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| **用户身份鉴权** token 有效期为7200秒 当该token被刷新之后,老的 token 随即失效 | **应用身份鉴权** token 有效时间2小时 当token有效期<30分,可刷新得到新token 在2小时之内,新老token同时有效 | +| [获取用户身份访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/get-) | [获取应用身份访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/g) | +| 适合小程序、网页应用等场景 | 适合纯后台服务等场景 | + +## 4.限制 + +### QPS 限制 + +- 每个接口都有接口调用的频率限制,可参考[频控策略](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)。 +- 对于接口的批量操作,单次最高 500 条记录,且响应状态是全部成功或者失败,不存在部分结果。 + +### 接口报错 + +当请求不符合某些特定条件时会报错,如果因为部分参数不符合要求而导致报错,意味着当次请求所有的内容提交都失败了,不会对线上的数据造成影响。具体可参考:[服务端错误码说明](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN) + +## 5.字段类型 + +| 接口类型 | 支持 | 不支持 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------------- | +| [列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) | 全支持 | -- | +| [新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create) [更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update) | 多行文本、单选、多选、日期、人员、附件、复选框、超链接、数字、单向关联、电话号码、地理位置 | 双向关联 公式 查找引用 | +| [列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list) | 全支持 | -- | +| [新增字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/create) [更新字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/update) | 多行文本、单选、多选、日期、数字、人员、附件、单向关联、双向关联、复选框、超链接、公式(不支持设置公式表达式)、创建人、修改人、创建时间、最后更新时间、自动编号、电话号码、地理位置 | 查找引用 | + +## 6.参数说明 + +**API 地址**:https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id + +### app_token + +#### Bitable app + +- 在飞书云文档中打开一篇多维表格,其 URL 中 app_token 是下图框住部分;![app_token.png](offline-docs-v2/assets/images/img_aa8c30bea727a7e02a820ac2642767f33638cb32.png) + +#### Bitable doc block + +- 调用[获取文档所有块](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document-block/list),在返回结果中检索,其中 bitable.token 字段的值 AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +- + +``` +{ + "bitable": { + "token": "AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx" + }, + "block_id": "Mgeadqo4CoeoOGxI7Lgb4GNicEd", + "block_type": 18, + "parent_id": "YUqpdO2eLo7xJdxy5RQbuQBdctf" +} +``` + +#### Bitable sheet block + +- 调用[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN),在返回结果中检索,其中 blockType 的值为 BITABLE_BLOCK 时,blockToken 字段的值AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx是用 _ 隔开的 app_token 和 table_id; +- + +``` +{ + "blockInfo": { + "blockToken": "AW3Qbtr2cakCnesXzXVbbsrIcVT_tblkIYhz52o6G5nx", + "blockType": "BITABLE_BLOCK" + }, + "columnCount": 0, + "frozenColCount": 0, + "frozenRowCount": 0, + "index": 0, + "rowCount": 0, + "sheetId": "***", + "title": "*** " +} +``` + +### table_id + +#### Bitable app + +- 在 Bitable app 中打开一篇多维表格,其 URL 中 table_id 是下图中框住部分;![table_id.png](offline-docs-v2/assets/images/img_911de156954176687cbffd8b03659e538a1507fa.png) +- 对于其它场景的多维表格,需要通过[列出数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/list)接口获取; + +### view_id + +- 打开任意一篇多维表格,其 URL 中 view_id 是下图中框住部分;![view_id.png](offline-docs-v2/assets/images/img_e8f4428dbf460c852f1626cc3335cbc435f294c9.png) +- 或者通过[列出视图](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-view/list)接口获取。暂时无法获取到 Bitable doc block 中表格的 view_id; + +### record_id + +- 需要通过[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)接口获取; + +### field_id + +- 需要通过[列出字段](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/list)接口获取; + +### role_id + +- 需要通过[列出自定义权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)接口获取; + +### member_id + +- 需要通过[列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)接口获取; + + + + +--- + +### A.3 数据结构 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436428.md` + +# 数据结构 + +一篇多维表格可以理解成是一个 app,他的唯一标识就是 `app_token`。 + +app 是由一个个 table 组成,我们称 table 为数据表,他的标识就是 `table_id`。 + +table 由 record(记录) 和 field(字段) 组成, 同时可以拥有多个 view (视图)。 + +## 记录 + +记录由 record 和 fields 2个结构组成。 + +### record结构 + +记录是一个object结构类型。 + +| 参数 | 数据结构 | 描述 | +| ----------- | -------- | ---------- | +| `record_id` | string | 记录的id | +| `fields` | map | 记录的字段 | + +### fields结构 + +fields是一个map,是由字段名和其具体内容的键值对组成。 + +| item | datatype | description | +| ------- | -------- | ------------------------------------------------------------ | +| `key` | `string` | 字段名 | +| `value` | `union` | 某个字段的具体内容,其结构可以是string, boolean, list of string and list of person object | + +#### value结构(不同字段类型对应值的结构) + +| 字段类型 | value结构 | 描述 | +| ------------ | ------------------------------ | ------------------------------------------------------------ | +| 多行文本 | string | 值 | +| 数字 | 写入时为number,列出时为string | 值 | +| 单选 | string | 选项名称 | +| 多选 | array | 包含多个选项名字符串的数组 | +| 日期 | number | Unix 时间戳,单位是毫秒 | +| 复选框 | boolean | 布尔值 | +| 人员 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 电话号码 | string | 电话号码,符合正则表达式`(\+)?\d*`的字符串 | +| 超链接 | object | 具体结构参考: [超链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#超链接) | +| 附件 | object | 具体结构参考: [附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#附件) | +| 单向关联 | array | 包含多个 record_id 字符串的数组 | +| 双向关联 | - | 只支持列出,暂不支持写入 | +| 创建时间 | number | Unix 时间戳,单位是毫秒 | +| 最后更新时间 | number | Unix 时间戳,单位是毫秒 | +| 创建人 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 修改人 | object | 具体结构参考: [人员](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#人员) | +| 自动编号 | string | 由自动编号规则组成的字符串 | +| 地理位置 | object | 具体结构参考: [地理位置](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure#地理位置) | + +##### 人员 + +| 参数 | 数据结构 | 描述 | +| --------- | -------- | -------- | +| `name` | string | 名字 | +| `id` | string | id | +| `en_name` | string | 英文名字 | +| `email` | string | 邮箱 | + +##### 超链接 + +| 参数 | 数据结构 | 描述 | +| ------ | -------- | -------- | +| `text` | string | 文本名称 | +| `link` | string | 超链接 | + +##### 附件 + +| 参数 | 数据结构 | 描述 | +| ------------ | -------- | ------------------------------------------------------------ | +| `file_token` | string | 附件token | +| `name` | string | 附件名称 | +| `type` | string | 附件的 mime 类型, 如: `image/png` | +| `size` | int | 附件大小, 单位: 字节 | +| `url` | string | 附件url,下载请参考:[下载附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/attachment#22daecaf) | +| `tmp_url` | string | 生成附件临时下载链接的url,需access token鉴权 | + +##### 地理位置 + +| 参数 | 数据结构 | 描述 | +| -------------- | -------- | -------- | +| `location` | string | 经纬度 | +| `pname` | string | 省 | +| `cityname` | string | 市 | +| `adname` | string | 区 | +| `address` | string | 详细地址 | +| `name` | string | 地名 | +| `full_address` | string | 完整地址 | + +## 字段 + +字段是一个`object`结构类型。 + +| 名称 | 类型 | 描述 | +| ---------- | ------ | ------------------------------------------------------------ | +| field_id | string | 字段id | +| field_name | string | 字段名 | +| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +| property | object | 字段属性,因字段类型而异 | + +### Property说明 + +参考: [字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide) + +## 视图 + +视图是一个object结构类型。 + +| item | datatype | description | +| ----------- | -------- | ------------------------------------------------------------ | +| `view_id` | `string` | 视图id | +| `view_name` | `string` | 视图名称 | +| `view_type` | `string` | 视图类型,支持grid, kanban, gallery, gantt四种类型,默认为grid类型 | + +## 自定义数据结构 + +### delete_record + +| 参数 | 数据类型 | 描述 | +| ----------- | --------- | ------------ | +| `deleted` | `boolean` | 是否删除成功 | +| `record_id` | `string` | 单条记录的id | + + + + +--- + +### A.4 记录筛选开发指南 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436454.md` + +# 记录筛选开发指南 + +在[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)中可以通过查询参数 filter 去筛选出你需要的 records。 + +## 注意事项 + +filter 后的表达式支持[公式语法](https://www.feishu.cn/hc/zh-CN/articles/360049067853),可通过 AND 或 OR 来组合。 + +表达式的语法为: CurrentValue.[字段名],其中首字母 C 和 V 要大写。 + +由于 URL 支持字符集的限制,需要将请求参数编码之后传输,如“+”号要编码为“%2B”。 + +## 常用筛选公式 + +| 逻辑名称 | 表达式 | +| -------- | -------------------------------------------- | +| 为空 | `CurrentValue.[订单号] =""` | +| 不为空 | `NOT(CurrentValue.[订单号] ="")` | +| 等于 | `CurrentValue.[订单号] = "003"` | +| 不等于 | `CurrentValue.[订单号] != "003"` | +| 大于等于 | `CurrentValue.[价格] >= 10.5` | +| 小于等于 | `CurrentValue.[订单号] <= "003"` | +| 包含 | `CurrentValue.[订单号].contains("003")` | +| 不包含 | `NOT(CurrentValue.[订单号].contains("003"))` | +| AND | `表达式1&&表达式2 或者 AND(表达式1,表达式2)` | +| OR | `OR(表达式1,表达式2)` | + +## 常用的逻辑表达式 + +与 + +> AND(CurrentValue.[订单号].contains("004"),CurrentValue.[订单日期]= TODAY()) + +或 + +> OR(CurrentValue.[订单号].contains("004"),CurrentValue.[订单号].contains("009")) + +## 常用的日期表达式 + +今天 + +> CurrentValue.[订单日期] = TODAY() + +昨天 + +> CurrentValue.[订单日期] = TODAY()-1 + +明天 + +> CurrentValue.[订单日期] = TODAY()%2B1 + +本周 + +> AND(TODAY()-(WEEKDAY(TODAY(),2)-1)<=CurrentValue.[订单日期], CurrentValue.[订单日期]<=TODAY()%2B(7-WEEKDAY(TODAY(),2))) + +本月 + +> AND(DATE(YEAR(TODAY()),MONTH(TODAY()),1)<=CurrentValue.[订单日期], CurrentValue.[订单日期]<=DATE(YEAR(TODAY()),MONTH(TODAY())%2B1,0)) + +过去N天 + +> today()-N%2B1 <= CurrentValue.[订单日期]&&CurrentValue.[订单日期] <= today() + +未来N天 + +> today()<= CurrentValue.[订单日期]&&CurrentValue.[订单日期] <= today()%2BN-1 + +在某个日期之内 + +> CurrentValue.[订单日期] > TODATE("2021-06-01")&&CurrentValue.[订单日期] < TODATE("2021-06-31") + +## 字段筛选示例 + +| 字段 | 筛选示例 | +| ------------ | ------------------------------------------------------------ | +| 多行文本 | `CurrentValue.[字段名1]="内容a"` | +| 单选 | `CurrentValue.[字段名1]="选项内容a"` | +| 多选 | `CurrentValue.[字段名1]="选项内容a"` | +| 人员 | `CurrentValue.[人员]="袁志伟"` | +| 电话号码 | `CurrentValue.[电话号码]="+2020202020"` | +| 日期 | `CurrentValue.[订单日期] = TODAY()` | +| 附件 | `CurrentValue.[字段名1]="内容a"` | +| 数字 | `CurrentValue.[字段名1]=1` | +| 复选框 | `CurrentValue.[字段名1]=1` | +| 超链接 | `CurrentValue.[超链接]="超链接的文本值"` | +| 公式 | `CurrentValue.[字段名1]="内容a"`(如果公式返回值为数字,则不需要双引号,如`CurrentValue.[字段名1]=123`) | +| 查找引用 | `CurrentValue.[字段名1]="内容a"` | +| 单向关联 | `CurrentValue.[字段名1]="内容a"` | +| 创建人 | `CurrentValue.[创建人]="人名a"` | +| 创建时间 | `CurrentValue.[字段名1]>TODAY()` | +| 修改人 | `CurrentValue.[修改人]="小飞书"` | +| 最后更新时间 | `CurrentValue.[字段名1]>TODAY()` | +| 自动编号 | `CurrentValue.[自动编号]="001no20220624"` | + + + + +--- + +### A.5 字段编辑指南 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436742.md` + +# 字段编辑指南 + +## 字段概述 + +字段是一个`object`结构类型。结构如下: + +| 名称 | 类型 | 描述 | +| ---------- | ------ | ------------------------------------------------------------ | +| field_id | string | 字段id | +| field_name | string | 字段名 | +| type | int | 字段类型: 1:多行文本 2:数字 3:单选 4:多选 5:日期 7:复选框 11:人员 13:电话号码 15:超链接 17:附件 18:单向关联 19:查找引用 20:公式 21:双向关联 22:地理位置 1001:创建时间 1002:最后更新时间 1003:创建人 1004:修改人 1005:自动编号 | +| property | object | 字段属性,因字段类型而异 | + +注意: + +更新字段时为全量更新,`property`会被完全覆盖。在下面的单选、多选字段的[更新字段的请求体示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#更新字段的请求体示例)中有所体现。 + +## Property说明 + +部分类型字段有特殊的属性配置,在下面列出。其他类型字段的`property`均为`null`。 + +### 数字字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| --------- | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| formatter | string | 格式,参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中数字格式与formatter的对应关系) | 否 | 是 | 参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中数字格式与formatter的对应关系) | "0.0" | + +#### 网页中数字格式与formatter的对应关系 + +| 网页中数字格式 | formatter | +| ---------------- | ---------- | +| 整数 | "0" | +| 保留1位小数 | "0.0" | +| 保留2位小数 | "0.00" | +| 保留3位小数 | "0.000" | +| 保留4位小数 | "0.0000" | +| 千分位 | "1,000" | +| 千分位(小数点) | "1,000.00" | +| 百分比 | "%" | +| 百分比(小数点) | "0.00%" | +| 人民币 | "¥" | +| 人民币(小数点) | "¥0.00" | +| 美元 | "$" | +| 美元(小数点) | "$0.00" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "数字", + "type": 2, + "property": { + "formatter": "0.00" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldoMnnvIR", + "field_name": "数字", + "property": { + "formatter": "0.00" + }, + "type": 2 + } + }, + "msg": "Success" +} +``` + +### 单选、多选字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------- | --------------------------------- | -------- | ---- | ------------ | ---------- | ------------------------------- | +| options | app.table.field.property.option[] | 选项列表 | 否 | 否 | - | - | +| ∟id | string | 选项id | 否 | 否 | - | - | +| ∟name | string | 选项名 | 否 | 否 | - | - | +| ∟color | int | 选项颜色 | 否 | 是 | 0~54 | 从上一个选项的color开始依次递增 | + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "单选", + "type": 3, + "property": { + "options": [ + { + "name": "a" + }, + { + "name": "b" + }, + { + "name": "c", + "color": 5 + }, + { + "name": "d" + } + ] + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fld2RxOyB8", + "field_name": "单选", + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", + "name": "a" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 5, + "id": "optDIEs1h0", + "name": "c" + }, + { + "color": 6, + "id": "optZZceUac", + "name": "d" + } + ] + }, + "type": 3 + } + }, + "msg": "Success" +} +``` + +#### 更新字段的请求体示例 + +现在,我想更新选项`a`的`name`为`a++`,选项`b`保持不变,删除选项`c`和选项`d`,新增选项`z`,请求体如下: + +``` +{ + "field_name": "单选", + "type": 3, + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", // 若携带id,id必须是旧的单选、多选字段property中已存在的选项id + "name": "a++" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 6, + "name": "z" // 不携带id,新增一个选项 + } + ] + } +} +``` + +#### 响应体示例 + +因为更新字段是全量更新,选项`c`和选项`d`已删除,响应体如下: + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fld2RxOyB8", + "field_name": "单选", + "property": { + "options": [ + { + "color": 0, + "id": "optpeuQVqp", + "name": "a++" + }, + { + "color": 1, + "id": "opt5g3xLFT", + "name": "b" + }, + { + "color": 6, + "id": "opt558YmTi", + "name": "z" + } + ] + }, + "type": 3 + } + }, + "msg": "Success" +} +``` + +### 日期字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------------- | ------- | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------------ | +| date_formatter | string | 日期格式,参考:[日期格式date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | 否 | 是 | 参考:[日期格式date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | "yyyy/MM/dd" | +| auto_fill | boolean | 新纪录自动填写创建时间 | 否 | 否 | - | false | + +#### 网页中日期格式与date_formatter的对应关系 + +| 网页中日期格式 | date_formatter | +| ---------------- | ------------------ | +| 2021/01/30 | "yyyy/MM/dd" | +| 2021/01/30 14:00 | "yyyy/MM/dd HH:mm" | +| 2021-01-30 | "yyyy-MM-dd" | +| 2021-01-30 14:00 | "yyyy-MM-dd HH:mm" | +| 01-30 | "MM-dd" | +| 01/30/2021 | "MM/dd/yyyy" | +| 30/01/2021 | "dd/MM/yyyy" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "日期", + "type": 5, + "property": { + "date_formatter": "yyyy/MM/dd HH:mm", + "auto_fill": false + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldHBDkAfH", + "field_name": "日期", + "property": { + "auto_fill": false, + "date_formatter": "yyyy/MM/dd HH:mm" + }, + "type": 5 + } + }, + "msg": "Success" +} +``` + +### 人员字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------- | ------- | ---------------- | ---- | ------------ | ---------- | ------ | +| multiple | boolean | 允许添加多个成员 | 否 | 否 | - | true | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "人员", + "type": 11, + "property": { + "multiple": true + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldlQDzjyK", + "field_name": "人员", + "property": { + "multiple": true + }, + "type": 11 + } + }, + "msg": "Success" +} +``` + +### 单向关联字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ---------- | ------- | -------------------------------------- | ---- | ------------ | ---------- | ------ | +| multiple | boolean | 允许添加多个记录 | 否 | 否 | - | true | +| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +| table_name | string | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "单向关联", + "type": 18, + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldNdr8VNW", + "field_name": "单向关联", + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "table_name": "数据表2" + }, + "type": 18 + } + }, + "msg": "Success" +} +``` + +### 双向关联字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| --------------- | ------- | -------------------------------------------------- | ---- | ------------ | ---------- | ----------------------- | +| back_field_id | string | 关联的数据表中双向关联字段的id(仅在响应体中返回) | - | - | - | - | +| back_field_name | string | 关联的数据表中双向关联字段的名字 | 否 | 否 | - | 关联的数据表名-本字段名 | +| multiple | boolean | 允许添加多个记录 | 否 | 否 | - | true | +| table_id | string | 关联的数据表的id | 是 | 否 | - | - | +| table_name | String | 关联的数据表的名字(仅在响应体中返回) | - | - | - | - | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "双向关联", + "type": 21, + "property": { + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "back_field_name": "双向关联-自动生成" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldpfIDIi0", + "field_name": "双向关联", + "property": { + "back_field_id": "fldmQGUnWh", + "back_field_name": "双向关联-自动生成", + "multiple": true, + "table_id": "tblw92ErelmCmgHc", + "table_name": "数据表2" + }, + "type": 21 + } + }, + "msg": "Success" +} +``` + +### 公式字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------------------ | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| formatter | string | 格式参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中公式格式与formatter的对应关系) | 否 | 是 | 参考:[formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中公式格式与formatter的对应关系) | "" | +| formula_expression | string | 格式参考:[formula](https://www.feishu.cn/hc/zh-CN/articles/360049067853) | 否 | 否 | | "" | + +#### 网页中公式格式与formatter的对应关系 + +| 网页中公式格式 | formatter | +| ---------------- | ------------------ | +| 默认 | "" | +| 整数 | "0" | +| 保留1位小数 | "0.0" | +| 保留2位小数 | "0.00" | +| 千分位 | "1,000" | +| 千分位(小数点) | "1,000.00" | +| 百分比 | "%" | +| 百分比(小数点) | "0.00%" | +| 人民币 | "¥" | +| 人民币(小数点) | "¥0.00" | +| 美元 | "$" | +| 美元(小数点) | "$0.00" | +| 2021/01/30 14:00 | "yyyy/MM/dd HH:mm" | +| 2021/01/30 | "yyyy/MM/dd" | +| 2021-01-30 | "yyyy-MM-dd" | +| 01-30 | "MM-dd" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "公式", + "type": 20, + "property": { + "formatter": "0.00%", + "formula_expression": "IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN(\"飞书\"),\"aaa\",\"bbb\")" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldFuAdYEI", + "field_name": "公式", + "property": { + "formatter": "0.00%", + "formula_expression": "IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN(\"飞书\"),\"aaa\",\"bbb\")" + }, + "type": 20 + } + }, + "msg": "Success" +} +``` + +### 创建时间、最后更新时间字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| -------------- | ------ | ------------------------------------------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------------ | +| date_formatter | string | 日期格式,参考:[date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | 否 | 是 | 参考:[date_formatter](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中日期格式与date_formatter的对应关系) | "yyyy/MM/dd" | + +#### 新增、更新字段的请求体示例 + +``` +{ + "field_name": "创建时间", + "type": 1001, + "property": { + "date_formatter": "yyyy/MM/dd" + } +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "data": { + "field": { + "field_id": "fldoblwmUC", + "field_name": "创建时间", + "property": { + "date_formatter": "yyyy/MM/dd" + }, + "type": 1001 + } + }, + "msg": "Success" +} +``` + +### 自动编号字段 + +#### Property结构 + +| 名称 | 类型 | 描述 | 必填 | 是否是枚举值 | 可选枚举值 | 默认值 | +| ------------------------- | ---------------------------------------- | ------------------------ | ---- | ------------ | ------------------------------------------------------------ | ------ | +| auto_serial | app.field.property.auto_serial | 自动编号 | 否 | 否 | - | - | +| ∟type | string | 自动编号类型 | 是 | 是 | 参考:[auto_serial_type](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中编号类型与auto_serial_type的对应关系) | - | +| reformat_existing_records | bool | 是否将修改应用于已有编号 | 否 | 否 | - | false | +| ∟options | app.field.property.auto_serial.options[] | 自定义编号规则列表 | 否 | 否 | - | - | +| ∟type | string | 规则类型 | 是 | 是 | 参考:[rule_option_type](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中编号规则与rule_option_type的对应关系) | - | +| ∟value | string | 值 | 是 | 否 | - | - | + +#### 网页中编号类型与auto_serial_type的对应关系 + +| 网页中编号类型 | auto_serial_type | +| -------------- | ----------------------- | +| 自定义编号 | "custom" | +| 自增数字 | "auto_increment_number" | + +#### 网页中编号规则与rule_option_type的对应关系 + +| 网页中编号类型 | rule_option_type | 对应的value限制 | +| -------------- | ---------------- | ------------------------------------------------------------ | +| 自增数字 | "system_number" | 1-9 | +| 固定字符 | "fixed_text" | 最大长度:20 | +| 创建日期 | "created_time" | 可选值参考:[created_time](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide#网页中创建日期与created_time的对应关系) | + +#### 网页中创建日期与created_time的对应关系 + +| 网页中创建日期 | created_time | +| -------------- | ------------ | +| 20220130 | "yyyyMMdd" | +| 202201 | "yyyyMM" | +| 2022 | "yyyy" | +| 0130 | "MMdd" | +| 01 | "MM" | +| 30 | "dd" | + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "自动编号", + "property": { + "auto_serial": { + "type": "custom", + "reformat_existing_records": true, + "options": [ + { + "type": "system_number", + "value": "3" + }, + { + "type": "fixed_text", + "value": "no" + }, + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + } + }, + "type": 1005 +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "msg": "success", + "data": { + "field": { + "property": { + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "system_number", + "value": "3" + }, + { + "value": "no", + "type": "fixed_text" + }, + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + } + }, + "field_id": "fldmVunQuc", + "field_name": "自动编号", + "type": 1005 + } + } +} +``` + +#### 新增字段的请求体示例 + +``` +{ + "field_name": "自增数字自动编号", + "property": { + "auto_serial": { + "type": "auto_increment_number", + "reformat_existing_records": true + } + }, + "type": 1005 +} +``` + +#### 响应体示例 + +``` +{ + "code": 0, + "msg": "success", + "data": { + "field": { + "field_name": "自增数字自动编号", + "type": 1005, + "property": { + "auto_serial": { + "type": "auto_increment_number" + } + }, + "field_id": "fldwq16vz2" + } + } +} +``` + + + + +--- + +### A.6 附件字段说明 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-436743.md` + +# 附件字段说明 + +使用前请仔细阅读[素材概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction)。 + +## 数据结构 + +| 字段名 | 字段描述 | +| :--------- | :--------------- | +| file_token | 文件 token | +| name | 文件名称 | +| size | 文件大小 | +| tmp_url | 文件临时下载链接 | +| type | 文件类型 | +| url | 文件的下载 URL | + +**返回 body** + +``` +{ + "任务附件": [ + { + "file_token": "boxcnzm3dPEcutYDPplx5iDak4b", + "name": "Hawaii_1_15Retina_R.jpg", + "size": 5069121, + "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnzm3dPEcutYDPplx5iDak4b", + "type": "image/jpeg", + "url": "https://open.feishu.cn/open-apis/drive/v1/medias/boxcnzm3dPEcutYDPplx5iDak4b/download" + } +] +} +``` + +## 上传附件 + +在多维表格中上传附件分 2 步 + +1.调用[上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all)或[分片上传素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)接口上传文件,上传成功之后获取到文件的 file_token; + +2.调用[新增记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/create)或者[更新记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/update)将文件更新到记录中去; + +**请求 body 说明:** + +``` + { + "records": [ + { + "fields": { + "附件": [ + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} + ] + } + }, + { + "fields": { + "附件": [ + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"}, + {"file_token": "boxbcCFb2dBwMK9S8kDILk1tayh"} + ] + } + } + + ] + +} +``` + +**返回 body:** + +``` +{ + "code": 0, + "data": { + "records": [ + { + "fields": { + "附件": [ + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + }, + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + } + ] + }, + "id": "recxgOKlB0" + }, + + { + "fields": { + "附件": [ + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + }, + { + "file_token": "boxbcCFb2dBwMK9S8kDILk1tayh" + } + ] + }, + "id": "reciGVHpI8" + } + ] + }, + "msg": "Success" +} +``` + +## 下载附件 + +1.调用[列出记录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list)查询出多维表格中附件的 file_token; + +**返回body** + +``` +{ + "code": 0, + "data": { + "record": { + "fields": { + "人力评估": "8", + "任务执行人": [ + { + "annotation_union_type": "person", + "email": "", + "en_name": "周北北", + "id": "ou_be7f7ff11f5107962c0493f59409508b", + "name": "周北北" + } + ], + "任务描述": "功能开发", + "任务附件": [ + { + "file_token": "boxcn8Ebe2Z68hXTsW8t1TuZCSd", + "name": "2.gif", + "size": 10250625, + "tmp_url": "https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcn8Ebe2Z68hXTsW8t1TuZCSd", + "type": "image/gif", + "url": "https://open.feishu.cn/open-apis/drive/v1/medias/boxcn8Ebe2Z68hXTsW8t1TuZCSd/download" + } + ], + "对应 OKR": [ + { + "text": "KR 2.2 推进新功能研发,KR 2.3 修补已知功能漏洞", + "type": "text" + } + ], + "截止日期": 1612108800000, + "未命名 1": null, + "状态": "开发中", + "相关部门": [ + "研发" + ] + }, + "id": "reczXt4wo5" + } + }, + "msg": "Success" +} +``` + +2.调用[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download) 下载或者[获取素材临时下载链接](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url),这2个接口已经支持多维表格。 + + + + +--- + +### A.7 概述 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1964912.md` + +# 概述 + +多维表格的 **所有者 或者 有可管理权限** 的用户可通过 API 设置高级权限,管理高级权限的协作者,针对每个数据表设置谁可以查看、编辑指定的行,或是指定可以编辑的列。使用前请阅读[使用多维表格高级权限](https://www.feishu.cn/hc/zh-CN/articles/588604550568)。 + +高级权限接口分为 **自定义角色** 和 **协作者** 两部分。 + +## 注意事项 + +调用高级权限的接口前,请先确保多维表格已开启高级权限。可以通过[更新多维表格元数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/update)开启高级权限。 + + + +- 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限。 +- 开启高级权限有延迟,开启高级权限后立即调用高级权限的接口时遇到 `OperationTypeError` 的报错请重试。 +- 高级权限的协作者与云文档权限协作者为不同权限身份,添加高级权限协作者之后,为保证文档权限设置正常,建议再通过 [增加协作者权限](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/create) 接口新增文档权限。 + +开启高级权限后,首先设置自定义角色,完成设置后可管理自定义的协作者。 + + + +暂不支持仪表盘权限 + +## 方法列表 + +### 设置自定义角色 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview)。 + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [更新自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/update)`PUT` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除自定义角色](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + +### 管理自定义角色的协作者 + +> “商店”代表 [应用商店应用](https://open.feishu.cn/document/home/app-types-introduction/overview);“自建”代表 [企业自建应用](https://open.feishu.cn/document/home/app-types-introduction/overview)。 + +| | **[方法 (API)](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)** | 权限要求(满足任一) | | **[访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)(选择其一)** | 商店 | 自建 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------ | ----- | ------------------------------------------------------------ | ---- | ---- | +| [列出协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list)`GET` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [新增协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/create)`POST` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | +| [删除协作者](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/delete)`DELETE` /open-apis/bitable/v1/apps/:app_token/roles/:role_id/members/:member_id | 查看、评论、编辑和管理多维表格 | tenant_access_tokenuser_access_token | **✓** | **✓** | | | + + + + +--- + +### A.8 多维表格字段变更 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949951.md` + +# 多维表格字段变更 + +多维表格字段变更 + + + + + + + +## 事件 + +| 基本 | | +| ------------------------- | ------------------------------------------------------------ | +| 事件类型 | drive.file.bitable_field_changed_v1 | +| 支持的应用类型 | 自建应用商店应用 | +| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | +| 字段权限要求 | 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请获取用户 user ID仅自建应用 | +| 推送方式 | [Webhook](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) | + +### 事件体 + +| 名称收起子列表 | 类型 | 描述 | +| ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| schema | string | 事件模式 | +| header | event_header | 事件头 | +| event_id | string | 事件 ID | +| event_type | string | 事件类型 | +| create_time | string | 事件创建时间戳(单位:毫秒) | +| token | string | 事件 Token | +| app_id | string | 应用 ID | +| tenant_key | string | 租户 Key | +| event | - | - | +| file_type | string | 文档类型 | +| file_token | string | 文档token | +| table_id | string | 多维表格数据表ID | +| operator_id | user_id | 用户 ID | +| union_id | string | 用户的 union id | +| user_id | string | 用户的 user id**字段权限要求**:获取用户 user ID仅自建应用 | +| open_id | string | 用户的 open id | +| action_list | bitable.table.field_action[] | 字段变更操作列表 | +| action | string | 操作类型 | +| field_id | string | 字段 ID | +| before_value | bitable.table.field_action.value | 操作前的字段值 | +| id | string | 字段 ID | +| name | string | 字段名字 | +| type | int | 字段类型 | +| description | string | 字段描述 | +| property | bitable.table.field_action.value.property | 字段属性 | +| formatter | string | 数字、公式字段的显示格式 | +| date_formatter | string | 日期、创建时间、最后更新时间字段的显示格式 | +| auto_fill | boolean | 日期字段中新纪录自动填写创建时间 | +| multiple | boolean | 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 | +| table_id | string | 单向关联、双向关联字段中关联的数据表的ID | +| table_name | string | 单向关联、双向关联字段中关联的数据表的名字 | +| back_field_name | string | 双向关联字段中关联的数据表中对应的双向关联字段的名字 | +| input_type | string | 地理位置输入限制 | +| back_field_id | string | 双向关联字段中关联的数据表中对应的双向关联字段的id | +| auto_serial | bitable.table.field_action.value.property.auto_serial | 自动编号类型 | +| type | string | 自动编号类型 | +| options | bitable.table.field_action.value.property.auto_serial.options[] | 自动编号规则列表 | +| type | string | 自动编号的可选规则项类型 | +| value | string | 与类型相对应的取值 | +| options | bitable.table.field_action.value.property.option[] | 单选、多选字段的选项信息 | +| name | string | 选项名 | +| id | string | 选项ID | +| color | int | 选项颜色 | +| formula_expression | string | 公式字段的公式表达式 | +| after_value | bitable.table.field_action.value | 操作后的字段值 | +| id | string | 字段 ID | +| name | string | 字段名字 | +| type | int | 字段类型 | +| description | string | 字段描述 | +| property | bitable.table.field_action.value.property | 字段属性 | +| formatter | string | 数字、公式字段的显示格式 | +| date_formatter | string | 日期、创建时间、最后更新时间字段的显示格式 | +| auto_fill | boolean | 日期字段中新纪录自动填写创建时间 | +| multiple | boolean | 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 | +| table_id | string | 单向关联、双向关联字段中关联的数据表的ID | +| table_name | string | 单向关联、双向关联字段中关联的数据表的名字 | +| back_field_name | string | 双向关联字段中关联的数据表中对应的双向关联字段的名字 | +| input_type | string | 地理位置输入限制 | +| back_field_id | string | 双向关联字段中关联的数据表中对应的双向关联字段的id | +| auto_serial | bitable.table.field_action.value.property.auto_serial | 自动编号类型 | +| type | string | 自动编号类型 | +| options | bitable.table.field_action.value.property.auto_serial.options[] | 自动编号规则列表 | +| type | string | 自动编号的可选规则项类型 | +| value | string | 与类型相对应的取值 | +| options | bitable.table.field_action.value.property.option[] | 单选、多选字段的选项信息 | +| name | string | 选项名 | +| id | string | 选项ID | +| color | int | 选项颜色 | +| formula_expression | string | 公式字段的公式表达式 | +| revision | int | 多维表格数据表的版本号 | +| subscriber_id_list | user_id[] | 订阅用户id列表 | +| union_id | string | union id | +| user_id | string | user id | +| open_id | string | open id | +| update_time | int | 字段变更时间 | + +### 事件体示例 + +``` +{ + "schema": "2.0", + "header": { + "event_id": "5e3702a84e847582be8db7fb73283c02", + "event_type": "drive.file.bitable_field_changed_v1", + "create_time": "1608725989000", + "token": "rvaYgkND1GOiu5MM0E1rncYC6PLtF7JV", + "app_id": "cli_9f5343c580712544", + "tenant_key": "2ca1d211f64f6438" + }, + "event": { + "file_type": "bitable", + "file_token": "bascntUPmnoH9kZbGJ8RWeabcef", + "table_id": "tblWXe2d0I0abcef", + "operator_id": { + "union_id": "on_8ed6aa67826108097d9ee143816345", + "user_id": "e33ggbyz", + "open_id": "ou_84aad35d084aa403a838cf73ee18467" + }, + "action_list": [ + { + "action": "field_edited", + "field_id": "fldmj5qNii", + "before_value": { + "id": "fldmj5qNii", + "name": "field name", + "type": 20, + "description": "description", + "property": { + "formatter": "1,000", + "date_formatter": "yyyyMMdd", + "auto_fill": true, + "multiple": true, + "table_id": "tblIniLz0Ic8oXyN", + "table_name": "table name", + "back_field_name": "field name", + "input_type": "only_mobile", + "back_field_id": "fldmj5qNii", + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + }, + "options": [ + { + "name": "option name", + "id": "optabcef", + "color": 3 + } + ], + "formula_expression": "bitable::$table[tblIniLz0Ic8oXyN].$field[fldqatAwxx]*6+333" + } + }, + "after_value": { + "id": "fldmj5qNii", + "name": "field name", + "type": 20, + "description": "description", + "property": { + "formatter": "1,000", + "date_formatter": "yyyyMMdd", + "auto_fill": true, + "multiple": true, + "table_id": "tblIniLz0Ic8oXyN", + "table_name": "table name", + "back_field_name": "field name", + "input_type": "only_mobile", + "back_field_id": "fldmj5qNii", + "auto_serial": { + "type": "custom", + "options": [ + { + "type": "created_time", + "value": "yyyyMMdd" + } + ] + }, + "options": [ + { + "name": "option name", + "id": "optabcef", + "color": 3 + } + ], + "formula_expression": "bitable::$table[tblIniLz0Ic8oXyN].$field[fldqatAwxx]*6+333" + } + } + } + ], + "revision": 10, + "subscriber_id_list": [ + { + "union_id": "on_876b570a984d02ab1c0906a49e4a9d04", + "user_id": "638474b8", + "open_id": "ou_9bc587355789fc049904ae7c73619b89" + } + ], + "update_time": 1663727688 + } +} +``` + + +--- + +### A.9 多维表格记录变更 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_doc-1949955.md` + +# 多维表格记录变更 + +了解事件订阅的使用场景和配置流程,请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) + +被订阅的多维表格记录发生变更将会触发此事件,**公式字段的值变化不会触发事件**。 + +## 概述 + +| 基本 | | +| ------------------------- | ------------------------------------------------------------ | +| 支持的应用类型 | 自建应用商店应用 | +| 权限要求 开启任一权限即可 | 查看、评论、编辑和管理多维表格查看、评论、编辑和管理云空间中所有文件 | + +如何订阅文档请点击查看 [订阅云文档事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/subscribe)。 + +## 支持的记录变更类型 + +| 变更类型 | action | +| ---------- | ---------------- | +| 新增行记录 | `record_added` | +| 删除行记录 | `record_deleted` | +| 修改行记录 | `record_edited` | + +回调结构中的 `field_value` 字段为 JSON 序列化后的字符串,序列化前的结构请查看 [数据结构](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/development-guide/bitable-structure) + +## 回调示例 + +``` +{ + "schema": "2.0", // 事件格式的版本。无此字段的即为1.0 + "header": { + "event_id": "85ec04b2f6cff27a1bf249b26fbabcef", // 事件的唯一标识 + "token": "L3bzVf0sz7qb9XoTavpsHe0uJv7abcef", // 即 Verification Token + "create_time": "1652677457000", // 事件发送的时间 + "event_type": "drive.file.bitable_record_changed_v1", // 事件类型 + "tenant_key": "736588c9260abcef", // 企业标识 + "app_id": "cli_a00c8400a7babcef" // 应用ID + }, + "event": { + "action_list": [ + { + "action": "record_edited", // 变更类型:修改记录 + "after_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更后的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"变更后的值\"}]" // 发生变更后的字段值 + } + ], + "before_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "123" // 发生变更前的字段值 + }, + { + "field_id": "fldqaabcef", // 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"变更前的值\"}]" // 发生变更前的字段值 + } + ], + "record_id": "rec9sabcef" // 发生变更的记录 ID + }, + { + "action": "record_added", // 变更类型:新增记录 + "after_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更后的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"新增记录字段值\"}]" // 发生变更后的字段值 + } + ], + "record_id": "rec9sabcef" // 新增的记录 ID + }, + { + "action": "record_deleted", // 变更类型:删除记录 + "before_value": [ + { + "field_id": "fld9Eabcef", // 发生变更的字段 ID + "field_value": "666" // 发生变更前的字段值 + }, + { + "field_id": "fldqaabcef",// 发生变更的字段 ID + "field_value": "[{\"type\":\"text\",\"text\":\"删除记录前字段值\"}]" // 发生变更前的字段值 + } + ], + "record_id": "rec9sabcef" // 删除的记录 ID + } + ], + "file_token": "bascnItn6oHUSEL8RDUdF6abcef", // 多维表格 token + "file_type": "bitable", // 文件类型,即 bitable + "operator_id": { // 操作人 + "open_id": "ou_9bc587355789fc049904ae7c736abcef", + "union_id": "on_8f71e0224c012a0365ad4e3c733abcef", + "user_id": "638abcef" + }, + "subscriber_id_list": [ // 订阅的用户列表 + { + "open_id": "ou_9bc587355789fc049904ae7c736abcef", + "union_id": "on_8f71e0224c012a0365ad4e3c733abcef", + "user_id": "638abcef" + } + ], + "table_id": "tblOaqBWfGeabcef" // 发生变更的数据表 ID + } +} +``` + + + + +--- + +### A.10 获取多维表格元数据 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-10753711.md` + +# 获取多维表格元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}: + get: + summary: 获取多维表格元数据 + deprecated: false + description: >+ + 通过 app_token 获取多维表格元数据 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/多维表格 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + app: + type: object + properties: + app_token: + type: string + description: 多维表格的 app_token + name: + type: string + description: 多维表格的名字 + revision: + type: integer + description: 多维表格的版本号 + is_advanced: + type: boolean + required: + - app_token + - name + - revision + - is_advanced + x-apifox-orders: + - app_token + - name + - revision + - is_advanced + description: 多维表格元数据 + required: + - app + x-apifox-orders: + - app + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + app: + app_token: appbcbWCzen6D8dezhoCH2RpMAh + name: mybitable + revision: 1 + is_advanced: false + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/多维表格 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-10753711-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.11 更新多维表格元数据 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58952482.md` + +# 更新多维表格元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}: + put: + summary: 更新多维表格元数据 + deprecated: false + description: >+ + 通过 app_token 更新多维表格元数据 + + + 飞书文档、飞书表格、知识库中的多维表格不支持开启高级权限 + + 此接口非原子操作,先修改多维表格名字,后开关高级权限。可能存在部分成功的情况 + + 该接口支持调用频率上限为 10 QPS + + + 可以单独修改名字或开关高级权限,请求体中不填的参数不受影响 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254031 | InvalidAppName | + 多维表格名称格式错误,长度不超过 100 个字符,不能包含 ? / \ * : [ ] | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254200 | internal error | + 内部错误 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/多维表格 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: "\t 新的多维表格名字 示例值:\"新的多维表格名字\"" + is_advanced: + type: boolean + description: 多维表格是否开启高级权限 示例值:true + x-apifox-orders: + - name + - is_advanced + example: + name: 新的多维表格名字 + is_advanced: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + app: + type: object + properties: + app_token: + type: string + description: 多维表格的 app_token + name: + type: string + description: 多维表格的名字 + is_advanced: + type: boolean + description: 多维表格是否已开启高级权限 + required: + - app_token + - name + - is_advanced + x-apifox-orders: + - app_token + - name + - is_advanced + description: 多维表格元数据 + required: + - app + x-apifox-orders: + - app + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + app: + app_token: appbcbWCzen6D8dezhoCH2RpMAh + name: 新的多维表格名字 + is_advanced: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/多维表格 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58952482-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.12 更新数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58953650.md` + +# 更新数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}: + patch: + summary: 更新数据表 + deprecated: false + description: >+ + 该接口用于更新数据表的基本信息,包括数据表的名称等。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 403 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 403 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + tags: + - 云文档/多维表格/数据表 + parameters: + - name: app_token + in: path + description: >- + 多维表格的唯一标识符 app_token 参数说明 示例值:"XrgTb4y1haKYnasu0xXb1g7lcSg" + 数据校验规则: 最小长度:1 字符 + required: true + schema: + type: string + - name: table_id + in: path + description: 多维表格数据表的唯一标识符 table_id 参数说明 示例值:"tbl1TkhyTWDkSoZ3" + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: >- + 数据表的新名称。 请注意: 名称中的首尾空格将会被去除。 + 如果名称为空或和旧名称相同,接口仍然会返回成功,但是名称不会被更改。 示例值:"数据表的新名称" 数据校验规则: + 长度范围:1 ~ 100 字符 正则校验:^[^\[\]\:\\\/\?\*]+$ + x-apifox-orders: + - name + example: + name: 数据表的新名称 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + name: + type: string + description: 数据表的名称 + required: + - name + x-apifox-orders: + - name + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + name: 数据表的新名称 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58953650-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.13 列出数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020925.md` + +# 列出数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables: + get: + summary: 列出数据表 + deprecated: false + description: >+ + 根据 app_token,获取多维表格下的所有数据表 + + 该接口支持调用频率上限为 20 QPS + + 关于云文档接口的 AccessToken 调用说明详见 [云文档接口快速入门] + + + (https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 示例值:"tblsRc9GRRXKqhvW" + required: false + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: page_size + in: query + description: 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + example: '10' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + items: + type: array + items: + type: object + properties: + table_id: + type: string + description: 数据表 id + revision: + type: integer + description: 数据表的版本号 + name: + type: string + description: 数据表名字 + description: 数据表信息 + required: + - has_more + - page_token + - total + - items + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + has_more: false + page_token: tblKz5D60T4JlfcT + total: 1 + items: + - table_id: tblKz5D60T4JlfcT + revision: 1 + name: 数据表1 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020925-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.14 新增数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020926.md` + +# 新增数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables: + post: + summary: 新增数据表 + deprecated: false + description: >+ + 新增一个数据表 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 + Open ID 不同。了解更多:如何获取 Open ID + union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID + 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union + ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? + user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID + 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID + 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 + user_id,字段权限要求: 获取用户 user ID + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + table: + type: object + properties: + name: + type: string + description: 数据表 名字 示例值:"table1" + required: + - name + x-apifox-orders: + - name + description: 数据表 + required: + - table + x-apifox-orders: + - table + example: + table: + name: table1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + table_id: + type: string + description: table id + required: + - table_id + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + table_id: tblKz5D60T4JlfcT + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020926-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.15 新增多个数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020927.md` + +# 新增多个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/batch_create: + post: + summary: 新增多个数据表 + deprecated: false + description: >+ + 新增多个数据表 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 + Open ID 不同。了解更多:如何获取 Open ID + union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID + 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union + ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? + user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID + 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID + 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 + user_id,字段权限要求: 获取用户 user ID + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + tables: + type: array + items: + type: object + properties: + name: + type: string + description: 数据表 名字 示例值:"table1" + description: tables + required: + - tables + example: + tables: + - name: table1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + table_ids: + type: array + items: + type: string + description: table ids + required: + - table_ids + x-apifox-orders: + - table_ids + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + table_ids: + - tblsRc9GRRXKqhvW + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020927-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.16 删除一个数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020928.md` + +# 删除一个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}: + delete: + summary: 删除一个数据表 + deprecated: false + description: >+ + 删除一个数据表 + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 403 | 1254034 | The last table cannot be deleted. | + 不能删除最后一张数据表 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020928-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.17 删除多个数据表 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020929.md` + +# 删除多个数据表 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/batch_delete: + post: + summary: 删除多个数据表 + deprecated: false + description: >+ + 删除多个数据表。 + + + 该接口支持调用频率上限为 10 QPS + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 403 | 1254034 | The last table cannot be deleted. | + 不能删除最后一张数据表 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/数据表 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + table_ids: + type: array + items: + type: string + description: 删除的多条tableid列表 示例值:["tblsRc9GRRXKqhvW"] + required: + - table_ids + example: + table_ids: + - tblsRc9GRRXKqhvW + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/数据表 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020929-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.18 复制仪表盘 + +来源文件:`offline-docs-v2/sources/bitable-md/s.apifox.cn_apidoc_docs-site_532425_api-58954090.md` + +# 复制仪表盘 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/dashboards/{block_id}/copy: + post: + summary: 复制仪表盘 + deprecated: false + description: >+ + 该接口用于根据现有仪表盘复制出新的仪表盘 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 400 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 400 | 1254004 | + WrongTableId | table_id + 错误 | + + | 400 | 1254005 | + WrongViewId | view_id + 错误 | + + | 400 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 400 | 1254007 | + EmptyValue | + 空值 | + + | 400 | 1254008 | + EmptyView | + 空视图 | + + | 400 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 400 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254016 | + InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | + InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | + InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | + ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | + EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | + InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | Invalid role name, make sure that it complies + with the specification. | + 自定义角色名无效 | + + | 400 | 1254033 | Duplicated role name, use another name + instead. | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254038 | Invalid name, make sure that it complies with + the specification. | 名称不规范,名称中不能包含 "[]",并且不能超过 100 个字符 | + + | 400 | 1254039 | Duplicated name, use another name + instead. | 名称与现有仪表盘名称重复,更换名称后重试 | + + | 404 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 404 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 404 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 404 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 404 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | Role id is not + found. | role_id + 不存在 | + + | 400 | 1254048 | + MemberNotFound | member + 不存在 | + + | 404 | 1254049 | Form field is not + found. | form_field_id + 不存在 | + + | 404 | 1254050 | Source block is not + found. | 传入了不存在的仪表盘 + block_id | + + | 400 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 400 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 400 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 400 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds + limit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | The role has no + permissions. | 无访问权限, 常由表格开启了高级权限造成, + 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1254607 | Data not ready, please try again + later. | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 400 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/仪表盘 + parameters: + - name: app_token + in: path + description: 多维表格 token + required: true + example: basbcldP5xZeskcHDFZQfeToydb + schema: + type: string + - name: block_id + in: path + description: 多维表格 block_id + required: true + example: blkEsvEEaNllY2UV + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + title: '' + description: "\t 仪表盘名称 示例值:\"Dashboard\"" + required: + - name + x-apifox-orders: + - name + example: + name: New Dashboard + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + block_id: + type: string + description: 多维表格 block_id + name: + type: string + description: block 名称 + required: + - block_id + - name + x-apifox-orders: + - block_id + - name + example: + block_id: blkXsf60PxMdJLQN + name: New Dashboard + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/仪表盘 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58954090-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.19 列出仪表盘 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58954319.md` + +# 列出仪表盘 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/dashboards: + get: + summary: 列出仪表盘 + deprecated: false + description: >+ + 根据 app_token,获取多维表格下的所有仪表盘 + + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/仪表盘 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:10 数据校验规则: 最大值:500" + required: false + schema: + type: integer + - name: page_token + in: query + description: "\t 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果" + required: false + example: blknkqrP3RqUkcAW + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + dashboards: + type: array + items: + type: object + properties: + block_id: + type: string + description: 仪表盘 ID + name: + type: string + description: 仪表盘名字 + x-apifox-orders: + - block_id + - name + description: 仪表盘信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + required: + - dashboards + - page_token + - has_more + x-apifox-orders: + - dashboards + - page_token + - has_more + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + dashboards: + - block_id: blknkqrP3RqUkcAW + name: 仪表盘1 + page_token: blknkqrP3RqUkcAW + has_more: false + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/仪表盘 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58954319-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.20 更新视图 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955066.md` + +# 更新视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + patch: + summary: 更新视图 + deprecated: false + description: >+ + 该接口用于增量修改视图信息 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ---------------------------------------------- + | ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson + | 请求体错误 | + + | 400 | 1254001 | WrongRequestBody + | 请求体错误 | + + | 400 | 1254002 | Fail + | 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken + | app_token 错误 | + + | 400 | 1254004 | WrongTableId + | table_id 错误 | + + | 400 | 1254005 | WrongViewId + | view_id 错误 | + + | 400 | 1254006 | WrongRecordId + | 检查 record_id | + + | 400 | 1254007 | EmptyValue + | 空值 | + + | 400 | 1254008 | EmptyView + | 空视图 | + + | 400 | 1254009 | WrongFieldId + | 字段 id 错误 | + + | 400 | 1254010 | ReqConvError + | 请求错误 | + + | 400 | 1254016 | InvalidSort + | Sort参数错误 | + + | 400 | 1254018 | InvalidFilter + | Filter参数错误 | + + | 400 | 1254019 | InvalidViewType + | 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated + | 视图名重复 | + + | 400 | 1254021 | EmptyViewName + | 视图名为空 | + + | 400 | 1254022 | InvalidViewName + | 视图名无效 | + + | 400 | 1254030 | TooLargeResponse + | 响应体过大 | + + | 400 | 1254032 | The role name is invalid, please modify it. + | 自定义角色名无效 | + + | 400 | 1254033 | The role name is duplicated, please modify it. + | 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. + | 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound + | app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound + | table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound + | view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound + | record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound + | field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound + | 字段名字不存在 | + + | 404 | 1254047 | Role id is not found. + | role_id 不存在 | + + | 400 | 1254048 | MemberNotFound + | member 不存在 | + + | 404 | 1254049 | Form field is not found. + | form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail + | 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail + | 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail + | 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail + | 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail + | 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail + | 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail + | 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail + | 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit + | 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit + | 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit + | 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit + | 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds limit + | 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell + | 格子内容过大 | + + | 429 | 1254290 | TooManyRequest + | 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict + | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError + | 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | Permission denied. + | 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255002 | RpcError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255003 | MarshalError + | 序列化错误,有疑问可咨询客服 | + + | 500 | 1255004 | UmMarshalError + | 反序列化错误 | + + | 500 | 1255005 | ConvError + | 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later. + | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图 ID + required: true + example: vewTpR1urY + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + view_name: + type: string + description: "\t 视图名称 示例值:\"grid\"" + property: + type: object + properties: + filter_info: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_id: + type: string + description: 用于过滤的字段唯一ID 示例值:"单选" + operator: + type: string + description: "\t 过滤操作的类型 示例值:\"is\" 可选值有: is:等于 isNot:不等于 contains:包含 doesNotContain:不包含 isEmpty:为空 isNotEmpty:不为空 isGreater:大于 isGreaterEqual:大于等于 isLess:小于 isLessEqual:小于等于" + value: + type: string + description: 筛选值 示例值:"["optbdVHf4q", "optrpd3eIJ"]" + x-apifox-orders: + - field_id + - operator + - value + description: 筛选条件 数据校验规则: 最大长度:50 + conjunction: + type: string + description: "\t 多个筛选条件的关系 示例值:\"and\" 可选值有: and:与 or:或 默认值:and" + required: + - conditions + - conjunction + x-apifox-orders: + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: "\t 隐藏字段ID列表 示例值:[\"fldCGzANXx\", \"fldCGzANXx\"] 数据校验规则: 最大长度:100" + required: + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + x-apifox-orders: + - view_name + - property + example: + view_name: grid + property: + filter_info: + conditions: + - field_id: fldVioUai1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + property: + type: object + properties: + filter_info: + type: object + properties: + condition_omitted: + type: 'null' + conditions: + type: array + items: + type: object + properties: + condition_id: + type: string + description: 过滤条件的唯一ID + field_id: + type: string + field_type: + type: integer + description: 用于过滤的字段类型 + operator: + type: string + description: >- + 过滤操作的类型 可选值有: is:等于 isNot:不等于 + contains:包含 doesNotContain:不包含 + isEmpty:为空 isNotEmpty:不为空 isGreater:大于 + isGreaterEqual:大于等于 isLess:小于 + isLessEqual:小于等于 + value: + type: string + description: 筛选值 + x-apifox-orders: + - condition_id + - field_id + - field_type + - operator + - value + description: 筛选条件 + conjunction: + type: string + description: "\t 多个筛选条件的关系 可选值有: and:与 or:或" + required: + - condition_omitted + - conditions + - conjunction + x-apifox-orders: + - condition_omitted + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: 隐藏字段ID列表 + required: + - filter_info + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + required: + - view_id + - view_name + - view_type + - property + x-apifox-orders: + - view_id + - view_name + - view_type + - property + description: 视图信息 + required: + - view + x-apifox-orders: + - view + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewsOleexJ + view_name: grid + view_type: grid + property: + filter_info: + condition_omitted: null + conditions: + - condition_id: conuKMQNNg + field_id: fldVioUai1 + field_type: 1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955066-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.21 检索视图 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955123.md` + +# 检索视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + get: + summary: 检索视图 + deprecated: false + description: >+ + 该接口根据 view_id 检索现有视图 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ---------------------------------------------- + | ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson + | 请求体错误 | + + | 400 | 1254001 | WrongRequestBody + | 请求体错误 | + + | 400 | 1254002 | Fail + | 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken + | app_token 错误 | + + | 400 | 1254004 | WrongTableId + | table_id 错误 | + + | 400 | 1254005 | WrongViewId + | view_id 错误 | + + | 400 | 1254006 | WrongRecordId + | 检查 record_id | + + | 400 | 1254007 | EmptyValue + | 空值 | + + | 400 | 1254008 | EmptyView + | 空视图 | + + | 400 | 1254009 | WrongFieldId + | 字段 id 错误 | + + | 400 | 1254010 | ReqConvError + | 请求错误 | + + | 400 | 1254016 | InvalidSort + | Sort参数错误 | + + | 400 | 1254018 | InvalidFilter + | Filter参数错误 | + + | 400 | 1254019 | InvalidViewType + | 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated + | 视图名重复 | + + | 400 | 1254021 | EmptyViewName + | 视图名为空 | + + | 400 | 1254022 | InvalidViewName + | 视图名无效 | + + | 400 | 1254030 | TooLargeResponse + | 响应体过大 | + + | 400 | 1254032 | The role name is invalid, please modify it. + | 自定义角色名无效 | + + | 400 | 1254033 | The role name is duplicated, please modify it. + | 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. + | 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound + | app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound + | table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound + | view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound + | record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound + | field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound + | 字段名字不存在 | + + | 404 | 1254047 | Role id is not found. + | role_id 不存在 | + + | 400 | 1254048 | MemberNotFound + | member 不存在 | + + | 404 | 1254049 | Form field is not found. + | form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail + | 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail + | 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail + | 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail + | 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail + | 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail + | 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail + | 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail + | 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit + | 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit + | 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit + | 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit + | 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | Role exceeds limit + | 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell + | 格子内容过大 | + + | 429 | 1254290 | TooManyRequest + | 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict + | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError + | 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | Permission denied. + | 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 500 | 1255001 | InternalError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255002 | RpcError + | 内部错误,有疑问可咨询客服 | + + | 500 | 1255003 | MarshalError + | 序列化错误,有疑问可咨询客服 | + + | 500 | 1255004 | UmMarshalError + | 反序列化错误 | + + | 500 | 1255005 | ConvError + | 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later. + | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图 ID + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + property: + type: object + properties: + filter_info: + type: object + properties: + condition_omitted: + type: 'null' + description: 筛选条件是否缺省 + conditions: + type: array + items: + type: object + properties: + condition_id: + type: string + description: 过滤条件的唯一ID + field_id: + type: string + description: 用于过滤的字段唯一ID + field_type: + type: integer + description: 用于过滤的字段类型 + operator: + type: string + description: "\t\n过滤操作的类型\n\n可选值有:\n\nis:等于\nisNot:不等于\ncontains:包含\ndoesNotContain:不包含\nisEmpty:为空\nisNotEmpty:不为空\nisGreater:大于\nisGreater:大于等于\nisLess:小于\nisLessEqual:小于等于" + value: + type: string + description: 筛选值 + x-apifox-orders: + - condition_id + - field_id + - field_type + - operator + - value + description: 筛选条件 + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + required: + - condition_omitted + - conditions + - conjunction + x-apifox-orders: + - condition_omitted + - conditions + - conjunction + description: 过滤条件 + hidden_fields: + type: 'null' + description: 隐藏字段ID列表 + required: + - filter_info + - hidden_fields + x-apifox-orders: + - filter_info + - hidden_fields + description: 视图属性 + required: + - view_id + - view_name + - view_type + - property + x-apifox-orders: + - view_id + - view_name + - view_type + - property + description: 视图信息 + required: + - view + x-apifox-orders: + - view + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewsOleexJ + view_name: grid + view_type: grid + property: + filter_info: + condition_omitted: null + conditions: + - condition_id: conuKMQNNg + field_id: fldVioUai1 + field_type: 1 + operator: is + value: '["text content"]' + conjunction: and + hidden_fields: null + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955123-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.22 列出视图 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020922.md` + +# 列出视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views: + get: + summary: 列出视图 + deprecated: false + description: >+ + 根据 app_token 和 table_id,获取数据表的所有视图 + + 该接口支持调用频率上限为 20 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: page_size + in: query + description: 分页大小 + required: true + example: '10' + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + description: 视图信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: 总数 + required: + - items + - page_token + - has_more + - total + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - view_id: vewTpR1urY + view_name: 甘特视图1 + view_type: gantt + page_token: vewdHB3HyE + has_more: false + total: 1 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020922-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.23 新增视图 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020923.md` + +# 新增视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views: + post: + summary: 新增视图 + deprecated: false + description: >+ + 在数据表中新增一个视图 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + view_name: + type: string + description: 视图名字 示例值:"表格视图1" + view_type: + type: string + description: >- + 视图类型 示例值:"grid" 可选值有: grid:表格视图 kanban:看板视图 gallery:画册视图 + gantt:甘特视图 + required: + - view_name + - view_type + example: + view_name: 表格视图1 + view_type: grid + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + view: + type: object + properties: + view_id: + type: string + view_name: + type: string + view_type: + type: string + required: + - view_id + - view_name + - view_type + x-apifox-orders: + - view_id + - view_name + - view_type + app.table.view: + type: object + properties: + view_id: + type: string + description: 视图Id + view_name: + type: string + description: 视图名字 + view_type: + type: string + description: 视图类型 + required: + - view_id + - view_name + - view_type + description: 视图 + x-apifox-orders: + - view_id + - view_name + - view_type + required: + - view + - app.table.view + x-apifox-orders: + - app.table.view + - view + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + view: + view_id: vewTpR1urY + view_name: 甘特视图1 + view_type: gantt + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020923-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.24 删除视图 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020924.md` + +# 删除视图 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}: + delete: + summary: 删除视图 + deprecated: false + description: >+ + 删除数据表中的视图 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 200 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 200 | 1254021 | EmptyViewName | + 视图名为空 | + + | 200 | 1254022 | InvalidViewName | + 视图名无效 | + + | 200 | 1254023 | LastViewDeleteForbidden | + 最后一个视图禁止删除 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/视图 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: path + description: 视图ID + required: true + example: vewTpR1urY + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/视图 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020924-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.25 更新表单元数据 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58955559.md` + +# 更新表单元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}: + patch: + summary: 更新表单元数据 + deprecated: false + description: >+ + 该接口用于更新表单中的元数据项 + + 该接口支持调用频率上限为 10 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnv1jIEppJdTCn3jOosabcef + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblz8nadEUdxNMt5 + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vew6oMbAa4 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: "\t 表单名称 示例值:\"表单\"" + description: + type: string + description: "\t 表单描述 示例值:\"表单描述\"" + shared: + type: boolean + description: "\t 是否开启共享 示例值:true" + shared_limit: + type: string + description: >- + 分享范围限制 示例值:"tenant_editable" 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: "\t 填写次数限制一次 示例值:true" + x-apifox-orders: + - name + - description + - shared + - shared_limit + - submit_limit_once + example: + name: 表单 + description: 表单描述 + shared: true + shared_limit: tenant_editable + submit_limit_once: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + form: + type: object + properties: + name: + type: string + description: 表单名称 + description: + type: string + description: 表单描述 + shared: + type: boolean + description: 是否开启共享 + shared_url: + type: string + description: 分享 URL + shared_limit: + type: string + description: >- + 分享范围限制 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 + anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: 填写次数限制一次 + required: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + x-apifox-orders: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + description: 表单元数据信息 + required: + - form + x-apifox-orders: + - form + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + form: + name: 表单 + description: 表单描述 + shared: true + shared_url: >- + https://bytedance.feishu.cn/share/base/shrcnCy1KAlpahNotmhRn1abcde + shared_limit: tenant_editable + submit_limit_once: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58955559-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.26 获取表单元数据 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58956188.md` + +# 获取表单元数据 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}: + get: + summary: 获取表单元数据 + deprecated: false + description: >+ + 获取表单的所有元数据项 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnv1jIEppJdTCn3jOosabcef + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblz8nadEUdxNMt5 + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vew6oMbAa4 + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + form: + type: object + properties: + name: + type: string + description: 表单名称 + description: + type: string + description: |+ + 表单描述 + + shared: + type: boolean + description: 是否开启共享 + shared_url: + type: string + description: 分享 URL + shared_limit: + type: string + description: >- + 分享范围限制 可选值有: off:仅邀请的人可填写 + tenant_editable:组织内获得链接的人可填写 + anyone_editable:互联网上获得链接的人可填写 + submit_limit_once: + type: boolean + description: |+ + 填写次数限制一次 + + required: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + x-apifox-orders: + - name + - description + - shared + - shared_url + - shared_limit + - submit_limit_once + description: 表单元数据信息 + required: + - form + x-apifox-orders: + - form + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + form: + name: 表单 + description: 表单描述 + shared: true + shared_url: >- + https://bytedance.feishu.cn/share/base/shrcnCy1KAlpahNotmhRn1abcde + shared_limit: tenant_editable + submit_limit_once: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58956188-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.27 更新表单问题 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58957318.md` + +# 更新表单问题 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields/{field_id}: + patch: + summary: 更新表单问题 + deprecated: false + description: >+ + 该接口用于更新表单中的问题项 + + 该接口支持调用频率上限为 10 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 400 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254102 | FileExceedLimit | + 超限 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vewTpR1urY + schema: + type: string + - name: field_id + in: path + description: 表单问题 ID + required: true + example: fldjX7dUj5 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + pre_field_id: + type: string + description: >- + 上一个表单问题 ID,用于支持调整表单问题的顺序,通过前一个表单问题的 field_id 来确定位置;如果 + pre_field_id 为空字符串,则说明要排到首个表单问题 示例值:"fldjX7dUj5" + title: + type: string + description: "\t 表单问题 示例值:\"多行文本\"" + description: + type: string + description: 问题描述 示例值:"多行文本描述" + required: + type: boolean + description: 是否必填 示例值:true + visible: + type: boolean + description: "\t 是否可见,当值为 false 时,不允许更新其他字段。 示例值:true" + x-apifox-orders: + - pre_field_id + - title + - description + - required + - visible + example: + pre_field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + field: + type: object + properties: + pre_field_id: + type: string + description: >+ + 上一个表单问题 ID,用于支持调整表单问题的顺序,通过前一个表单问题的 field_id + 来确定位置;如果 pre_field_id 为空字符串,则说明要排到首个表单问题 + + title: + type: string + description: 表单问题 + description: + type: string + description: 问题描述 + required: + type: boolean + description: 是否必填 + visible: + type: boolean + description: 是否可见,当值为 false 时,不允许更新其他字段。 + required: + - pre_field_id + - title + - description + - required + - visible + x-apifox-orders: + - pre_field_id + - title + - description + - required + - visible + description: 更新后的表单问题项 + required: + - field + x-apifox-orders: + - field + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + field: + pre_field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58957318-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.28 列出表单问题 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58958068.md` + +# 列出表单问题 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields: + get: + summary: 列出表单问题 + deprecated: false + description: >+ + 列出表单的所有问题项 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254004 | WrongTableId | + table_id 错误 | + + | 400 | 1254005 | WrongViewId | + view_id 错误 | + + | 400 | 1254006 | WrongRecordId | + 检查 record_id | + + | 400 | 1254007 | EmptyValue | + 空值 | + + | 400 | 1254008 | EmptyView | + 空视图 | + + | 400 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 400 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254016 | InvalidSort | + Sort参数错误 | + + | 400 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 400 | 1254019 | InvalidViewType | + 视图类型无效 | + + | 400 | 1254020 | ViewNameDuplicated | + 视图名重复 | + + | 400 | 1254021 | EmptyViewName | + 视图名为空 | + + | 400 | 1254022 | InvalidViewName | + 视图名无效 | + + | 400 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 404 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 404 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 404 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 404 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 404 | 1254049 | FormFieldNotFound | + form_field_id 不存在 | + + | 400 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 400 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 400 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 400 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 400 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 400 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 400 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 400 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 400 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 400 | 1254102 | FileExceedLimit | + 超限 | + + | 400 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 400 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 400 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 400 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 400 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 400 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/表单 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: 表格 ID + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: form_id + in: path + description: 表单 ID + required: true + example: vewTpR1urY + schema: + type: string + - name: page_size + in: query + description: 必填 描述 page_size int 否 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: '' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + field_id: + type: string + description: |+ + 表单问题 ID + + title: + type: string + description: 表单问题 + description: + type: string + description: 问题描述 + required: + type: boolean + description: |+ + 是否必填 + + visible: + type: boolean + description: 是否可见 + x-apifox-orders: + - field_id + - title + - description + - required + - visible + description: 表单问题信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: 总数 + required: + - items + - page_token + - has_more + - total + x-apifox-orders: + - items + - page_token + - has_more + - total + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - field_id: fldjX7dUj5 + title: 多行文本 + description: 多行文本描述 + required: true + visible: true + page_token: fld1lAbHh7 + has_more: true + total: 1 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/表单 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58958068-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.29 检索记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020911.md` + +# 检索记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + get: + summary: 检索记录 + deprecated: false + description: >+ + 该接口用于根据 record_id 的值检索现有记录 + + 该接口支持调用频率上限为 20 QPS + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1254303 | AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: record_id + in: path + description: |+ + 单条记录的 id + + 示例值:"recqwIwhc6" + + required: true + example: recn0hoyXL + schema: + type: string + - name: text_field_as_array + in: query + description: 控制多行文本字段数据的返回格式, true 表示以数组形式返回 示例值:true + required: false + example: 'true' + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + - name: display_formula_ref + in: query + description: 控制公式、查找引用是否显示完整的原样返回结果 + required: false + example: 'true' + schema: + type: string + - name: automatic_fields + in: query + description: >- + 控制是否返回自动计算的字段,例如 + created_by/created_time/last_modified_by/last_modified_time,true + 表示返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + record: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: integer + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + email: + type: string + en_name: + type: string + id: + type: string + name: + type: string + x-apifox-orders: + - email + - en_name + - id + - name + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + name: + type: string + size: + type: integer + tmp_url: + type: string + type: + type: string + url: + type: string + x-apifox-orders: + - file_token + - name + - size + - tmp_url + - type + - url + 对应 OKR: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + x-apifox-orders: + - text + - type + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + 多行文本: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + mentionType: + type: string + mentionNotify: + type: boolean + name: + type: string + token: + type: string + link: + type: string + required: + - text + - type + - mentionType + - token + - link + x-apifox-orders: + - text + - type + - mentionType + - mentionNotify + - name + - token + - link + description: ' text_field_as_array 为true时的结构' + 单向关联: + type: array + items: + type: object + properties: + type: + type: string + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + x-apifox-orders: + - type + - table_id + - record_ids + - text + 双向关联: + type: array + items: + type: object + properties: + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + type: + type: string + x-apifox-orders: + - table_id + - record_ids + - text + - type + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - record + x-apifox-orders: + - record + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + record: + fields: + 人力耗时: 64 + 人力评估: '8' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 我是最大的功能开发🥕 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + name: 2.gif + size: 10250625 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnkQWfV4XbHwzDngmezMGzXe + type: image/gif + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnkQWfV4XbHwzDngmezMGzXe/download + 对应 OKR: + - text: 新功能评审 + type: text + 截止日期: 1612108800000 + 文档地址: + link: https://bytedance.feishu.cn/drive/home/ + text: 文档备份 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + 多行文本: + - text: hello + type: text + - mentionType: User + mentionNotify: false + name: test + text: '@test' + token: ou_sfsdfsdfsdfsdfdsfsdfdsf + type: mention + - link: >- + https://test-sasdfsfsd.feishu-boe.cn/base/basbcq2aFvW8nFJpfOXa1111111 + mentionType: Bitable + text: 未命名多维表格 + token: basbcq2aFvW8nFJpfOXalx57ffb + type: mention + - text: 测试链接标题 + link: https://www.baidu.com/ + type: url + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: recn0hoyXL + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020911-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.30 列出记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020910.md` + +# 列出记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records: + get: + summary: 列出记录 + deprecated: false + description: >+ + 该接口用于列出数据表中的现有记录,单次最多列出 500 行记录,支持分页获取。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率),1000 QPM(Query Per + Minute,每分钟请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254016 | InvalidSort | + Sort参数错误 | + + | 200 | 1254018 | InvalidFilter | + Filter参数错误 | + + | 200 | 1254024 | InvalidFieldNames | + FieldNames参数错误 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254107 | FilterLengthExceedLimit | + Filter长度超限, 限制2,000个字符 | + + | 200 | 1254108 | SortLengthExceedLimit | + Sort长度超限, 限制1,000个字符 | + + | 200 | 1254109 | FormulaTableSizeExceedLimit | + 公式表大小超限 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1254303 | AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/记录 + - 商店应用 + - 自建应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnCMII2ORej2RItqpZZUNMIe + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblxI2tWaxP5dG7p + schema: + type: string + - name: view_id + in: query + description: 视图 id, 如filter或sort有值, view_id会被忽略 示例值:"vewqhz51lk" + required: false + example: vewqhz51lk + schema: + type: string + - name: filter + in: query + description: >- + filter, 不超过2000个字符, 不支持对高级字段属性(关联和公式)进行过滤筛选,仅支持字段文本值。详细请参考 + [记录筛选指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/list) + **示例值**:"AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150)" + required: false + example: AND(CurrentValue.[身高]>180, CurrentValue.[体重]>150) + schema: + type: string + - name: sort + in: query + description: sort, 不超过1000字符, 不支持对带特殊字段(关联和公式)的表的使用 示例值:"["字段1 DESC","字段2 ASC"]" + required: false + example: '["字段1 DESC","字段2 ASC"]' + schema: + type: string + - name: field_names + in: query + description: field_names 示例值:"["字段1"]" + required: false + example: '["字段1"]' + schema: + type: string + - name: text_field_as_array + in: query + description: 控制多行文本字段数据的返回格式, true 表示以数组形式返回 示例值:true + required: false + example: 'true' + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 示例值:"recn0hoyXL" + required: false + example: recn0hoyXL + schema: + type: string + - name: page_size + in: query + description: 分页大小 示例值:10 数据校验规则: 最大值:100 + required: false + example: '10' + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + - name: display_formula_ref + in: query + description: >- + 默认值为false,返回当前字段的默认类型和结果;当该参数的值为true时,公式 和 查找引用 类型的字段,将会以 被引用字段 + 的格式返回 + required: false + example: 'true' + schema: + type: string + - name: automatic_fields + in: query + description: >- + 控制是否返回自动计算的字段,例如 + created_by/created_time/last_modified_by/last_modified_time,true + 表示返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + items: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: string + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + email: + type: string + en_name: + type: string + id: + type: string + name: + type: string + required: + - email + - en_name + - id + - name + x-apifox-orders: + - email + - en_name + - id + - name + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + name: + type: string + size: + type: integer + tmp_url: + type: string + type: + type: string + url: + type: string + required: + - file_token + - name + - size + - tmp_url + - type + - url + x-apifox-orders: + - file_token + - name + - size + - tmp_url + - type + - url + 对应 OKR: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + required: + - text + - type + x-apifox-orders: + - text + - type + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + 单向关联: + type: array + items: + type: object + properties: + type: + type: string + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + required: + - type + - table_id + - record_ids + - text + x-apifox-orders: + - type + - table_id + - record_ids + - text + 双向关联: + type: array + items: + type: object + properties: + table_id: + type: string + record_ids: + type: array + items: + type: string + text: + type: string + type: + type: string + required: + - table_id + - record_ids + - text + - type + x-apifox-orders: + - table_id + - record_ids + - text + - type + 多行文本: + type: array + items: + type: object + properties: + text: + type: string + type: + type: string + mentionType: + type: string + mentionNotify: + type: boolean + name: + type: string + token: + type: string + link: + type: string + required: + - text + - type + - mentionType + - token + - link + x-apifox-orders: + - text + - type + - mentionType + - mentionNotify + - name + - token + - link + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + - 多行文本 + - 单向关联 + - 双向关联 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + required: + - has_more + - items + - page_token + - total + x-apifox-orders: + - has_more + - items + - page_token + - total + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + has_more: false + items: + - fields: + 人力耗时: '64' + 人力评估: '8' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 我是最大的功能开发🥕 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + name: 2.gif + size: 10250625 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnkQWfV4XbHwzDngmezMGzXe + type: image/gif + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnkQWfV4XbHwzDngmezMGzXe/download + 对应 OKR: + - text: 新功能评审 + type: text + 截止日期: 1612108800000 + 文档地址: + link: https://bytedance.feishu.cn/drive/home/ + text: 文档备份 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: recn0hoyXL + - fields: + 人力耗时: '16' + 人力评估: '2' + 任务执行人: + - email: huangpaopao@feishu.cn + en_name: Paopao Huang + id: ou_5fb00e0112212cc7012fe3a697336989 + name: 黄泡泡 + 任务描述: 新功能评审 + 任务附件: + - file_token: boxcnGk0FfG678EEurDN7dRyxag + name: Hawaii_1_15Retina_R.jpg + size: 5069121 + tmp_url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/batch_get_tmp_download_url?file_tokens=boxcnGk0FfG678EEurDN7dRyxag + type: image/jpeg + url: >- + https://open.feishu.cn/open-apis/drive/v1/medias/boxcnGk0FfG678EEurDN7dRyxag/download + 对应 OKR: + - text: 我是最大的功能开发🥕 + type: text + 截止日期: 1612368000000 + 文档地址: + link: https://www.baidu.com/ + text: 百度一下,你就知道 + 是否完成: true + 状态: 未进行 + 相关部门: + - 产品 + - 设计 + - 研发 + 多行文本: + - text: hello + type: text + - mentionType: User + mentionNotify: false + name: test + text: '@test' + token: ou_sfsdfsdfsdfsdfdsfsdfdsf + type: mention + - link: >- + https://test-sasdfsfsd.feishu-boe.cn/base/basbcq2aFvW8nFJpfOXa1111111 + mentionType: Bitable + text: 未命名多维表格 + token: basbcq2aFvW8nFJpfOXalx57ffb + type: mention + - text: 测试链接标题 + link: https://www.baidu.com/ + type: url + 单向关联: + - type: text + table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + text: 第一行 + 双向关联: + - table_id: tbltAvx3DYBw7PVj + record_ids: + - recl1IWVnB + - recrJk7SXT + text: 第一行,第二行 + type: text + record_id: reciKaDyVO + page_token: reciKaDyVO + total: 2 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020910-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.31 新增记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020912.md` + +# 新增记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records: + post: + summary: 新增记录 + deprecated: false + description: >+ + 该接口用于在数据表中新增一条记录 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254072 | Failed to convert phone field, please make sure + it is correct. | 电话字段错误 + | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254303 | + AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"bascng7vrxcxpig7geggXiCtadY" + required: true + example: bascng7vrxcxpig7geggXiCtadY + schema: + type: string + - name: table_id + in: path + description: table id 示例值:"tblUa9vcYjWQYJCj" + required: true + example: tblUa9vcYjWQYJCj + schema: + type: string + - name: user_id_type + in: query + description: |- + 用户 ID 类型 + + 示例值:"open_id" + + 可选值有: + + open_id:用户的 open id + union_id:用户的 union id + user_id:用户的 user id + 默认值:open_id + + 当值为 user_id,字段权限要求: + required: true + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + fields: + type: object + properties: + 人力耗时: + type: integer + 人力评估: + type: string + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 任务附件: + type: array + items: + type: object + properties: + file_token: + type: string + x-apifox-orders: + - file_token + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 文档地址: + type: object + properties: + link: + type: string + text: + type: string + required: + - link + - text + x-apifox-orders: + - link + - text + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力耗时 + - 人力评估 + - 任务执行人 + - 任务描述 + - 任务附件 + - 对应 OKR + - 截止日期 + - 文档地址 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + example: + fields: + 人力耗时: 64 + 人力评估: '8' + 任务执行人: + - id: ou_be7f7ff11f5107962c0493f59409508b + 任务描述: 功能开发萝卜 + 任务附件: + - file_token: boxcnkQWfV4XbHwzDngmezMGzXe + 对应 OKR: + - rec82XmuMO + - recZQCkzgd + 截止日期: 1612108800000 + 文档地址: + link: https://open.feishu.cn/drive/home/ + text: 我是可爱的 萝卜 + 是否完成: false + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + record: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - record + x-apifox-orders: + - record + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + record: + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recisKHorn + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020912-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.32 更新记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020914.md` + +# 更新记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + put: + summary: 更新记录 + deprecated: false + description: >- + 该接口用于更新数据表中的一条记录 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 403 | 1254027 | UploadAttachNotAllowed | + 附件未挂载, 禁止上传 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254045 | FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission denied. | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission denied. | + 仅企业版和旗舰版飞书支持行列权限 | + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: record_id + in: path + description: |- + 单条记录的 id + + 示例值:"recqwIwhc6" + required: true + example: recqwIwhc6 + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + example: + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + record: + type: object + properties: + record_id: + type: string + description: 记录 id + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - record_id + - fields + x-apifox-orders: + - fields + - record_id + description: >- + {"fields": {"人力评估": 2,"任务执行人": [{"id": + "ou_debc524b2d8cb187704df652b43d29de"}],"任务描述": + "多渠道收集用户反馈","对应 OKR": + ["recqwIwhc6","recOuEJMvN"],"截止日期": + 1609516800000,"是否完成": true,"状态": "已结束","相关部门": + ["销售","客服"]}} + required: + - record + x-apifox-orders: + - record + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + record: + record_id: recm5qB61M + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1609516800000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020914-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.33 删除记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020916.md` + +# 删除记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}: + delete: + summary: 删除记录 + deprecated: false + description: >+ + 该接口用于删除数据表中的一条记录 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: record_id + in: path + description: |- + 单条记录的Id + + 示例值:"recpCsf4ME" + required: true + example: recpCsf4ME + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + deleted: + type: boolean + description: 是否成功删除 + record_id: + type: string + description: 删除的记录 ID + required: + - deleted + - record_id + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + deleted: true + record_id: recpCsf4ME + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020916-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.34 新增多条记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020913.md` + +# 新增多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create: + post: + summary: 新增多条记录 + deprecated: false + description: >+ + 该接口用于在数据表中新增多条记录,单次调用最多新增 500 条记录。 + + + 该接口支持调用频率上限为 10 QPS(Query Per Second,每秒请求率) + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254072 | Failed to convert phone field, please make sure + it is correct. | 电话字段错误 + | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254303 | + AttachPermNotAllow | + 附件无权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: user_id_type + in: query + description: "\t 用户 ID 类型 示例值:\"open_id\" 可选值有: open_id:标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID union_id:标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? user_id:标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 user ID" + required: false + schema: + type: string + - name: client_token + in: query + description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 + required: false + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - fields + x-apifox-orders: + - fields + description: 记录 + required: + - records + x-apifox-orders: + - records + example: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 链接 URL: + type: object + properties: + text: + type: string + link: + type: string + required: + - text + - link + x-apifox-orders: + - text + - link + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 链接 URL + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + msg: Success + data: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 链接 URL: + text: ' 多渠道反馈收集表格 ' + link: http://bitable.feishu.cn + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recsIbdRSC + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + record_id: recm5qB61M + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020913-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.35 更新多条记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020915.md` + +# 更新多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update: + post: + summary: 更新多条记录 + deprecated: false + description: >+ + 该接口用于更新数据表中的多条记录,单次调用最多更新 500 条记录。 + + 该接口支持调用频率上限为 10 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 403 | 1254027 | + UploadAttachNotAllowed | 附件未挂载, + 禁止上传 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254045 | + FieldNameNotFound | + 字段名字不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254068 | + URLFieldConvFail | + 超链接字段错误 | + + | 200 | 1254069 | + AttachFieldConvFail | + 附件字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254106 | + AttachExceedLimit | + 附件过多 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: user_id_type + in: query + description: >- + 用户 ID 类型 示例值:"open_id" 可选值有: open_id:用户的 open id union_id:用户的 + union id user_id:用户的 user id 默认值:open_id 当值为 user_id,字段权限要求: 获取用户 + user ID + required: false + example: open_id + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: object + properties: + record_id: + type: string + description: 记录 id 示例值:"recqwIwhc6" + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + required: + - record_id + - fields + x-apifox-orders: + - record_id + - fields + description: 记录 + required: + - records + x-apifox-orders: + - records + example: + records: + - record_id: recm5qB61M + fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + - record_id: recsIbdRSC + fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + fields: + type: object + properties: + 人力评估: + type: integer + 任务执行人: + type: array + items: + type: object + properties: + id: + type: string + required: + - id + x-apifox-orders: + - id + 任务描述: + type: string + 对应 OKR: + type: array + items: + type: string + 截止日期: + type: integer + 是否完成: + type: boolean + 状态: + type: string + 相关部门: + type: array + items: + type: string + required: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 状态 + - 相关部门 + x-apifox-orders: + - 人力评估 + - 任务执行人 + - 任务描述 + - 对应 OKR + - 截止日期 + - 是否完成 + - 状态 + - 相关部门 + description: 记录字段 + record_id: + type: string + description: 记录 id + required: + - fields + - record_id + x-apifox-orders: + - fields + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + records: + - fields: + 人力评估: 2 + 任务执行人: + - id: ou_debc524b2d8cb187704df652b43d29de + 任务描述: 多渠道收集用户反馈 + 对应 OKR: + - recqwIwhc6 + - recOuEJMvN + 截止日期: 1580486400000 + 是否完成: true + 状态: 已结束 + 相关部门: + - 销售 + - 客服 + record_id: recm5qB61M + - fields: + 人力评估: 8 + 任务执行人: + - id: ou_e62dbb75c6343147bc6690abd267067b + 任务描述: 功能开发 + 对应 OKR: + - recpCsf4ME + - recc5Ah5QB + 截止日期: 1580486400000 + 状态: 开发中 + 相关部门: + - 研发 + record_id: recsIbdRSC + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020915-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.36 删除多条记录 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020917.md` + +# 删除多条记录 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_delete: + post: + summary: 删除多条记录 + deprecated: false + description: >+ + 该接口用于删除数据表中现有的多条记录 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/记录 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: |- + bitable app token + + 示例值:"appbcbWCzen6D8dezhoCH2RpMAh" + required: true + example: bascnQtp6G6IOgCdBnslD4nHYTf + schema: + type: string + - name: table_id + in: path + description: |- + table id + + 示例值:"tblsRc9GRRXKqhvW" + required: true + example: tblw0yvZe64e99t6 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + records: + type: array + items: + type: string + description: 删除的多条记录id列表 示例值:["recIcJBbvC","recvmiCORa"] + required: + - records + example: + records: + - recIcJBbvC + - recvmiCORa + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + records: + type: array + items: + type: object + properties: + deleted: + type: boolean + description: 是否成功删除 + record_id: + type: string + description: 删除的记录 ID + x-apifox-orders: + - deleted + - record_id + description: 记录 + required: + - records + x-apifox-orders: + - records + description: '-' + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + records: + - deleted: true + record_id: recpCsf4ME + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/记录 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020917-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.37 列出字段 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020918.md` + +# 列出字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields: + get: + summary: 列出字段 + deprecated: false + description: >+ + 根据 app_token 和 table_id,获取数据表的所有字段 + + 该接口支持调用频率上限为 20 QPS + + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254004 | WrongTableId | + table_id 错误 | + + | 200 | 1254005 | WrongViewId | + view_id 错误 | + + | 200 | 1254006 | WrongRecordId | + 检查 record_id | + + | 200 | 1254007 | EmptyValue | + 空值 | + + | 200 | 1254008 | EmptyView | + 空视图 | + + | 200 | 1254009 | WrongFieldId | + 字段 id 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 200 | 1254012 | NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254030 | TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 200 | 1254041 | TableIdNotFound | + table_id 不存在 | + + | 200 | 1254042 | ViewIdNotFound | + view_id 不存在 | + + | 200 | 1254043 | RecordIdNotFound | + record_id 不存在 | + + | 200 | 1254044 | FieldIdNotFound | + field_id 不存在 | + + | 200 | 1254060 | TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | ActionValidateFailed | + Action验证失败 | + + | 200 | 1254100 | TableExceedLimit | + 数据表数量超限, 限制300个 | + + | 200 | 1254101 | ViewExceedLimit | + 视图数量超限, 限制200个 | + + | 200 | 1254102 | FileExceedLimit | + 超限 | + + | 200 | 1254103 | RecordExceedLimit | + 记录数量超限, 限制20,000条 | + + | 200 | 1254104 | RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again later | + 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: view_id + in: query + description: 视图 ID + required: false + example: vewOVMEXPF + schema: + type: string + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: fldwJ4YrtB + schema: + type: string + - name: page_size + in: query + description: 分页大小 + required: false + example: '10' + schema: + type: string + - name: text_field_as_array + in: query + description: 控制字段描述(多行文本格式)数据的返回格式, true 表示以数组富文本形式返回 + required: false + example: 'true' + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + has_more: + type: boolean + description: 是否还有更多项 + items: + type: array + items: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + property: + type: object + properties: + formatter: + type: string + description: 数字、公式字段的显示格式 + options: + type: array + items: + type: object + properties: + color: + type: integer + description: 选项颜色 + id: + type: string + description: 选项id + name: + type: string + description: 选项名 + required: + - color + - id + - name + x-apifox-orders: + - color + - id + - name + description: 单选、多选字段的选项信息 + auto_fill: + type: boolean + description: 日期字段中新纪录自动填写创建时间 + date_formatter: + type: string + description: 日期、创建时间、最后更新时间字段的显示格式 + multiple: + type: boolean + description: 人员字段中允许添加多个成员,单向关联、双向关联中允许添加多个记录 + table_id: + type: string + description: 单向关联、双向关联字段中关联的数据表的id + table_name: + type: string + description: 单向关联、双向关联字段中关联的数据表的名字 + formula_expression: + type: string + back_field_id: + type: string + description: "\t 双向关联字段中关联的数据表中对应的双向关联字段的id" + back_field_name: + type: string + description: 双向关联字段中关联的数据表中对应的双向关联字段的名字 + location: + type: object + properties: + input_type: + type: string + required: + - input_type + x-apifox-orders: + - input_type + auto_serial: + type: object + properties: + type: + type: string + options: + type: array + items: + type: object + properties: + value: + type: string + type: + type: string + required: + - value + - type + x-apifox-orders: + - value + - type + required: + - type + x-apifox-orders: + - type + - options + required: + - auto_serial + - date_formatter + x-apifox-orders: + - formatter + - options + - auto_fill + - date_formatter + - multiple + - table_id + - table_name + - back_field_id + - back_field_name + - formula_expression + - location + - auto_serial + description: >- + 字段属性,具体参考:[字段编辑指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-field/guide) + type: + type: integer + description: 多维表格字段类型 + required: + - field_id + - field_name + - property + - type + x-apifox-orders: + - field_id + - field_name + - property + - type + description: 字段信息 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + required: + - has_more + - items + - page_token + - total + x-apifox-orders: + - has_more + - items + - page_token + - total + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + has_more: false + items: + - field_id: fldjX7dUj5 + field_name: 多行文本 + property: null + type: 1 + - field_id: fldoMnnvIR + field_name: 数字 + property: + formatter: '0.00' + type: 2 + - field_id: fld2RxOyB8 + field_name: 单选 + property: + options: + - color: 0 + id: optpeuQVqp + name: a++ + - color: 1 + id: opt5g3xLFT + name: b + - color: 6 + id: opt558YmTi + name: z + type: 3 + - field_id: fldHBDkAfH + field_name: 日期 + property: + auto_fill: false + date_formatter: yyyy/MM/dd HH:mm + type: 5 + - field_id: fld1lAbHh7 + field_name: 复选框 + property: null + type: 7 + - field_id: fldlQDzjyK + field_name: 人员 + property: + multiple: true + type: 11 + - field_id: fldEahozCL + field_name: 超链接 + property: null + type: 15 + - field_id: fldxZLsTge + field_name: 附件 + property: null + type: 17 + - field_id: fldNdr8VNW + field_name: 单向关联 + property: + multiple: true + table_id: tblw92ErelmCmgHc + table_name: 数据表2 + type: 18 + - field_id: fldNaywkor + field_name: 查找引用 + property: null + type: 19 + - field_id: fldFuAdYEI + field_name: 公式 + property: + formatter: 0.00% + formula_expression: >- + IF(bitable::$table[tblxxxxxxxxxxxxx].$field[fldxxxxxxx].CONTAIN("飞书"),"aaa","bbb") + type: 20 + - field_id: fldpfIDIi0 + field_name: 双向关联 + property: + back_field_id: fldmQGUnWh + back_field_name: 双向关联-自动生成 + multiple: true + table_id: tblw92ErelmCmgHc + table_name: 数据表2 + type: 21 + - field_id: fldoblwmUC + field_name: 创建时间 + property: + date_formatter: yyyy/MM/dd + type: 1001 + - field_id: fldd1bPCW7 + field_name: 创建人 + property: null + type: 1003 + - field_id: fldZXPWBrP + field_name: 电话号码 + type: 13 + property: null + - field_id: fldtuzPEKC + field_name: 地理位置 + type: 22 + property: + location: + input_type: not_limit + - field_id: fldEG65yiU + field_name: 自动编号 + type: 1005 + property: + auto_serial: + type: custom + options: + - value: '1' + type: system_number + - value: MMdd + type: created_time + - type: created_time + value: yyyyMMdd + - type: created_time + value: MM + - field_id: fldwq16vz2 + field_name: 自增数字自动编号 + type: 1005 + property: + auto_serial: + type: auto_increment_number + page_token: fldd1bPCW7 + total: 18 + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020918-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.38 新增字段 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020919.md` + +# 新增字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields: + post: + summary: 新增字段 + deprecated: false + description: >+ + 该接口用于在数据表中新增一个字段 + + + 该接口支持调用频率上限为 10 QPS + + + 首次调用请参考 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | + 描述 | + 排查建议 | + + | ---------- | ------- | + ------------------------------------------------------------ | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254026 | + EmptyOptionName | + 选项名不能为空 | + + | 400 | 1254028 | + EmptyFieldName | + 字段名为空 | + + | 400 | 1254029 | + InvalidFieldName | + 字段名无效 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 + | + + | 400 | 1254037 | Invalid client token, make sure that it + complies with the specification. | 幂等键格式错误,需要传入 uuid + 格式 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 400 | 1254080 | + TextFieldPropertyError | + 多行文本字段property错误 | + + | 400 | 1254081 | + NumberFieldPropertyError | + 数字字段property错误 | + + | 400 | 1254082 | + SingleSelectFieldPropertyError | + 单选字段property错误 | + + | 400 | 1254083 | + MultiSelectFieldPropertyError | + 多选字段property错误 | + + | 400 | 1254084 | + DateFieldPropertyError | + 日期字段property错误 | + + | 400 | 1254085 | + CheckboxFieldPropertyError | + 复选框字段property错误 | + + | 400 | 1254086 | + UserFieldPropertyError | + 人员字段property错误 | + + | 400 | 1254087 | + URLFieldPropertyError | + 超链接字段property错误 | + + | 400 | 1254088 | + AttachFieldPropertyError | + 附件字段property错误 | + + | 400 | 1254089 | + LinkFieldPropertyError | + 单向关联字段property错误 | + + | 400 | 1254090 | + LookUpFieldPropertyError | + 查找引用字段property错误 | + + | 400 | 1254091 | + FormulaFieldPropertyError | + 公式字段property错误 | + + | 400 | 1254092 | + DuplexLinkFieldPropertyError | + 双向关联字段property错误 | + + | 400 | 1254093 | + CreatedTimeFieldPropertyError | + 创建时间字段property错误 | + + | 400 | 1254094 | + ModifiedTimeFieldPropertyError | + 最后更新时间字段property错误 | + + | 400 | 1254095 | + CreatedUserFieldPropertyError | + 创建人字段property错误 | + + | 400 | 1254096 | + ModifiedUserFieldPropertyError | + 修改人字段property错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | + 单次添加记录数量超限, 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 400 | 1255006 | Client token conflict, please generate a new + client token and try again. | 幂等键冲突,需要重新随机生成一个幂等键 + | + + | 504 | 1255040 | + 请求超时 | + 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | Permission + denied. | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Permission + denied. | + 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: client_token + in: query + description: 格式为标准的 uuid,操作的唯一标识,用于幂等的进行更新操作。此值为空表示将发起一次新的请求,此值非空表示幂等的进行更新操作。 + required: false + example: fe599b60-450f-46ff-b2ef-9f6675625b97 + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + field_name: + type: string + description: 多维表格字段名 示例值:"多行文本" + type: + type: integer + description: 多维表格字段类型 + required: + - field_name + - type + x-apifox-orders: + - field_name + - type + example: + field_name: test + type: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + field: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + type: + type: integer + description: 多维表格字段类型 + property: + type: 'null' + description: 字段属性 + required: + - field_id + - field_name + - type + - property + description: 字段 + required: + - field + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + example: + code: 0 + data: + field: + field_id: fld4bocNLY + field_name: test + type: 1 + property: null + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020919-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.39 更新字段 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020920.md` + +# 更新字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}: + put: + summary: 更新字段 + deprecated: false + description: >+ + 该接口用于在数据表中更新一个字段 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254026 | + EmptyOptionName | + 选项名不能为空 | + + | 400 | 1254028 | + EmptyFieldName | + 字段名为空 | + + | 400 | 1254029 | + InvalidFieldName | + 字段名无效 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 400 | 1254080 | + TextFieldPropertyError | + 多行文本字段property错误 | + + | 400 | 1254081 | + NumberFieldPropertyError | + 数字字段property错误 | + + | 400 | 1254082 | + SingleSelectFieldPropertyError | + 单选字段property错误 | + + | 400 | 1254083 | + MultiSelectFieldPropertyError | + 多选字段property错误 | + + | 400 | 1254084 | + DateFieldPropertyError | + 日期字段property错误 | + + | 400 | 1254085 | + CheckboxFieldPropertyError | + 复选框字段property错误 | + + | 400 | 1254086 | + UserFieldPropertyError | + 人员字段property错误 | + + | 400 | 1254087 | + URLFieldPropertyError | + 超链接字段property错误 | + + | 400 | 1254088 | + AttachFieldPropertyError | + 附件字段property错误 | + + | 400 | 1254089 | + LinkFieldPropertyError | + 单向关联字段property错误 | + + | 400 | 1254090 | + LookUpFieldPropertyError | + 查找引用字段property错误 | + + | 400 | 1254091 | + FormulaFieldPropertyError | + 公式字段property错误 | + + | 400 | 1254092 | + DuplexLinkFieldPropertyError | + 双向关联字段property错误 | + + | 400 | 1254093 | + CreatedTimeFieldPropertyError | + 创建时间字段property错误 | + + | 400 | 1254094 | + ModifiedTimeFieldPropertyError | + 最后更新时间字段property错误 | + + | 400 | 1254095 | + CreatedUserFieldPropertyError | + 创建人字段property错误 | + + | 400 | 1254096 | + ModifiedUserFieldPropertyError | + 修改人字段property错误 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1254606 | + DataNotChange | + 数据无变更 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: field_id + in: path + description: field id + required: true + example: fldPTb0U2y + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + field_name: + type: string + description: 多维表格字段名 示例值:"多行文本" + type: + type: integer + description: 多维表格字段类型 + required: + - field_name + - type + x-apifox-orders: + - field_name + - type + example: + field_name: test2 + type: 1 + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + data: + type: object + properties: + field: + type: object + properties: + field_id: + type: string + description: 多维表格字段 id + field_name: + type: string + description: 多维表格字段名 + type: + type: integer + description: 多维表格字段类型 + property: + type: 'null' + description: 字段属性 + required: + - field_id + - field_name + - type + - property + x-apifox-orders: + - field_id + - field_name + - type + - property + description: 字段 + required: + - field + x-apifox-orders: + - field + description: '-' + msg: + type: string + description: 错误描述 + required: + - code + - data + - msg + x-apifox-orders: + - code + - data + - msg + example: + code: 0 + data: + field: + field_id: fldwrEQHef + field_name: test2 + type: 1 + property: null + msg: Success + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020920-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.40 删除字段 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-9020921.md` + +# 删除字段 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}: + delete: + summary: 删除字段 + deprecated: false + description: >+ + 该接口用于在数据表中删除一个字段 + + 该接口支持调用频率上限为 10 QPS + + 关于云文档接口的 AccessToken 调用说明详见 + [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254004 | + WrongTableId | table_id + 错误 | + + | 200 | 1254005 | + WrongViewId | view_id + 错误 | + + | 200 | 1254006 | + WrongRecordId | 检查 + record_id | + + | 200 | 1254007 | + EmptyValue | + 空值 | + + | 200 | 1254008 | + EmptyView | + 空视图 | + + | 200 | 1254009 | + WrongFieldId | 字段 id + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 200 | 1254012 | + NotSupportFieldOrView | + 不支持的字段或视图 | + + | 200 | 1254013 | + TableNameDuplicated | + 表名重复 | + + | 200 | 1254014 | + FieldNameDuplicated | + 字段名重复 | + + | 200 | 1254015 | + FieldTypeValueNotMatch | + 字段类型和值不匹配 | + + | 200 | 1254030 | + TooLargeResponse | + 响应体过大 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 200 | 1254041 | + TableIdNotFound | table_id + 不存在 | + + | 200 | 1254042 | + ViewIdNotFound | view_id + 不存在 | + + | 200 | 1254043 | + RecordIdNotFound | record_id + 不存在 | + + | 200 | 1254044 | + FieldIdNotFound | field_id + 不存在 | + + | 200 | 1254060 | + TextFieldConvFail | + 多行文本字段错误 | + + | 200 | 1254061 | + NumberFieldConvFail | + 数字字段错误 | + + | 200 | 1254062 | + SingleSelectFieldConvFail | + 单选字段错误 | + + | 200 | 1254063 | + MultiSelectFieldConvFail | + 多选字段错误 | + + | 200 | 1254064 | + DatetimeFieldConvFail | + 日期字段错误 | + + | 200 | 1254065 | + CheckboxFieldConvFail | + 复选框字段错误 | + + | 200 | 1254066 | + UserFieldConvFail | + 人员字段错误 | + + | 200 | 1254067 | + LinkFieldConvFail | + 关联字段错误 | + + | 200 | 1254070 | + ActionValidateFailed | + Action验证失败 | + + | 200 | 1254100 | + TableExceedLimit | 数据表数量超限, + 限制300个 | + + | 200 | 1254101 | + ViewExceedLimit | 视图数量超限, + 限制200个 | + + | 200 | 1254102 | + FileExceedLimit | + 超限 | + + | 200 | 1254103 | + RecordExceedLimit | 记录数量超限, + 限制20,000条 | + + | 200 | 1254104 | + RecordAddOnceExceedLimit | 单次添加记录数量超限, + 限制500条 | + + | 200 | 1254105 | + ColumnExceedLimit | + 字段数量超限 | + + | 200 | 1254130 | + TooLargeCell | + 格子内容过大 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 200 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 200 | 1255005 | + ConvError | + 内部错误,有疑问可咨询客服处 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + | 400 | 1254607 | Data not ready, please try again + later | 出现这个错误通常有两种情况:1. 上次提交的修改还没有处理完;2. + 数据太大,服务器计算超时;遇到这个错误码可以适当进行重试。 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + + tags: + - 云文档/多维表格/字段 + - 自建应用 + - 商店应用 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: table_id + in: path + description: table id + required: true + example: tblsRc9GRRXKqhvW + schema: + type: string + - name: field_id + in: path + description: field id + required: true + example: fldPTb0U2y + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + field_id: + type: string + description: field id + deleted: + type: boolean + description: 删除标记 + required: + - field_id + - deleted + description: '-' + required: + - code + - msg + - data + example: + code: 0 + msg: success + data: + field_id: fldPTb0U2y + deleted: true + headers: {} + x-apifox-name: 200 Success + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/字段 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-9020921-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.41 列出自定义角色 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961268.md` + +# 列出自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles: + get: + summary: 列出自定义角色 + deprecated: false + description: >+ + 列出自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:10 数据校验规则: 最大值:30" + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: roljRpwIUt + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + role_id: + type: string + description: 自定义角色的id + role_name: + type: string + description: 自定义角色的名字 + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: 数据表名 + table_id: + type: string + description: |+ + 数据表ID + + table_perm: + type: integer + description: "\t 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录" + allow_add_record: + type: boolean + allow_delete_record: + type: boolean + rec_rule: + type: object + properties: + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: ' 创建人 包含 访问者本人' + field_type: + type: integer + description: 字段类型 + operator: + type: string + description: >- + 运算符 可选值有: is:等于 isNot:不等于 contains:包含 + doesNotContain:不包含 isEmpty:为空 + isNotEmpty:不为空 + value: + type: array + items: + type: string + description: 单选或多选字段的选项id + required: + - field_name + - field_type + - operator + - value + x-apifox-orders: + - field_name + - field_type + - operator + - value + description: 记录筛选条件 + other_perm: + type: integer + description: >- + 其他记录权限,仅在table_perm为2时有意义 可选值有: 0:禁止查看 + 1:仅可阅读 + required: + - conditions + - other_perm + - conjunction + x-apifox-orders: + - conjunction + - conditions + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 单选: + type: integer + 年龄: + type: integer + required: + - 单选 + - 年龄 + x-apifox-orders: + - 单选 + - 年龄 + description: >- + 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 + map,key 是字段名,value 是字段权限 value 枚举值有: + 1:可阅读 2:可编辑 + required: + - table_name + - table_id + - table_perm + - rec_rule + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: 数据表角色 + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: |+ + Block 的 ID,例如列出仪表盘接口中的仪表盘 block id + + block_type: + type: string + description: Block类型 可选值有: dashboard:仪表盘 + block_perm: + type: integer + description: "\t Block权限 可选值有: 0:无权限 1:可阅读" + required: + - block_id + - block_type + - block_perm + x-apifox-orders: + - block_id + - block_type + - block_perm + description: |+ + block权限 + + x-apifox-orders: + - role_id + - role_name + - table_roles + - block_roles + description: 自定义角色列表 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + has_more: + type: boolean + description: 是否还有更多项 + total: + type: integer + description: |+ + 总数 + + required: + - items + - page_token + - has_more + - total + x-apifox-orders: + - items + - page_token + - has_more + - total + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: + items: + - role_id: rola66uIZT + role_name: role1 + table_roles: + - table_name: table1 + table_id: tblFIgBzKEq75HSE + table_perm: 2 + allow_add_record: false + allow_delete_record: true + rec_rule: + conjunction: or + conditions: + - field_name: 单选 + field_type: 3 + operator: is + value: + - optbdVHf4q + - field_name: 人员 + field_type: 11 + operator: contains + value: null + - field_name: '' + field_type: 1003 + operator: contains + value: null + other_perm: 0 + field_perm: + 单选: 1 + 年龄: 2 + - table_name: table2 + table_id: tblMPI6OC1aWvTvs + table_perm: 1 + rec_rule: + conditions: + - field_name: 人员 + field_type: 11 + operator: contains + value: null + - field_name: 多选 + field_type: 4 + operator: is + value: + - opttgKOTSt + - optWcdXR0W + other_perm: 0 + conjunction: and + - table_name: table3 + table_id: tblmkLF7Tg6IWbRb + table_perm: 0 + - table_name: table4 + table_id: tbl5VQHDTms19Qe7 + table_perm: 4 + block_roles: + - block_id: blknkqrP3RqUkcAW + block_type: dashboard + block_perm: 0 + - block_id: blkAjxjWKvbBi7EA + block_type: dashboard + block_perm: 1 + page_token: rola66uIZT + has_more: false + total: 1 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58961268-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.42 新增自定义角色 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58961961.md` + +# 新增自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles: + post: + summary: 新增自定义角色 + deprecated: false + description: >+ + 新增自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254032 | + InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | + RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254047 | + RoleIdNotFound | role_id + 不存在 | + + | 400 | 1254110 | + RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + role_name: + type: string + description: 自定义角色的名字 示例值:"自定义角色1" + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: "\t 数据表名 示例值:\"数据表1\"" + table_id: + type: string + description: "\t 数据表ID 示例值:\"tblKz5D60T4JlfcT\"" + table_perm: + type: integer + description: >- + 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 + 示例值:0 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录 默认值:0 + allow_add_record: + type: boolean + description: >- + 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 示例值:true + 默认值:true + allow_delete_record: + type: boolean + description: >- + 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 示例值:true + 默认值:true + rec_rule: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: ' 创建人 包含 访问者本人' + operator: + type: string + value: + type: array + items: + type: string + required: + - field_name + - operator + - value + x-apifox-orders: + - field_name + - operator + - value + description: 记录筛选条件 数据校验规则: 最大长度:100 + conjunction: + type: string + description: 多个筛选条件的关系 示例值:"and" 可选值有: and:与 or:或 默认值:and + other_perm: + type: integer + description: >- + 其他记录权限,仅在table_perm为2时有意义 示例值:0 可选值有: 0:禁止查看 + 1:仅可阅读 默认值:0 + required: + - conditions + x-apifox-orders: + - conditions + - conjunction + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 年龄: + type: integer + 单选: + type: integer + required: + - 年龄 + - 单选 + x-apifox-orders: + - 年龄 + - 单选 + description: "\t 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 map,key 是字段名,value 是字段权限 value 枚举值有: 1:可阅读 2:可编辑" + required: + - rec_rule + - table_perm + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: "\t 数据表角色 数据校验规则: 最大长度:100" + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: "\t Block 的 ID,例如列出仪表盘接口中的仪表盘 block id 示例值:\"blknkqrP3RqUkcAW\"" + block_perm: + type: integer + description: "\t Block权限 示例值:0 可选值有: 0:无权限 1:可阅读 默认值:0" + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: "\t block权限 数据校验规则: 最大长度:100" + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + example: "{\r\n \"role_name\": \"role1\",\r\n \"table_roles\": [\r\n {\r\n \"table_name\": \"table1\",\r\n \"table_id\": \"tblFIgBzKEq75HSE\",\r\n \"table_perm\": 2,\r\n \"allow_add_record\": false,\r\n \"allow_delete_record\": true,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"单选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"optbdVHf4q\"\r\n ]\r\n },\r\n {\r\n \"field_name\": \"人员\" // 人员 包含 访问者本人\r\n },\r\n {\r\n \"field_name\": \"\" // 创建人 包含 访问者本人\r\n }\r\n ],\r\n \"conjunction\": \"or\",\r\n \"other_perm\": 0\r\n },\r\n \"field_perm\": {\r\n \"年龄\": 2,\r\n \"单选\": 1\r\n }\r\n },\r\n {\r\n \"table_name\": \"table2\",\r\n \"table_id\": \"tblMPI6OC1aWvTvs\",\r\n \"table_perm\": 1,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"人员\"\r\n },\r\n {\r\n \"field_name\": \"多选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"opttgKOTSt\",\r\n \"optWcdXR0W\"\r\n ]\r\n }\r\n ],\r\n \"conjunction\": \"and\"\r\n }\r\n },\r\n {\r\n \"table_name\": \"table3\",\r\n \"table_id\": \"tblmkLF7Tg6IWbRb\",\r\n \"table_perm\": 0\r\n },\r\n {\r\n \"table_name\": \"table4\",\r\n \"table_id\": \"tbl5VQHDTms19Qe7\",\r\n \"table_perm\": 4\r\n }\r\n ],\r\n \"block_roles\": [\r\n {\r\n \"block_id\": \"blknkqrP3RqUkcAW\",\r\n \"block_perm\": 0\r\n },\r\n {\r\n \"block_id\": \"blkAjxjWKvbBi7EA\",\r\n \"block_perm\": 1\r\n }\r\n ]\r\n}" + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58961961-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.43 删除自定义角色 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58962762.md` + +# 删除自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}: + delete: + summary: 删除自定义角色 + deprecated: false + description: >+ + 删除自定义角色 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: |+ + 错误码,非 0 表示失败 + + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58962762-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.44 更新自定义角色 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963075.md` + +# 更新自定义角色 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}: + put: + summary: 更新自定义角色 + deprecated: false + description: >+ + 更新自定义角色 + + 更新自定义角色是全量更新,会完全覆盖旧的自定义角色设置 + + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | + --------------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | + WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | + WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | + Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | + WrongBaseToken | app_token + 错误 | + + | 200 | 1254010 | + ReqConvError | + 请求错误 | + + | 400 | 1254032 | + InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | + RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again + later. | 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | + BaseTokenNotFound | app_token + 不存在 | + + | 404 | 1254047 | + RoleIdNotFound | role_id + 不存在 | + + | 400 | 1254110 | + RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 200 | 1254290 | + TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write + conflict | 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | + OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | + RolePermNotAllow | 无访问权限, + 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 403 | 1254304 | Only Available For Business and Enterprise + Editions | 仅企业版和旗舰版飞书支持行列权限 | + + | 200 | 1255001 | + InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | + RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | + MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | + UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 + | 进行重试 | + + tags: + - 云文档/多维表格/高级权限/自定义角色 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + role_name: + type: string + description: "\t 自定义角色的名字 示例值:\"自定义角色1\"" + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: "\t 数据表名 示例值:\"数据表1\"" + table_id: + type: string + description: "\t 数据表ID 示例值:\"tblKz5D60T4JlfcT\"" + table_perm: + type: integer + description: "\t\n数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果\n\n示例值:0\n\n可选值有:\n\n0:无权限\n1:可阅读\n2:可编辑记录\n4:可编辑字段和记录\n默认值:0" + allow_add_record: + type: boolean + description: "\t 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 示例值:true 默认值:true" + allow_delete_record: + type: boolean + description: "\t 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 示例值:true 默认值:true" + rec_rule: + type: object + properties: + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: "\t 字段名,记录筛选条件是创建人包含访问者本人时,此参数值为\"\" 示例值:\"单选\"" + operator: + type: string + description: |- + 运算符 + + 示例值:"is" + + 可选值有: + + is:等于 + isNot:不等于 + contains:包含 + doesNotContain:不包含 + isEmpty:为空 + isNotEmpty:不为空 + 默认值:is + value: + type: array + items: + type: string + description: "\t 单选或多选字段的选项id 示例值:[\"optbdVHf4q\", \"optrpd3eIJ\"]" + required: + - field_name + - operator + - value + x-apifox-orders: + - field_name + - operator + - value + description: "\t 记录筛选条件 数据校验规则: 最大长度:100" + conjunction: + type: string + description: "\t 多个筛选条件的关系 示例值:\"and\" 可选值有: and:与 or:或 默认值:and" + other_perm: + type: integer + description: "\t 其他记录权限,仅在table_perm为2时有意义 示例值:0 可选值有: 0:禁止查看 1:仅可阅读 默认值:0" + required: + - conditions + - conjunction + x-apifox-orders: + - conditions + - conjunction + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 年龄: + type: integer + 单选: + type: integer + required: + - 年龄 + - 单选 + x-apifox-orders: + - 年龄 + - 单选 + description: "\t 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 map,key 是字段名,value 是字段权限 value 枚举值有: 1:可阅读 2:可编辑" + required: + - table_perm + x-apifox-orders: + - table_name + - table_id + - table_perm + - allow_add_record + - allow_delete_record + - rec_rule + - field_perm + description: "\t 数据表角色 数据校验规则: 最大长度:100" + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + description: "\t Block 的 ID,例如列出仪表盘接口中的仪表盘 block id 示例值:\"blknkqrP3RqUkcAW\"" + block_perm: + type: integer + description: "\t Block权限 示例值:0 可选值有: 0:无权限 1:可阅读 默认值:0" + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: "\t block权限 数据校验规则: 最大长度:100" + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + example: "{\r\n \"role_name\": \"role1\",\r\n \"table_roles\": [\r\n {\r\n \"table_name\": \"table1\",\r\n \"table_id\": \"tblFIgBzKEq75HSE\",\r\n \"table_perm\": 2,\r\n \"allow_add_record\": false,\r\n \"allow_delete_record\": true,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"单选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"optbdVHf4q\"\r\n ]\r\n },\r\n {\r\n \"field_name\": \"人员\" // 人员 包含 访问者本人\r\n },\r\n {\r\n \"field_name\": \"\" // 创建人 包含 访问者本人\r\n }\r\n ],\r\n \"conjunction\": \"or\",\r\n \"other_perm\": 0\r\n },\r\n \"field_perm\": {\r\n \"年龄\": 2,\r\n \"单选\": 1\r\n }\r\n },\r\n {\r\n \"table_name\": \"table2\",\r\n \"table_id\": \"tblMPI6OC1aWvTvs\",\r\n \"table_perm\": 1,\r\n \"rec_rule\": {\r\n \"conditions\": [\r\n {\r\n \"field_name\": \"人员\"\r\n },\r\n {\r\n \"field_name\": \"多选\",\r\n \"operator\": \"is\",\r\n \"value\": [\r\n \"opttgKOTSt\",\r\n \"optWcdXR0W\"\r\n ]\r\n }\r\n ],\r\n \"conjunction\": \"and\"\r\n }\r\n },\r\n {\r\n \"table_name\": \"table3\",\r\n \"table_id\": \"tblmkLF7Tg6IWbRb\",\r\n \"table_perm\": 0\r\n },\r\n {\r\n \"table_name\": \"table4\",\r\n \"table_id\": \"tbl5VQHDTms19Qe7\",\r\n \"table_perm\": 4\r\n }\r\n ],\r\n \"block_roles\": [\r\n {\r\n \"block_id\": \"blknkqrP3RqUkcAW\",\r\n \"block_perm\": 0\r\n },\r\n {\r\n \"block_id\": \"blkAjxjWKvbBi7EA\",\r\n \"block_perm\": 1\r\n }\r\n ]\r\n}" + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + role: + type: object + properties: + role_name: + type: string + description: 自定义角色的名字 + table_roles: + type: array + items: + type: object + properties: + table_name: + type: string + description: 数据表名 + table_id: + type: string + description: 数据表ID + table_perm: + type: integer + description: >- + 数据表权限,协作者可编辑自己的记录和可编辑指定字段是可编辑记录的特殊情况,可通过指定rec_rule或field_perm参数实现相同的效果 + 可选值有: 0:无权限 1:可阅读 2:可编辑记录 4:可编辑字段和记录 + addrecords_perm: + type: boolean + description: 新增记录权限,仅在table_perm为2时有意义,用于设置记录是否可以新增。 + deleterecords_perm: + type: boolean + description: 删除记录权限,仅在table_perm为2时有意义,用于设置记录是否可以删除 + rec_rule: + type: object + properties: + conjunction: + type: string + description: 多个筛选条件的关系 可选值有: and:与 or:或 + conditions: + type: array + items: + type: object + properties: + field_name: + type: string + description: 字段名,记录筛选条件是创建人包含访问者本人时,此参数值为"" + operator: + type: string + description: "\t 运算符 可选值有: is:等于 isNot:不等于 contains:包含 doesNotContain:不包含 isEmpty:为空 isNotEmpty:不为空" + field_type: + type: integer + description: 字段类型 + value: + type: array + items: + type: string + description: 单选或多选字段的选项id + required: + - value + - field_name + - operator + - field_type + x-apifox-orders: + - field_name + - operator + - field_type + - value + description: 记录筛选条件 + other_perm: + type: integer + description: "\t 其他记录权限,仅在table_perm为2时有意义 可选值有: 0:禁止查看 1:仅可阅读" + required: + - conditions + - other_perm + - conjunction + x-apifox-orders: + - conjunction + - conditions + - other_perm + description: 记录筛选条件,在table_perm为1或2时有意义,用于指定可编辑或可阅读某些记录 + field_perm: + type: object + properties: + 单选: + type: integer + 年龄: + type: integer + required: + - 单选 + - 年龄 + x-apifox-orders: + - 单选 + - 年龄 + description: >- + 字段权限,仅在table_perm为2时有意义,设置字段可编辑或可阅读。类型为 + map,key 是字段名,value 是字段权限 + + + value 枚举值有: + + 1:可阅读 + + 2:可编辑 + required: + - table_name + - table_id + - table_perm + - rec_rule + x-apifox-orders: + - table_name + - table_id + - table_perm + - addrecords_perm + - deleterecords_perm + - rec_rule + - field_perm + description: 数据表角色 + block_roles: + type: array + items: + type: object + properties: + block_id: + type: string + block_perm: + type: integer + required: + - block_id + - block_perm + x-apifox-orders: + - block_id + - block_perm + description: block权限 + required: + - role_name + - table_roles + - block_roles + x-apifox-orders: + - role_name + - table_roles + - block_roles + description: |+ + 自定义角色 + + required: + - role + x-apifox-orders: + - role + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + required: + - data + - code + - msg + x-apifox-orders: + - data + - code + - msg + example: + data: + role: + role_name: role1 + table_roles: + - table_name: table1 + table_id: tblFIgBzKEq75HSE + table_perm: 2 + addrecords_perm: false + deleterecords_perm: true + rec_rule: + conjunction: or + conditions: + - field_name: 单选 + operator: is + field_type: 3 + value: + - optbdVHf4q + - value: null + field_name: 人员 + operator: contains + field_type: 11 + - operator: contains + field_type: 1003 + value: null + field_name: '' + other_perm: 0 + field_perm: + 单选: 1 + 年龄: 2 + - table_name: table2 + table_id: tblMPI6OC1aWvTvs + table_perm: 1 + rec_rule: + conditions: + - field_name: 人员 + operator: contains + field_type: 11 + value: null + - operator: is + field_type: 4 + value: + - opttgKOTSt + - optWcdXR0W + field_name: 多选 + other_perm: 0 + conjunction: and + - table_name: table3 + table_id: tblmkLF7Tg6IWbRb + table_perm: 0 + - table_name: table4 + table_id: tbl5VQHDTms19Qe7 + table_perm: 4 + block_roles: + - block_id: blknkqrP3RqUkcAW + block_perm: 0 + - block_id: blkAjxjWKvbBi7EA + block_perm: 1 + code: 0 + msg: success + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/自定义角色 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963075-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.45 批量删除协作者 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963324.md` + +# 批量删除协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_delete: + post: + summary: 批量删除协作者 + deprecated: false + description: >+ + 批量删除自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: 多维表格文档 Token + required: true + example: bascnnKKvcoUblgmmhZkYqabcef + schema: + type: string + - name: role_id + in: path + description: 自定义角色 ID + required: true + example: rolNGhPqks + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_list: + type: array + items: + type: object + properties: + type: + type: string + description: "\t 协作者 ID 类型 示例值:\"open_id\" 可选值有: open_id:协作者 ID 类型为 open_id union_id:协作者 ID 类型为 union_id user_id:协作者 ID 类型为 user_id chat_id:协作者 ID 类型为 chat_id department_id:协作者 ID 类型为 department_id open_department_id:协作者 ID 类型为 open_department_id 默认值:open_id" + id: + type: string + description: 协作者 ID 示例值:"ou_35990a9d9052051a2fae9b2f1afabcef" + x-apifox-orders: + - type + - id + required: + - id + description: "\t 协作者列表 数据校验规则: 最大长度:100" + required: + - member_list + x-apifox-orders: + - member_list + example: + member_list: + - type: open_id + id: ou_35990a9d9052051a2fae9b2f1afabcef + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963324-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.46 批量新增协作者 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963532.md` + +# 批量新增协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_create: + post: + summary: 批量新增协作者 + deprecated: false + description: >+ + 批量新增自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 400 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 400 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 400 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 400 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 404 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 400 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 429 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 400 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 400 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: Bitable 文档 Token + required: true + example: bascnnKKvcoUblgmmhZkYqabcef + schema: + type: string + - name: role_id + in: path + description: 自定义角色 ID + required: true + example: rolNGhPqks + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_list: + type: array + items: + type: object + properties: + type: + type: string + description: >- + 协作者 ID 类型 示例值:"open_id" 可选值有: open_id:协作者 ID 类型为 + open_id union_id:协作者 ID 类型为 union_id user_id:协作者 ID + 类型为 user_id chat_id:协作者 ID 类型为 chat_id + department_id:协作者 ID 类型为 department_id + open_department_id:协作者 ID 类型为 open_department_id + 默认值:open_id + id: + type: string + description: "\t 协作者 ID 示例值:\"ou_35990a9d9052051a2fae9b2f1afabcef\"" + x-apifox-orders: + - type + - id + required: + - id + description: 协作者列表 数据校验规则: 最大长度:100 + required: + - member_list + x-apifox-orders: + - member_list + example: + member_list: + - type: open_id + id: ou_35990a9d9052051a2fae9b2f1afabcef + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963532-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.47 列出协作者 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963762.md` + +# 列出协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members: + get: + summary: 列出协作者 + deprecated: false + description: >+ + 列出自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: page_size + in: query + description: "\t 分页大小 示例值:100 数据校验规则: 最大值:100" + required: false + schema: + type: integer + - name: page_token + in: query + description: >- + 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 + page_token 获取查询结果 + required: false + example: xxxxx + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + msg: + type: string + description: 错误码,非 0 表示失败 + data: + type: object + properties: + items: + type: array + items: + type: object + properties: + member_type: + type: string + description: 协作者名字 + member_name: + type: string + description: 协作者英文名 + member_en_name: + type: string + open_id: + type: string + description: 用户的 open_id + union_id: + type: string + description: 用户的 union_id + user_id: + type: string + description: 用户的 user_id + chat_id: + type: string + description: 群聊的 chat_id + department_id: + type: string + description: 部门的 department_id + open_department_id: + type: string + description: 部门的 open_department_id + required: + - member_type + - member_name + - member_en_name + x-apifox-orders: + - member_type + - member_name + - member_en_name + - open_id + - union_id + - user_id + - chat_id + - department_id + - open_department_id + description: 协作者列表 + page_token: + type: string + description: >- + 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 + page_token + total: + type: integer + description: 总数 + has_more: + type: boolean + description: 是否还有更多项 + required: + - items + - page_token + - total + - has_more + x-apifox-orders: + - items + - page_token + - total + - has_more + code: + type: integer + description: 错误描述 + required: + - msg + - data + - code + x-apifox-orders: + - msg + - data + - code + example: + msg: success + data: + items: + - member_type: user + member_name: 张三 + member_en_name: San Zhang + open_id: ou_xxxxxxxxxxxxxxxx + union_id: on_xxxxxxxxxxxxxxxx + user_id: xxxxxx + - member_type: chat + member_name: design-chat + member_en_name: design-chat + chat_id: oc_xxxxxxxxxxxxxxxx + - member_type: department + member_name: design-center + member_en_name: design-center + department_id: xxxxxxxxx + open_department_id: od-xxxxxxxxxxxxxxxx + page_token: xxxxxxxxx + total: 3 + has_more: false + code: 0 + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963762-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.48 新增协作者 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58963951.md` + +# 新增协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members: + post: + summary: 新增协作者 + deprecated: false + description: >+ + 新增自定义角色的协作者 + + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: member_id_type + in: query + description: >- + 协作者id类型,与请求体中的member_id要对应 示例值:"open_id" 可选值有: + open_id:以open_id来识别协作者 union_id:以union_id来识别协作者 + user_id:以user_id来识别协作者 chat_id:以chat_id来识别协作者 + department_id:以department_id来识别协作者 + open_department_id:以open_department_id来识别协作者 默认值:open_id + required: false + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + member_id: + type: string + description: "\t 协作者id 示例值:\"ou_7dab8a3d3cdcc9da365777c7ad535d62\"" + required: + - member_id + x-apifox-orders: + - member_id + example: + member_id: ou_xxxxxxx + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58963951-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +--- + +### A.49 删除协作者 + +来源文件:`offline-docs-v2/sources/bitable-md/feishu.apifox.cn_api-58964039.md` + +# 删除协作者 + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /bitable/v1/apps/{app_token}/roles/{role_id}/members/{member_id}: + delete: + summary: 删除协作者 + deprecated: false + description: >+ + ### 错误码 + + + | HTTP状态码 | 错误码 | 描述 | + 排查建议 | + + | ---------- | ------- | ------------------------------------------- | + ------------------------------------------------------------ | + + | 200 | 1254000 | WrongRequestJson | + 请求体错误 | + + | 200 | 1254001 | WrongRequestBody | + 请求体错误 | + + | 200 | 1254002 | Fail | + 内部错误,有疑问可咨询客服 | + + | 200 | 1254003 | WrongBaseToken | + app_token 错误 | + + | 200 | 1254010 | ReqConvError | + 请求错误 | + + | 400 | 1254032 | InvalidRoleName | + 自定义角色名无效 | + + | 400 | 1254033 | RoleNameDuplicated | + 自定义角色名重复 | + + | 400 | 1254036 | Bitable is copying, please try again later. | + 多维表格副本复制中,稍后重试 | + + | 200 | 1254040 | BaseTokenNotFound | + app_token 不存在 | + + | 404 | 1254047 | RoleIdNotFound | + role_id 不存在 | + + | 404 | 1254048 | MemberNotFound | + member 不存在 | + + | 400 | 1254110 | RoleExceedLimit | + 自定义角色数量超限,限制30条 | + + | 400 | 1254111 | MemberExceedLimit | + 自定义角色的协作者数量超限,限制200个 | + + | 200 | 1254290 | TooManyRequest | + 请求过快,稍后重试 | + + | 200 | 1254291 | Write conflict | + 同一个数据表(table) + 不支持并发调用写接口,请检查是否存在并发调用写接口。写接口包括:新增、修改、删除记录;新增、修改、删除字段;修改表单;修改视图等。 | + + | 400 | 1254301 | OperationTypeError | + 多维表格未开启高级权限或不支持开启高级权限 | + + | 403 | 1254302 | RolePermNotAllow | + 无访问权限, 常由表格开启了高级权限造成, 请在高级权限设置中添加一个包含应用的群, 给予这个群读写权限 | + + | 200 | 1255001 | InternalError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255002 | RpcError | + 内部错误,有疑问可咨询客服 | + + | 200 | 1255003 | MarshalError | + 序列化错误,有疑问可咨询客服 | + + | 200 | 1255004 | UmMarshalError | + 反序列化错误 | + + | 504 | 1255040 | 请求超时 | + 进行重试 | + + tags: + - 云文档/多维表格/高级权限/协作者 + parameters: + - name: app_token + in: path + description: bitable app token + required: true + example: appbcbWCzen6D8dezhoCH2RpMAh + schema: + type: string + - name: role_id + in: path + description: 自定义角色的id + required: true + example: roljRpwIUt + schema: + type: string + - name: member_id + in: path + description: 协作者id + required: true + example: ou_7dab8a3d3cdcc9da365777c7ad53uew2 + schema: + type: string + - name: member_id_type + in: query + description: "\t 协作者id类型,与请求体中的member_id要对应 示例值:\"open_id\" 可选值有: open_id:以open_id来识别协作者 union_id:以union_id来识别协作者 user_id:以user_id来识别协作者 chat_id:以chat_id来识别协作者 department_id:以department_id来识别协作者 open_department_id:以open_department_id来识别协作者 默认值:open_id" + required: false + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + description: 错误码,非 0 表示失败 + msg: + type: string + description: 错误描述 + data: + type: object + properties: {} + x-apifox-orders: [] + required: + - code + - msg + - data + x-apifox-orders: + - code + - msg + - data + example: + code: 0 + msg: success + data: {} + headers: {} + x-apifox-name: 成功 + security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + x-apifox-folder: 云文档/多维表格/高级权限/协作者 + x-apifox-status: released + x-run-in-apifox: https://app.apifox.com/web/project/532425/apis/api-58964039-run +components: + schemas: {} + securitySchemes: + bearer: + type: bearer + scheme: bearer +servers: + - url: https://open.feishu.cn/open-apis + description: 正式环境 +security: + - bearer: [] + x-apifox: + required: true + schemeGroups: + - id: DfBVgIMccNrYuDniYlMtB + schemeIds: + - bearer + use: + id: DfBVgIMccNrYuDniYlMtB + +``` + + +## 5. 附录 B:Golang SDK 指南原文(离线) + +--- + +### B.1 服务端 SDK + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-1940248.md` + +# 服务端 SDK + +飞书开放平台提供了一系列服务端的原子 API 来实现多元化的功能,但在实际编码过程中,需要考虑一些额外的工作,如访问凭证(access token)的获取与维护、数据加解密、请求验签等。此外,缺少函数调用的语义化描述、类型系统的支持,也会增加编码负担。 + +为解决以上问题,飞书开放平台提供了服务端 SDK,将所有冗长的逻辑内置处理,支持完备的类型系统,对外提供语义化的编程接口,以提高实际的编码体验。 + +SDK 提供的主要能力包括: + +- SDK 支持 **基于长连接的事件回调**,详情见[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case#d286cc88)、[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 + +- SDK 提供了 **结构化的 API 请求入参**。比如发消息 API,SDK 对各种类型的消息都提供了结构化封装。 + + + + ![img](offline-docs-v2/assets/images/img_704483242d64efb2212090e79e605dfc683560e4.png) + + + +- SDK 提供了 **完整的应用访问凭证(tenant_access_token)生命周期管理能力**,无需开发者自己获取并刷新应用身份的访问凭证。 + + + + +:::info[] + SDK 仅支持托管应用身份的访问凭证(tenant_access_token),不支持托管用户身份的访问凭证(user_access_token),开发者需自行实现相关逻辑,参考 [获取 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/get-user-access-token) 、[刷新 user_access_token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/authentication-management/access-token/refresh-user-access-token) 。 +::: + +- SDK 内 API 和事件上都添加了文字注释,以及跳转到使用 Demo 和官方文档的链接。 + + + + ![img](offline-docs-v2/assets/images/img_9f24b8e8a20a267845c3bc352ad6c8a2bcbd3324.png) + + + +- SDK 提供了简洁易懂的帮助文档。参考 SDK 文档可帮助你了解如何安装 SDK、如何通过 SDK 调用服务端 API、处理订阅的事件及回调。 + + - [Java 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/preparations) + - [Python 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/preparations-before-development) + - [Go 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/preparations) + - [NodeJS 开发指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/preparation-before-development) + - [SDK 常见问题](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/faq) + +## 源码地址 + +你可以进入 GitHub 项目空间查看源码详情。在使用 SDK 的过程中,如果遇到问题,可以给我们提交 Issue。 + +| **GitHub 项目** | **Issues** | **场景示例** | **语言** | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------- | +| [oapi-sdk-go](https://github.com/larksuite/oapi-sdk-go) | [Issues](https://github.com/larksuite/oapi-sdk-go/issues) | [oapi-sdk-go-demo](https://github.com/larksuite/oapi-sdk-go-demo) | Golang >= 1.5 | +| [oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python) | [Issues](https://github.com/larksuite/oapi-sdk-python/issues) | [oapi-sdk-python-demo](https://github.com/larksuite/oapi-sdk-python-demo) | Python >= 3.8 | +| [oapi-sdk-java](https://github.com/larksuite/oapi-sdk-java) | [Issues](https://github.com/larksuite/oapi-sdk-java/issues) | [oapi-sdk-java-demo](https://github.com/larksuite/oapi-sdk-java-demo) | Java >= 1.8 | +| [oapi-sdk-nodejs](https://github.com/larksuite/node-sdk) | [Issues](https://github.com/larksuite/node-sdk/issues) | - | NodeJS >= 10.0.0 | + +## SDK 问题交流群 + +| Java SDK 交流群 | Python SDK 交流群 | Go SDK 交流群 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=a53jb5f6-87de-4974-9ad6-8a88563d0e89)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_3884537012254c6b94649f7d26d4d17df57344c2.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=575k28fa-2c12-400a-80c0-2d8924e00d38)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_54f836895912bf4c2b16c7424b994e4a7c359a6e.png) | [单击此处](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=21cn476d-b859-4c15-9048-5ecf49f1a951)或扫码加入 SDK 交流群。 ![img](offline-docs-v2/assets/images/img_a710707265f8e3f37516a1c744d1933e61040d38.png) | + +NodeJS SDK 问题可直接提交[Issues](https://github.com/larksuite/node-sdk/issues)。 + +## 相关文档 + +- [服务端 API 列表](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/server-api-list) +- [事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list) + + +--- + +### B.2 开发前准备 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518568.md` + +# 开发前准备 + +使用 Go SDK 调用服务端 API、处理事件和回调前,请确保你已创建了一个应用、安装了 Go 环境和 Go SDK。本文档介绍使用 Go SDK 开发前的准备工作。 + + + + +:::info[] +对于新手开发者,建议你直接上手体验[开发自动回复机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)或[开发卡片交互机器人](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-a-card-interactive-bot/introduction)教程,在教程示例代码中了解如何调用 API、处理事件和回调。 +::: + +## 创建应用 + +在使用服务端 SDK 之前,你需要确保已在[开发者后台](https://open.feishu.cn/app)创建了一个企业自建应用或商店应用。详情参考[创建企业自建应用](https://open.feishu.cn/document/home/introduction-to-custom-app-development/self-built-application-development-process#a0a7f6b0)或[创建商店应用](https://open.feishu.cn/document/uMzNwEjLzcDMx4yM3ATM/ucjN2YjL3YjN24yN2YjN/step1-create-a-store-application)。了解选择哪种应用,参考[应用类型](https://open.feishu.cn/document/home/app-types-introduction/overview#c3c7ad51)。 + +## 准备开发环境 + +要确保 Go SDK 运行,你需安装 Go 环境。下载地址见 [Go download and install](https://go.dev/doc/install)。 + +## 安装 Go SDK + +运行以下命令,安装 Go SDK。 + +``` +go get -u github.com/larksuite/oapi-sdk-go/v3@latest +``` + +## 后续操作 + +- [调用服务端 API](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis):介绍如何通过 SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。 +- [处理事件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-events):介绍如何通过 SDK 封装的长连接方式处理事件、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理事件。 +- [处理回调](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/handle-callback):介绍如何通过 SDK 封装的长连接方式处理回调、如何使用 Go SDK 原生 HTTP 服务器或集成 Gin 框架处理回调。 +- [场景示例](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/demo):提供基于 SDK 实现的各类场景的代码示例。 + + +--- + +### B.3 调用服务端 API + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518569.md` + +# 调用服务端 API + +本文档介绍如何通过 Go SDK,自行构建 API Client、构造 API 请求、最终成功调用服务端 API。你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码,然后参考本文档了解调用 API 的全面流程。 + + + +![img](offline-docs-v2/assets/images/img_77e8081c5e3e797636b2e4a32ecddb488801348f.png) + + + +## 步骤一:构建 API Client + +通过 SDK 调用飞书开放接口之前,你需要先在代码中创建一个 API Client。该 API Client 支持指定当前使用的应用信息、日志级别、HTTP 请求超时时间等基本信息。以下为支持的配置项及其具体含义。 + +``` +var client = lark.NewClient("appID", "appSecret", // 默认配置为自建应用 + // lark.WithMarketplaceApp(), // 可设置为商店应用 + lark.WithLogLevel(larkcore.LogLevelDebug), + lark.WithReqTimeout(3*time.Second), + lark.WithEnableTokenCache(true), + lark.WithHelpdeskCredential("id", "token"), + lark.WithHttpClient(http.DefaultClient)) +``` + +| 配置选项 | 配置方式 | 是否必填 | 描述 | +| ------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| app_id 和 app_secret | `lark.NewClient("appID", "appSecret")` | 是 | 应用凭证 App ID 和 App Secret。可在[开发者后台](https://open.feishu.cn/app) > 应用详情页 > **凭证与基础信息** > **应用凭证** 区域获取。![图片名称](offline-docs-v2/assets/images/img_2ff482eb48a16372e75c62e539acb11c01c38ffb.png) | +| AppType | `lark.WithMarketplaceApp()` | 否 | 设置 App 类型为商店应用。如果你是 ISV 开发者,则必须设置该选项。关于商店应用的开发指南,可参见 [ISV(商店应用)开发指南](https://bytedance.feishu.cn/docx/DljadpCH3oMlnLxo1kpcS1vmnbg)。 | +| LogLevel | `lark.WithLogLevel(logLevel larkcore.LogLevel)` | 否 | 设置 API Client 的日志输出级别,枚举值如下:LogLevelDebugLogLevelInfo(默认值)LogLevelWarnLogLevelError | +| Logger | `lark.WithLogger(logger larkcore.Logger)` | 否 | 设置API Client 的日志器,默认日志输出到标准输出。你可通过实现下面的 Logger 接口,来设置自定义的日志器。`type Logger interface { Debug(context.Context, ...interface{}) Info(context.Context, ...interface{}) Warn(context.Context, ...interface{}) Error(context.Context, ...interface{})}` | +| LogReqAtDebug | `lark.WithLogReqAtDebug(printReqRespLog bool)` | 否 | 设置是否开启 HTTP 请求参数和响应参数的日志打印开关。开启后,在 debug 模式下会打印 HTTP 请求和响应的 headers、body 等信息。提示:在排查问题时开启该选项,有利于问题的排查。 | +| BaseUrl | `lark.WithOpenBaseUrl(baseUrl string)` | 否 | 设置飞书域名,默认为飞书域名 FeishuBaseUrl。可用域名如下:`// 飞书域名var FeishuBaseUrl = "https://open.feishu.cn"// Lark域名var LarkBaseUrl = "https://open.larksuite.com"` | +| TokenCache | `lark.WithTokenCache(cache larkcore.Cache)` | 否 | 设置 Token 缓存器,用于缓存 Token 和 appTIcket,默认实现为内存。如果你需要定制 Token 缓存器,则需实现如下 Cache 接口。`type Cache interface { Set(ctx context.Context, key string, value string, expireTime time.Duration) error Get(ctx context.Context, key string) (string, error)}`**注意**:对于商店应用的 ISV 开发者而言,如果需要 SDK 来缓存 appTicket,则需要实现该接口,以提供分布式缓存。 | +| EnableTokenCache | `lark.WithEnableTokenCache(enableTokenCache bool)` | 否 | 设置是否开启 TenantAccessToken ([应用访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM))的自动获取与缓存。默认开启,如需关闭可设置为 false。 | +| HelpDeskId、HelpDeskToken | `lark.WithHelpdeskCredential(helpdeskID, helpdeskToken string)` | 否 | 服务台的 ID 和 token。仅在调用服务台业务的 API 时需要配置。可在[服务台管理后台](https://feishu.cn/helpdesk/admin)**设置中心** > **API 凭证** 处获取,详情参见 [服务台接入指南](https://open.feishu.cn/document/ukTMukTMukTM/ugDOyYjL4gjM24CO4IjN)。**注意**:服务台的 ID、Token 只有服务台创建者可以查看到。![img](offline-docs-v2/assets/images/img_fbc51b35fd119085631655f5e4df52c152be7908.png) | +| ReqTimeout | `lark.WithReqTimeout(time time.Duration)` | 否 | 设置 SDK 内置的 Http Client 的请求超时时间。默认为 0 表示永不超时。 | +| HttpClient | `lark.WithHttpClient(httpClient larkcore.HttpClient)` | 否 | 设置 Http Client,用于替换 SDK 提供的默认实现。你可通过实现下面的 HttpClient 接口来设置自定义的 HttpClient。`type HttpClient interface { Do(*http.Request) (*http.Response, error)}` | + +示例配置: + +- 对于自建应用,使用以下代码创建 API Client。 + + ``` + var client = lark.NewClient("appID", "appSecret") // 默认配置为自建应用 + ``` + +- 对于商店应用,需在创建 API Client 时,使用 `lark.WithMarketplaceApp` 方法指定 AppType 为商店应用。了解更多可参考 [ISV(商店应用)开发指南](https://bytedance.feishu.cn/docx/DljadpCH3oMlnLxo1kpcS1vmnbg)。 + + ``` + var client = lark.NewClient("appID", "appSecret",lark.WithMarketplaceApp()) // 设置为商店应用 + ``` + +## 步骤二:构造 API 请求 + +在项目内创建 API Client 后,即可开始调用[飞书开放平台接口](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/server-api-list)。如下图示例,你可前往[ API 调试台](https://open.feishu.cn/api-explorer?from=op_doc),直接获取指定服务端 API 相关示例代码。 + + + +![img](offline-docs-v2/assets/images/img_5879690e78fa7a82b661c4606286ca1fc3804345.png) + + + +SDK 使用 **client.** **业务域.** **版本.** **资源** **.方法名称** 来定位具体的 API 方法。以[创建文档](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document/create)接口为例,HTTP URL 为 `https://open.feishu.cn/open-apis/docx/v1/documents`,其中 `docx` 为业务域,`v1` 为版本,`documents` 为资源,相应的创建方法为 `client.Docx.V1.Document.Create()`。 + + + +![img](offline-docs-v2/assets/images/img_44427ad80f813abf93524b824cc2765b4ac33fc3.png) + + + +如下代码示例,你可通过 client 调用文档资源的 create 方法,创建一个文档。 + + + +该示例需要你在开发者后台为应用开通[创建及编辑新版文档]或[创建新版文档]权限,否则接口将报 99991672 错误码。 + +``` +package main +import ( // 导入接口所属的业务资源包 + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + client := lark.NewClient("appID", "appSecret") + // 发起创建文档的请求 + resp, err := client.Docx.Document.Create(context.Background(), larkdocx.NewCreateDocumentReqBuilder(). + Body(larkdocx.NewCreateDocumentReqBodyBuilder(). + FolderToken(""). // 文件夹 token,传空表示在根目录创建文档 + Title("title"). // 文档标题 + Build()). + Build()) + //处理错误 + if err != nil { + // 处理 err + return + } + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.LogId()) + return + } + // 业务数据处理 + fmt.Println(larkcore.Prettify(resp.Data)) +} +``` + +其他示例参考 GitHub 代码仓库中的[ im.go 示例](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/api/im/im.go)。 + +## (可选)步骤三:设置请求选项 + +在每次发起 API 调用时,你可以设置请求级别的相关参数,例如传递 userAccessToken(用户访问凭证)、自定义 headers 等。所有请求级别可设置的选项如下表所示。 + +| 配置选项 | 配置方式 | 描述 | +| ----------------------- | ---------------------------------------------------------- | ------------------------------------------------------------ | +| **`Header`** | `larkcore.WithHeaders(header http.Header)` | 设置自定义请求头。在发起请求时,这些请求头会被透传到飞书开放平台服务端。 | +| **`UserAccessToken`** | `larkcore.WithUserAccessToken(userAccessToken string)` | 设置用户 token,当你需要以用户身份发起 API 调用时,需要设置该选项的值。 | +| **`TenantAccessToken`** | `larkcore.WithTenantAccessToken(tenantAccessToken string)` | 设置企业或组织 token,当你自己维护企业或组织 token 时(即创建 client 时 EnableTokenCache 设置为 false),需通过该选项传递企业或组织 token。 | +| **`TenantKey`** | `larkcore.WithTenantKey(tenantKey string)` | 设置企业或组织 key,当你开发商店应用时,必须设置该选项。 | +| **`RequestId`** | `larkcore.WithRequestId(requestId string)` | 设置请求 ID,作为请求的唯一标识。该 ID 会被透传到飞书开放平台服务端。 | +| **`NeedHelpDeskAuth`** | `larkcore.WithNeedHelpDeskAuth()` | 设置添加服务台 helpdesk 的认证 header。 | + +设置自定义请求头的示例代码如下所示。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/docx/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + client := lark.NewClient("appID", "appSecret") + // 设置自定义请求头 + header := make(http.Header) + header.Add("k1", "v1") + header.Add("k2", "v2") + // 发起请求 + resp, err := client.Docx.Document.Create(context.Background(), larkdocx.NewCreateDocumentReqBuilder(). + Body(larkdocx.NewCreateDocumentReqBodyBuilder(). + FolderToken("token"). + Title("title"). + Build(), + ). + Build(), + larkcore.WithHeaders(header), // 设置自定义 headers + ) + //处理错误 + if err != nil { + // 处理 err + return + } + // 服务端错误处理 + if !resp.Success() { + fmt.Println(resp.Code, resp.Msg, resp.LogId()) + return + } + // 业务数据处理 + fmt.Println(larkcore.Prettify(resp.Data)) +} +``` + +## 步骤四:运行代码 + +完成以上步骤后,即可运行代码调用创建文档 API。若请求成功,预计将返回以下数据。若失败,将返回错误码、错误信息和 Log ID,你可前往开发文档搜索解决方案。 + +``` +{ + Document: { + DocumentId: "IPI4dqnbfoPxL3xhAEhcjXabcef", + RevisionId: 1, + Title: "title" + } +} +``` + +## 常见问题 + +### 如何调用历史版本 API ? + +服务端 API 中存在部分历史版本或未全量开放的接口,由于没有元数据信息,所以不能使用 SDK 内封装好的方法快速调用,此时你可以使用 SDK 提供的原生模式调用 API。以[获取单个用户信息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/get)接口为例,调用示例如下所示: + +``` +import ( + "context" + "fmt" + "github.com/larksuite/oapi-sdk-go/v3" + "github.com/larksuite/oapi-sdk-go/v3/core" + "net/http" + "os" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + var appID, appSecret = os.Getenv("APP_ID"), os.Getenv("APP_SECRET") + var cli = lark.NewClient(appID, appSecret) + // 发起 API 请求 + resp, err := cli.Do(context.Background(), + &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: "https://open.feishu.cn/open-apis/contact/v3/users/:user_id", + Body: nil, + QueryParams: larkcore.QueryParams{"user_id_type": []string{"open_id"}}, + PathParams: larkcore.PathParams{"user_id": "ou_c245b0a7dff2725cfa2fb104f8b48b9d"}, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}, + }, + ) + // 错误处理 + if err != nil { + fmt.Println(err) + return + } + // 获取请求 ID + fmt.Println(resp.LogId()) + // 处理请求结果 + fmt.Println(resp.StatusCode) // http status code + fmt.Println(resp.Header) // http header + fmt.Println(string(resp.RawBody)) // http body,二进制数据 +} +``` + +了解更多 API 调用示例,参考 GitHub 代码仓库中的 [api.go 示例](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/callrawapi/api.go)。 + +### 如何快速获取接口对应的示例代码? + +飞书开放平台提供了 [API 调试台](https://open.feishu.cn/api-explorer),通过该平台可以快速调试服务端 API,快速获取资源 ID 及生成多语言示例代码的能力,为您节省开发成本。例如,通过 API 调试台调用 [发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create) 接口,在调试台成功完成测试后,可通过 **示例代码** 页面查阅 Go SDK 对应的接口调用代码。 + + + +![img](offline-docs-v2/assets/images/img_f644398483f6b691846b875f810b87c5b8d30fa0.png) + + + +### 如何准确选择 API 方法? + +使用 API Client 调用 API 时,对应的方法建议你借助 [API 调试台](https://open.feishu.cn/api-explorer/)获取,可通过指定接口的地址栏参数拼接方法,也可以直接参考接口提供的示例代码。以[通过手机号或邮箱获取用户 ID](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/batch_get_id)接口为例,获取方式如下图所示。 + + + +![img](offline-docs-v2/assets/images/img_46e78ff1d6f554ae8875726b56c2edece62541a4.png) + + +--- + +### B.4 处理事件 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518571.md` + +# 处理事件 + +通过事件订阅功能,应用可以及时接收飞书中资源数据的变化,并根据变化情况做对应的业务处理,详情参见[事件概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。在应用内订阅事件时,还需要在本地服务端建立与应用的连接,以便接收事件数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理事件;你也可以选择自建 HTTP 服务器处理事件。两种方式介绍如下: + +| 订阅方式 | 介绍 | +| ------------------------ | ------------------------------------------------------------ | +| 使用长连接接收事件 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的事件发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收事件回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续事件推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +| 将事件发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收事件消息的服务器公网地址。后续当应用订阅的事件发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含事件数据。 | + +## (推荐)方式一:使用长连接接收事件 + +如果事件订阅方式需要选择 **使用长连接接收事件**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的事件订阅方式中保存 **使用长连接接收事件** 方式。关于应用内配置事件订阅方式的介绍,参考[配置事件订阅方式](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/request-url-configuration-case)。 + + + +![img](offline-docs-v2/assets/images/img_4d673f008fffcce4428d24f1913905c4a7f83eba.png) + + + +### 注意事项 + +在开始配置之前,你需要确保已了解以下注意事项: + +- 目前长连接模式仅支持企业自建应用。 +- 与 **将事件发送至开发者服务器** 方式(即自建服务器方式)的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成,否则会触发超时重推机制。 +- 每个应用最多建立 50 个连接(在配置长连接时,每初始化一个 client 就是一个连接)。 +- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 + +### 长连接代码 + +``` +package main +import ( + "context" + "fmt" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkevent "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) +func main() { + // 注册事件回调,OnP2MessageReceiveV1 为接收消息 v2.0;OnCustomizedEvent 内的 message 为接收消息 v1.0。 + eventHandler := dispatcher.NewEventDispatcher("", ""). + OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + fmt.Printf("[ OnP2MessageReceiveV1 access ], data: %s\n", larkcore.Prettify(event)) + return nil + }). + OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { + fmt.Printf("[ OnCustomizedEvent access ], type: message, data: %s\n", string(event.Body)) + return nil + }) + // 创建Client + cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET", + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + // 启动客户端 + err := cli.Start(context.Background()) + if err != nil { + panic(err) + } +} +``` + +代码实现说明: + +1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),注意**两个参数必须填空字符串**。 + +2. 通过 eventHandler 的 OnXXXX() 方法处理不同的事件。上述示例中分别监听了「接收消息 v1.0」和「接收消息 v2.0」两个事件。 + + **说明**:开放平台提供的事件包括 v1.0 和 v2.0 两个版本。两个版本的结构不同。在处理事件时,可通过[事件列表](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list)文档或在开发者后台[添加事件](https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-subscription-configure-/subscription-event-case)时,获取事件的类型与版本信息。 + + + + ![img](offline-docs-v2/assets/images/img_b584f19e7218e5ce3163d549b65b0a351cdba1fe.png) + + + + 如果是 v1.0 事件,则注册服务器时需要查找并使用 OnCustomizedEvent 方法;如果是 v2.0 事件,则注册服务器时需要查找并使用 onP2xxxx 开头的方法。例如,使用 `onP2MessageReceiveV1` 注册接收消息事件回调时,`P2`便对应的是 v2.0 版本事件结构。 + + + + ![img](offline-docs-v2/assets/images/img_004c6c488584e3637d9497b4bf76c93fddada9fe.png) + + + +3. 通过 larkws.NewClient() 初始化长连接客户端,必填参数为应用的 APP_ID 和 APP_SECRET,需登录[开发者后台](https://open.feishu.cn/app),在应用详情页的 **凭证与基础信息** > **应用凭证** 区域获取。 + + + + ![img](offline-docs-v2/assets/images/img_ad16e0cdb84b697edbcabd3157ae60ed699379a3.png) + + + +4. 可选参数传入 eventHandler,同时可设置日志级别。 + +5. 通过 cli.Start() 启动客户端,如连接成功,控制台会打印 "connected to wss://xxxxx",主线程将阻塞,直到进程结束。 + + + + ![img](offline-docs-v2/assets/images/img_ce63ed1c5a8fb02e95d691a01e57e59405865815.png) + + + +## 方式二:将事件发送至开发者服务器 + +如果事件订阅方式选择 **将事件发送至开发者服务器**,则需要设置事件请求地址,后续在事件发生时,开放平台会向该地址发送包含事件 JSON 数据的 HTTP POST 请求。为此你需启动一个 HTTP 服务器接收并处理事件。 + + + +![img](offline-docs-v2/assets/images/img_679c4aceff414bfc299dbaeb850dd2313cdb3201.png) + + + +### 选择一:使用 Go SDK 原生 HTTP 服务器处理事件 + +订阅事件后,你可以使用下面代码,对飞书开放平台推送的事件进行处理。以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器: + +``` +package main +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) +func main() { + // 注册消息处理器 + // 用于签名验证和消息解密,默认可以传递为空串。但如果你在开发者后台 > 事件与回调 > 加密策略中开启了加密,则必须传递 Encrypt Key 和 Verification Token + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") + handler = handler.OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + // 处理消息 event,这里简单打印消息的内容 + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnCustomizedEvent("这里填入你要自定义订阅的 event 的 key,例如 out_approval", func(ctx context.Context, event *larkevent.EventReq) error { + // 原生消息体 + fmt.Println(string(event.Body)) + fmt.Println(larkcore.Prettify(event.Header)) + fmt.Println(larkcore.Prettify(event.RequestURI)) + fmt.Println(event.RequestId()) + // 处理消息 + cipherEventJsonStr, err := handler.ParseReq(ctx, event) + if err != nil { + // 错误处理 + return err + } + plainEventJsonStr, err := handler.DecryptEvent(ctx, cipherEventJsonStr) + if err != nil { + // 错误处理 + return err + } + // 处理解密后的 消息体 + fmt.Println(plainEventJsonStr) + return nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +其中需要注意:EventDispatcher.newBuilder 方法的参数用于签名验证和消息解密,默认可以传递为空串。但如果你在[开发者后台](https://open.feishu.cn/app) > **事件与回调** > **加密策略**中开启了加密,则必须传递 Encrypt Key 和 Verification Token。 + + + +![img](offline-docs-v2/assets/images/img_dfcf17b29763178f183ee726d9f93e227c13ebd6.png) + + + +了解更多事件订阅示例,参考 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/event/event.go)。 + +### 选择二:集成 Gin 框架处理事件 + +如果你当前应用使用的是 Gin Web 框架,并且不希望使用 Go SDK 的原生 HTTP 服务器,你可以参考以下集成步骤,将当前应用的 Gin 服务与 SDK 进行集成。 + +1. 安装集成包。 + + 把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 + + ``` + go get -u github.com/larksuite/oapi-sdk-gin + ``` + +2. 进行代码集成。集成示例如下: + + ``` + import ( + "context" + "fmt" + + "github.com/gin-gonic/gin" + "github.com/larksuite/oapi-sdk-gin" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" + ) + + func main() { + // 注册消息处理器 + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnP2MessageReadV1(func(ctx context.Context, event *larkim.P2MessageReadV1) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }).OnP2UserCreatedV3(func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error { + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + return nil + }) + + ... + + // 在已有 Gin 实例上注册消息处理路由 + gin.POST("/webhook/event", sdkginext.NewEventHandlerFunc(handler)) + } + ``` + +### 选择三:集成 hertz 框架处理事件 + +详情请参见[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 + +## (可选)在消息处理器内向对应用户发送消息 + +在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。 + + + +对于商店应用的 ISV 开发者,当需要在消息处理器内向对应企业或组织的用户发送消息时,需要先从事件回调数据中获取企业或组织 key,然后使用如下方式调用消息 API 进行消息发送。 + +``` +import ( + "context" + "fmt" + lark "github.com/larksuite/oapi-sdk-go/v3" + "net/http" + "os" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) +func main() { + // 创建 API Client。你需在此传入你的应用的实际 App ID 和 App Secret + var appID, appSecret = os.Getenv("APP_ID"), os.Getenv("APP_SECRET") + var cli = lark.NewClient(appID, appSecret, lark.WithLogReqAtDebug(true), lark.WithLogLevel(larkcore.LogLevelDebug)) + // 注册消息处理器 + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey").OnP2MessageReceiveV1(func(ctx context.Context, event *larkim.P2MessageReceiveV1) error { + // 处理消息 event,这里简单打印消息的内容 + fmt.Println(larkcore.Prettify(event)) + fmt.Println(event.RequestId()) + // 获取企业或组织 key 并发送消息 + tenantKey := event.TenantKey() + // 商店应用给指定企业或组织的用户发送消息 + resp, err := cli.Im.Message.Create(context.Background(), larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(larkim.ReceiveIdTypeOpenId). + Body(larkim.NewCreateMessageReqBodyBuilder(). + MsgType(larkim.MsgTypePost). + ReceiveId("ou_c245b0a7dff2725cfa2fb104f8babcef"). + Content("text"). + Build()). + Build(), larkcore.WithTenantKey(tenantKey)) + // 发送结果处理,resp,err + fmt.Println(resp, err) + return nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + + +--- + +### B.5 处理回调 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518573.md` + +# 处理回调 + +通过回调订阅功能,应用可以及时接收并处理飞书中特定的交互行为(例如,飞书卡片交互、链接预览等),并根据交互结果做对应的业务处理,详情参见[回调概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/callback-overview)。在应用内订阅回调时,还需要在本地服务端建立与应用的连接,以便接收回调数据。服务端 SDK 封装了长连接方式,可以快速建立数据通道处理回调;你也可以选择自建 HTTP 服务器处理回调。两种方式介绍如下: + +| 订阅方式 | 介绍 | +| ------------------------ | ------------------------------------------------------------ | +| 使用长连接接收回调 | 该方式是飞书 SDK 内提供的能力,你可以通过集成飞书 SDK 与开放平台建立一条 WebSocket 全双工通道(你的服务器需要能够访问公网)。后续当应用订阅的回调发生时,开放平台会通过该通道向你的服务器发送消息。相较于传统的 Webhook 模式,长连接模式大大降低了接入成本,将原先 1 周左右的开发周期降低到 5 分钟。具体优势如下:测试阶段无需使用内网穿透工具,通过长连接模式在本地开发环境中即可接收回调。SDK 内封装了鉴权逻辑,只在建连时进行鉴权,后续回调推送均为明文数据,无需再处理解密和验签逻辑。只需保证运行环境具备访问公网能力即可,无需提供公网 IP 或域名。无需部署防火墙和配置白名单。 | +| 将回调发送至开发者服务器 | 传统的 Webhook 模式,该方式需要你提供用于接收回调消息的服务器公网地址。后续当应用订阅的回调发生时,开放平台会向服务器的公网地址发送 HTTP POST 请求,请求内包含回调数据。 | + +## 注意事项 + +开放平台 SDK 仅支持对象类型的卡片回传参数,不支持字符串类型。 + + + +![img](offline-docs-v2/assets/images/img_55990417f8118de94187eb5006484ad6b0c34e87.png) + + + +``` +{ + "behaviors": [ + { // 声明交互类型是卡片回传交互。 + "type": "callback", + "value": { + // 回传交互数据。开放平台 SDK 仅支持对象类型的卡片回传参数。 + "key": "value" + } + } + ] +} +``` + +## (推荐)方式一:使用长连接接收回调 + +如果回调订阅方式需要选择 **使用长连接接收回调**,则需要先使用 SDK 建立与应用的连接。本章节提供建立长连接的示例代码与代码解析,通过 SDK 建立长连接之后,你才能在应用的回调订阅方式中保存 **使用长连接接收回调** 方式。关于应用内配置回调订阅方式的介绍,参考[配置回调订阅方式](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/event-subscription-guide/callback-subscription/configure-callback-request-address)。 + + + +![img](offline-docs-v2/assets/images/img_4c9cc48d695e73d892c9da4c2e566365b9937dc1.png) + + + +### 使用限制 + +- 长连接模式仅支持企业自建应用。 +- [消息卡片回传交互(旧)](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调不支持 **使用长连接接收回调** 订阅方式,只能选择 **将回调发送至开发者服务器** 订阅方式。 +- 每个应用最多建立 50 个连接(在配置长连接时,每初始化一个 client 就是一个连接)。 + +### 注意事项 + +- 与 **将回调发送至开发者服务器** 方式的要求相同,长连接模式下接收到消息后,需要在 3 秒内处理完成。 +- 长连接模式的消息推送为 **集群模式**,不支持广播,即如果同一应用部署了多个客户端(client),那么只有其中随机一个客户端会收到消息。 + +### 长连接代码 + +``` +package main +import ( + "context" + "fmt" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" + larkws "github.com/larksuite/oapi-sdk-go/v3/ws" +) +func main() { + // 注册回调 + eventHandler := dispatcher.NewEventDispatcher("", ""). + // 监听「卡片回传交互 card.action.trigger」 + OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { + fmt.Printf("[ OnP2CardActionTrigger access ], data: %s\n", larkcore.Prettify(event)) + return nil, nil + }). + // 监听「拉取链接预览数据 url.preview.get」 + OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { + fmt.Printf("[ OnP2URLPreviewAction access ], data: %s\n", larkcore.Prettify(event)) + return nil, nil + }) + // 创建Client + cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET", + larkws.WithEventHandler(eventHandler), + larkws.WithLogLevel(larkcore.LogLevelDebug), + ) + // 建立长连接 + err := cli.Start(context.Background()) + if err != nil { + panic(err) + } +} +``` + +代码实现说明: + +1. 通过 dispatcher.NewEventDispatcher() 初始化事件处理器(eventHandler),**注意两个参数必须填空字符串**。 + +2. 通过 eventHandler 的 OnXXXX() 方法监听不同的回调类型,上述示例中监听了[卡片回传交互](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)和 [拉取链接预览数据](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/development-link-preview/pull-link-preview-data-callback-structure) 两个回调。 + +3. 通过 larkws.NewClient() 初始化长连接客户端,必填参数为应用的 APP_ID 和 APP_SECRET,可在[开发者后台](https://open.feishu.cn/app)的应用详情页内,进入 **基础信息 > 凭证与基础信息** 页面,获取应用的 APP_ID 和 APP_SECRET。 + + + + ![img](offline-docs-v2/assets/images/img_3081ff12c2b38a28452241099b5188852ee1636a.png) + + + +4. 可选参数传入 eventHandler,同时可设置日志级别。 + +5. 通过 cli.Start() 启动客户端,如连接成功,控制台会打印 `connected to wss://xxxxx`,主线程将阻塞,直到进程结束。 + + + + ![img](offline-docs-v2/assets/images/img_14898d1baed2eb032eb48a98ec19154f6a50cdd1.png) + + + +## 方式二:将回调发送至开发者服务器 + +如果回调订阅方式选择 **将回调发送至开发者服务器**,则需要设置回调请求网址,并订阅回调。例如,你配置了可交互的飞书卡片(原消息卡片),当用户在卡片内进行交互后,飞书服务器会向请求网址回调包含 JSON 数据的 HTTP POST 请求。因此,你需要启动一个 HTTP 服务器接收回调数据。 + + + +![img](offline-docs-v2/assets/images/img_364d682b8f54707e57ef6316e20c3c982faf16cd.png) + + + +### 基于新版卡片回传交互处理 + +配置卡片回调地址并订阅新版[卡片回传交互回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication)后,你可以使用下面代码,对飞书开放平台推送的卡片行为进行处理,以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。关于如何完整处理卡片回调,可参考[处理卡片回调](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/handle-card-callbacks)。 + + + +![img](offline-docs-v2/assets/images/img_dec71c02ec7fca171c02f759e29e67365e8d3e75.png) + + + +``` +package main +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + "github.com/larksuite/oapi-sdk-go/v3/event" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" + "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher/callback" +) +func main() { + handler := dispatcher.NewEventDispatcher("verificationToken", "eventEncryptKey") + handler.OnP2CardActionTrigger(func(ctx context.Context, event *callback.CardActionTriggerEvent) (*callback.CardActionTriggerResponse, error) { + fmt.Println("receive card action") + fmt.Println(larkcore.Prettify(event)) + return nil, nil + }).OnP2CardURLPreviewGet(func(ctx context.Context, event *callback.URLPreviewGetEvent) (*callback.URLPreviewGetResponse, error) { + fmt.Println(event) + return nil, nil + }) + // 注册 http 路由 + http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, + larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动服务 + err := http.ListenAndServe(":7777", nil) + if err != nil { + panic(err) + } +} +``` + +### 基于旧版卡片回传交互处理 + +配置卡片回调地址并订阅旧版[消息卡片回传交互](https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/configuring-card-callbacks/card-callback-structure)回调后,你可选择以下方式对旧版卡片回调进行处理。 + + + +![img](offline-docs-v2/assets/images/img_beba130b4d3356c65c5d3c8794963c7687b86acd.png) + + + +- **选择一**:使用 Go SDK 原生 HTTP 服务器处理回调 + + 以下代码示例基于 Go SDK 原生的 HTTP 服务器,启动一个 HTTP 服务器。 + + ``` + import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" + ) + func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("verificationToken", "eventEncryptKey", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + // 处理卡片行为, 这里简单打印卡片内容 + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + // 无返回值示例 + return nil, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } + } + ``` + + 如上代码中,如果不需要处理器内返回业务结果至飞书服务端,则直接使用示例中的无返回值用法。如需了解其他卡片回调示例,参见 [GitHub 代码仓库](https://github.com/larksuite/oapi-sdk-go/blob/v3_main/sample/card/card.go)。 + +- **选择二**:集成 Gin 框架处理回调: + + 如果你当前使用的是 Gin Web 框架,并且不希望使用 Go SDK 提供的 原生 Http Server,则可以使用以下方式,把当前应用的 Gin 服务与 SDK 进行集成。 + + 1. 安装集成包。把 Go SDK 集成已有的 Gin 框架,需要先引入 [oapi-sdk-gin](https://github.com/larksuite/oapi-sdk-gin) 集成包。 + + ``` + go get -u github.com/larksuite/oapi-sdk-gin + ``` + + 2. 进行代码集成。集成示例如下: + + ``` + import ( + "context" + "fmt" + + "github.com/gin-gonic/gin" + "github.com/larksuite/oapi-sdk-gin" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + ) + + + func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + return nil, nil + }) + ... + // 在已有的 Gin 实例上注册卡片处理路由 + gin.POST("/webhook/card", sdkginext.NewCardActionHandlerFunc(cardHandler)) + ... + } + ``` + +- **选择三**:集成 hertz 框架处理回调:详情参考[集成 hertz 框架](https://github.com/hertz-contrib/lark-hertz)。 + +## (可选)返回卡片消息 + +如果你需要在卡片处理器内同步返回用于更新卡片的消息体,则可以使用以下方式进行处理。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 创建卡片信息 + messageCard := larkcard.NewMessageCard(). + Config(config). + Header(header). + Elements([]larkcard.MessageCardElement{divElement, processPersonElement}). + CardLink(cardLink). + Build() + return messageCard, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +## (可选)返回自定义消息 + +如果你需要在卡片处理器内返回自定义的内容,则可以使用以下方式进行处理。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 创建 http body + body := make(map[string]interface{}) + body["content"] = "hello" + i18n := make(map[string]string) + i18n["zh_cn"] = "你好" + i18n["en_us"] = "hello" + i18n["ja_jp"] = "こんにちは" + body["i18n"] = i18n + + // 创建自定义消息:http状态码,body内容 + resp := &larkcard.CustomResp{ + StatusCode: 400, + Body: body, + } + return resp, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + +## (可选)在卡片行为处理器内向对应用户发送消息 + +在 HTTP 服务器启动后,你还可以进一步补充代码逻辑,实现接收事件后,向用户发送消息的效果。如果你是商店应用的开发者,当需要在卡片处理器内向指定企业或组织的用户发送消息时,需要先从消息卡片中获取企业或组织 key,然后使用以下方式调用消息 API 进行消息发送。 + +``` +import ( + "context" + "fmt" + "net/http" + "github.com/larksuite/oapi-sdk-go/v3/card" + "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/core/httpserverext" +) +func main() { + // 创建卡片处理器 + cardHandler := larkcard.NewCardActionHandler("v", "", func(ctx context.Context, cardAction *larkcard.CardAction) (interface{}, error) { + + // 处理卡片行为, 这里简单打印卡片内容 + fmt.Println(larkcore.Prettify(cardAction)) + fmt.Println(cardAction.RequestId()) + + // 获取企业或组织 key 并发送消息 + tenanKey := cardAction.TenantKey + + // ISV 给指定企业或组织中的用户发送消息 + resp, err := client.Im.Message.Create(context.Background(), larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(larkim.ReceiveIdTypeOpenId). + Body(larkim.NewCreateMessageReqBodyBuilder(). + MsgType(larkim.MsgTypePost). + ReceiveId("ou_c245b0a7dff2725cfa2fb104f8b48b9d"). + Content("text"). + Build(), larkcore.WithTenantKey(tenanKey)). + Build()) + + // 发送结果处理,resp,err + + return nil, nil + }) + // 注册处理器 + http.HandleFunc("/webhook/card", httpserverext.NewCardActionHandlerFunc(cardHandler, larkevent.WithLogLevel(larkcore.LogLevelDebug))) + // 启动 http 服务 + err := http.ListenAndServe(":9999", nil) + if err != nil { + panic(err) + } +} +``` + + +--- + +### B.6 场景示例 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518577.md` + +# 场景示例 + +飞书开放平台基于 SDK,封装了常用的 API 组合调用及业务场景示例供你参考。在 [oapi-sdk-go-demo](https://github.com/larksuite/oapi-sdk-go-demo) 中包含了以下多种场景示例代码。 + +## [发送文件消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_file.go) + +发送文件消息,使用到两个OpenAPI:[上传文件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 + +``` +package im + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) + +type SendFileRequest struct { + FileType string + FileName string + File io.Reader + Duration int + ReceiveIdType string + ReceiveId string + Uuid string +} + +type SendFileResponse struct { + *larkcore.CodeError + CreateFileResponse *larkim.CreateFileRespData + CreateMessageResponse *larkim.CreateMessageRespData +} + +// SendFile 发送文件消息 +func SendFile(client *lark.Client, request *SendFileRequest) (*SendFileResponse, error) { + // 上传文件 + createFileReq := larkim.NewCreateFileReqBuilder(). + Body(larkim.NewCreateFileReqBodyBuilder(). + FileType(request.FileType). + FileName(request.FileName). + Duration(request.Duration). + File(request.File). + Build()). + Build() + createFileResp, err := client.Im.File.Create(context.Background(), createFileReq) + if err != nil { + return nil, err + } + if !createFileResp.Success() { + fmt.Printf("client.Im.File.Create failed, code: %d, msg: %s, log_id: %s\n", + createFileResp.Code, createFileResp.Msg, createFileResp.RequestId()) + return nil, createFileResp.CodeError + } + + // 发送消息 + bs, err := json.Marshal(createFileResp.Data) + if err != nil { + return nil, err + } + createMessageReq := larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(request.ReceiveIdType). + Body(larkim.NewCreateMessageReqBodyBuilder(). + ReceiveId(request.ReceiveId). + MsgType("file"). + Content(string(bs)). + Uuid(request.Uuid). + Build()). + Build() + + createMessageResp, err := client.Im.Message.Create(context.Background(), createMessageReq) + if err != nil { + return nil, err + } + if !createMessageResp.Success() { + fmt.Printf("client.Im.Message.Create failed, code: %d, msg: %s, log_id: %s\n", + createMessageResp.Code, createMessageResp.Msg, createMessageResp.RequestId()) + return nil, createMessageResp.CodeError + } + + // 返回结果 + return &SendFileResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateFileResponse: createFileResp.Data, + CreateMessageResponse: createMessageResp.Data, + }, nil +} +``` + +## [发送图片消息](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/im/send_image.go) + +发送图片消息,使用到两个OpenAPI:[上传图片](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create)和[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create)。 + +``` +package im + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + "github.com/larksuite/oapi-sdk-go/v3/service/im/v1" +) + +type SendImageRequest struct { + Image io.Reader + ReceiveIdType string + ReceiveId string + Uuid string +} + +type SendImageResponse struct { + *larkcore.CodeError + CreateImageResponse *larkim.CreateImageRespData + CreateMessageResponse *larkim.CreateMessageRespData +} + +// SendImage 发送图片消息 +func SendImage(client *lark.Client, request *SendImageRequest) (*SendImageResponse, error) { + // 上传图片 + createImageReq := larkim.NewCreateImageReqBuilder(). + Body(larkim.NewCreateImageReqBodyBuilder(). + ImageType("message"). + Image(request.Image). + Build()). + Build() + createImageResp, err := client.Im.Image.Create(context.Background(), createImageReq) + if err != nil { + return nil, err + } + if !createImageResp.Success() { + fmt.Printf("client.Im.Image.Create failed, code: %d, msg: %s, log_id: %s\n", + createImageResp.Code, createImageResp.Msg, createImageResp.RequestId()) + return nil, createImageResp.CodeError + } + + // 发送消息 + bs, err := json.Marshal(createImageResp.Data) + if err != nil { + return nil, err + } + createMessageReq := larkim.NewCreateMessageReqBuilder(). + ReceiveIdType(request.ReceiveIdType). + Body(larkim.NewCreateMessageReqBodyBuilder(). + ReceiveId(request.ReceiveId). + MsgType("image"). + Content(string(bs)). + Uuid(request.Uuid). + Build()). + Build() + + createMessageResp, err := client.Im.Message.Create(context.Background(), createMessageReq) + if err != nil { + return nil, err + } + if !createMessageResp.Success() { + fmt.Printf("client.Im.Message.Create failed, code: %d, msg: %s, log_id: %s\n", + createMessageResp.Code, createMessageResp.Msg, createMessageResp.RequestId()) + return nil, createMessageResp.CodeError + } + + // 返回结果 + return &SendImageResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateImageResponse: createImageResp.Data, + CreateMessageResponse: createMessageResp.Data, + }, nil +} +``` + +## [获取部门下所有用户列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/contact/list_user_by_department.go) + +获取部门下所有用户列表,使用到两个OpenAPI:[获取子部门列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/children)和[获取部门直属用户列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/find_by_department)。 + +``` +package contact + +import ( + "context" + "fmt" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkcontact "github.com/larksuite/oapi-sdk-go/v3/service/contact/v3" +) + +type ListUserByDepartmentRequest struct { + DepartmentId string +} + +type ListUserByDepartmentResponse struct { + *larkcore.CodeError + ChildrenDepartmentResponse *larkcontact.ChildrenDepartmentRespData + FindByDepartmentUserResponse []*larkcontact.User +} + +// ListUserByDepartment 获取部门下所有用户列表 +func ListUserByDepartment(client *lark.Client, request *ListUserByDepartmentRequest) (*ListUserByDepartmentResponse, error) { + // 获取子部门列表 + childrenDepartmentReq := larkcontact.NewChildrenDepartmentReqBuilder(). + DepartmentIdType("open_department_id"). + DepartmentId(request.DepartmentId). + Build() + + childrenDepartmentResp, err := client.Contact.Department.Children(context.Background(), childrenDepartmentReq) + + if err != nil { + return nil, err + } + if !childrenDepartmentResp.Success() { + fmt.Printf("client.Contact.Department.Children failed, code: %d, msg: %s, log_id: %s\n", + childrenDepartmentResp.Code, childrenDepartmentResp.Msg, childrenDepartmentResp.RequestId()) + return nil, childrenDepartmentResp.CodeError + } + + // 获取部门直属用户列表 + users := make([]*larkcontact.User, 0) + openDepartmentIds := []string{request.DepartmentId} + for _, item := range childrenDepartmentResp.Data.Items { + openDepartmentIds = append(openDepartmentIds, *item.OpenDepartmentId) + } + + for _, id := range openDepartmentIds { + findByDepartmentUserReq := larkcontact.NewFindByDepartmentUserReqBuilder(). + DepartmentId(id). + Build() + + findByDepartmentUserResp, err := client.Contact.User.FindByDepartment(context.Background(), findByDepartmentUserReq) + + if err != nil { + return nil, err + } + if !findByDepartmentUserResp.Success() { + fmt.Printf("client.Contact.User.FindByDepartment failed, code: %d, msg: %s, log_id: %s\n", + findByDepartmentUserResp.Code, findByDepartmentUserResp.Msg, findByDepartmentUserResp.RequestId()) + return nil, findByDepartmentUserResp.CodeError + } + + users = append(users, findByDepartmentUserResp.Data.Items...) + } + + // 返回结果 + return &ListUserByDepartmentResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ChildrenDepartmentResponse: childrenDepartmentResp.Data, + FindByDepartmentUserResponse: users, + }, nil +} +``` + +## [创建多维表格同时添加数据表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/base/create_app_and_tables.go) + +创建多维表格同时添加数据表,使用到两个 OpenAPI:[创建多维表格](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/create)和[新增一个数据表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/create): + +``` +package base + +import ( + "context" + "fmt" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkbitable "github.com/larksuite/oapi-sdk-go/v3/service/bitable/v1" +) + +type CreateAppAndTablesRequest struct { + Name string + FolderToken string + Tables []*larkbitable.ReqTable +} + +type CreateAppAndTablesResponse struct { + *larkcore.CodeError + CreateAppResponse *larkbitable.CreateAppRespData + CreateAppTablesResponse []*larkbitable.CreateAppTableRespData +} + +// CreateAppAndTables 创建多维表格同时添加数据表 +func CreateAppAndTables(client *lark.Client, request *CreateAppAndTablesRequest) (*CreateAppAndTablesResponse, error) { + // 创建多维表格 + createAppReq := larkbitable.NewCreateAppReqBuilder(). + ReqApp(larkbitable.NewReqAppBuilder(). + Name(request.Name). + FolderToken(request.FolderToken). + Build()). + Build() + + createAppResp, err := client.Bitable.App.Create(context.Background(), createAppReq) + if err != nil { + return nil, err + } + if !createAppResp.Success() { + fmt.Printf("client.Bitable.App.Create failed, code: %d, msg: %s, log_id: %s\n", + createAppResp.Code, createAppResp.Msg, createAppResp.RequestId()) + return nil, createAppResp.CodeError + } + + // 添加数据表 + tables := make([]*larkbitable.CreateAppTableRespData, 0) + for _, table := range request.Tables { + req := larkbitable.NewCreateAppTableReqBuilder(). + AppToken(*createAppResp.Data.App.AppToken). + Body(larkbitable.NewCreateAppTableReqBodyBuilder(). + Table(table). + Build()). + Build() + + createAppTableResp, err := client.Bitable.AppTable.Create(context.Background(), req) + if err != nil { + return nil, err + } + if !createAppTableResp.Success() { + fmt.Printf("client.Bitable.AppTable.Create failed, code: %d, msg: %s, log_id: %s\n", + createAppTableResp.Code, createAppTableResp.Msg, createAppTableResp.RequestId()) + return nil, createAppTableResp.CodeError + } + + tables = append(tables, createAppTableResp.Data) + } + + // 返回结果 + return &CreateAppAndTablesResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + CreateAppResponse: createAppResp.Data, + CreateAppTablesResponse: tables, + }, nil +} +``` + +## [复制粘贴某个范围的单元格数据](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/copy_and_paste_by_range.go) + +复制粘贴某个范围的单元格数据,使用到两个OpenAPI:[读取单个范围](https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN)和[向单个范围写入数据](https://open.feishu.cn/document/ukTMukTMukTM/uAjMzUjLwIzM14CMyMTN)。 + +``` +package sheets + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" +) + +type CopyAndPasteByRangeRequest struct { + SpreadsheetToken string + SrcRange string + DstRange string +} + +type CopyAndPasteRangeResponse struct { + *larkcore.CodeError + ReadResponse *SpreadsheetRespData + WriteResponse *SpreadsheetRespData +} + +// CopyAndPasteRange 复制粘贴某个范围的单元格数据 +func CopyAndPasteRange(client *lark.Client, request *CopyAndPasteByRangeRequest) (*CopyAndPasteRangeResponse, error) { + // 读取单个范围 + readResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values/%s", request.SpreadsheetToken, request.SrcRange), + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + readSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(readResp.RawBody, readSpreadsheetResp) + if err != nil { + return nil, err + } + readSpreadsheetResp.ApiResp = readResp + if readSpreadsheetResp.Code != 0 { + fmt.Printf("read spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + readSpreadsheetResp.Code, readSpreadsheetResp.Msg, readSpreadsheetResp.RequestId()) + return nil, readSpreadsheetResp.CodeError + } + + // 向单个范围写入数据 + valueRange := map[string]interface{}{} + valueRange["range"] = request.DstRange + valueRange["values"] = readSpreadsheetResp.Data.ValueRange.Values + body := map[string]interface{}{} + body["valueRange"] = valueRange + + writeResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodPut, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values", request.SpreadsheetToken), + Body: body, + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + writeSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(writeResp.RawBody, writeSpreadsheetResp) + if err != nil { + return nil, err + } + writeSpreadsheetResp.ApiResp = writeResp + if writeSpreadsheetResp.Code != 0 { + fmt.Printf("write spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + writeSpreadsheetResp.Code, writeSpreadsheetResp.Msg, writeSpreadsheetResp.RequestId()) + return nil, writeSpreadsheetResp.CodeError + } + + // 返回结果 + return &CopyAndPasteRangeResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + WriteResponse: writeSpreadsheetResp.Data, + }, nil +} +``` + +## [下载指定范围单元格的所有素材列表](https://github.com/larksuite/oapi-sdk-go-demo/blob/main/composite_api/sheets/download_media_by_range.go) + +下载指定范围单元格的所有素材列表,使用到两个OpenAPI:[读取单个范围](https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN)和[下载素材](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download): + +``` +package sheets + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + + lark "github.com/larksuite/oapi-sdk-go/v3" + larkcore "github.com/larksuite/oapi-sdk-go/v3/core" + larkdrive "github.com/larksuite/oapi-sdk-go/v3/service/drive/v1" +) + +type DownloadMediaByRangeRequest struct { + SpreadsheetToken string + Range string +} + +type DownloadMediaByRangeResponse struct { + *larkcore.CodeError + ReadResponse *SpreadsheetRespData + DownloadMediaResponse []*larkdrive.DownloadMediaResp +} + +func DownloadMediaByRange(client *lark.Client, request *DownloadMediaByRangeRequest) (*DownloadMediaByRangeResponse, error) { + // 读取单个范围 + readResp, err := client.Do(context.Background(), &larkcore.ApiReq{ + HttpMethod: http.MethodGet, + ApiPath: fmt.Sprintf("/open-apis/sheets/v2/spreadsheets/%s/values/%s", request.SpreadsheetToken, request.Range), + SupportedAccessTokenTypes: []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}, + }) + if err != nil { + return nil, err + } + + readSpreadsheetResp := &SpreadsheetResp{} + err = json.Unmarshal(readResp.RawBody, readSpreadsheetResp) + if err != nil { + return nil, err + } + readSpreadsheetResp.ApiResp = readResp + if readSpreadsheetResp.Code != 0 { + fmt.Printf("read spreadsheet failed, code: %d, msg: %s, log_id: %s\n", + readSpreadsheetResp.Code, readSpreadsheetResp.Msg, readSpreadsheetResp.RequestId()) + return nil, readSpreadsheetResp.CodeError + } + + // 下载文件 + files := make([]*larkdrive.DownloadMediaResp, 0) + values := readSpreadsheetResp.Data.ValueRange.Values + tokens := parseFileToken(values, make(map[string]bool)) + for _, token := range tokens { + downloadMediaReq := larkdrive.NewDownloadMediaReqBuilder(). + FileToken(token). + Build() + + downloadMediaResp, err := client.Drive.Media.Download(context.Background(), downloadMediaReq) + if err != nil { + return nil, err + } + if !downloadMediaResp.Success() { + fmt.Printf("client.Drive.Media.Download failed, code: %d, msg: %s, log_id: %s\n", + downloadMediaResp.Code, downloadMediaResp.Msg, downloadMediaResp.RequestId()) + return nil, downloadMediaResp.CodeError + } + + files = append(files, downloadMediaResp) + } + + // 返回结果 + return &DownloadMediaByRangeResponse{ + CodeError: &larkcore.CodeError{ + Code: 0, + Msg: "success", + }, + ReadResponse: readSpreadsheetResp.Data, + DownloadMediaResponse: files, + }, nil +} + +func parseFileToken(values []interface{}, tokens map[string]bool) []string { + if len(values) == 0 { + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res + } + for _, i := range values { + kind := reflect.TypeOf(i).Kind() + if kind == reflect.Slice { + parseFileToken(i.([]interface{}), tokens) + } else if kind == reflect.Map { + m := i.(map[string]interface{}) + if val, ok := m["fileToken"]; ok { + tokens[val.(string)] = true + } + } + } + + res := make([]string, 0, len(tokens)) + for k := range tokens { + res = append(res, k) + } + return res +} +``` + + +--- + +### B.7 常见问题 + +来源文件:`offline-docs-v2/sources/go-sdk-md/feishu.apifox.cn_doc-7518657.md` + +# 常见问题 + +本文档汇集使用服务端 SDK 可能出现的常见问题与解决方案。 + +### API 调试台内获取 tenant_access_token/app_access_token 的示例代码,为什么提示找不到方法? + +服务端 SDK 内已经封装了获取和缓存 tenant_access_token/app_access_token 的逻辑,在构建 API Client 时传入应用的 App ID 和 App Secret 即可,不需要手动获取 Token。 + +### API 调试台内成功调用 API 后,使用示例代码调用失败是什么原因? + +API 调试台中的示例代码是根据调试台内设置的参数自动生成的,如果存在代码问题,请先在调试台内配置好参数再使用代码,同时注意应用的 App ID 和 App Secret 需要手动配置。 + + + +![img](offline-docs-v2/assets/images/img_ba14876b10318909520ceb3b7dcc5c2dcdf08774.png) + + + +应用的 App ID 和 App Secret 需登录[开发者后台](https://open.feishu.cn/app),在应用详情页的 **凭证与基础信息** > **应用凭证** 区域获取。 + + + +![img](offline-docs-v2/assets/images/img_43ed97a9e20b581e8e808e2f478985b93af5c448.png) + + + +### 如何查看某个接口在 SDK 是否支持? + +你可以直接查询接口文档,例如[发送消息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create),有如下图所示的 **尝试一下** 按钮表示支持(不支持的 API 没有该按钮)。 + + + +![img](offline-docs-v2/assets/images/img_fbd1002891b03fbde59ffb562e128acd8633cfb4.png) + + + +点击按钮后可以调试 API、查阅示例代码。 + + + +![img](offline-docs-v2/assets/images/img_4915a22002bcce7532136126d10b8195bb01c7ed.png) + + + +### SDK 不支持直接调用的接口、历史版本的接口,如何才能调用? + +不同语言的 SDK 均提供了原生 API 调用方式,使用该方式可以通过传入 API 的 HTTP Method、URL 以及参数来调用。具体操作参见各 SDK 使用指南。 + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 使用下载导出文件接口时,文件名包含特殊字符导致下载报错如何解决? + +系统逻辑存在特殊字符校验,你可以先使用 SDK 提供的原生模式调用 API。详情参考: + +- [Java SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/invoke-server-api) 的 **常见问题** 章节。 +- [Go SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/calling-server-side-apis) 的 **常见问题** 章节。 +- [Python SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/invoke-server-api) 的 **常见问题** 章节。 +- [NodeJS SDK 指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/invoke-server-api) 的 **常见问题** 章节。 + +### 如何配置私有部署的飞书服务器或者代理服务器连接? + +Java 示例代码以及配置说明,参考以下代码注释。 + +``` +import com.lark.oapi.Client; +import com.lark.oapi.core.cache.LocalCache; +import com.lark.oapi.core.enums.BaseUrlEnum; +import com.lark.oapi.core.httpclient.OkHttpTransport; +import com.lark.oapi.core.response.RawResponse; +import com.lark.oapi.core.token.AccessTokenType; +import com.lark.oapi.okhttp.OkHttpClient; +import java.net.Proxy; +import java.util.concurrent.TimeUnit; +@Test +void init() { + Proxy proxy = Proxy.NO_PROXY; // 自定义代理服务器 + Client client = Client.newBuilder("appId", "appSecret") + .openBaseUrl(BaseUrlEnum.FeiShu) // 设置域名,默认为飞书,支持重载String,设置私有部署飞书服务器 + .httpTransport(new OkHttpTransport( + new OkHttpClient().newBuilder() + .readTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .callTimeout(3, TimeUnit.MINUTES) // 设置超时时间 + .proxy(proxy) // 设置使用代理服务器访问飞书服务器 + .build() + )) + .tokenCache(LocalCache.getInstance()) // 默认实现,本地带时间过期的缓存;可以自己实现ICache的接口,例如Redis缓存等 + .logReqAtDebug(true) // 在 debug 模式下会打印 http 请求和响应的 headers,body 等信息。 + .build(); +} +``` + +### 调用接口失败,有 code 和 logid 该如何排查? + +- 方式一:打开[飞书开发文档](https://open.larkoffice.com/document/home/index),在搜索栏输入错误码(code)或者日志 ID(logid)查询。 + + + + ![img](offline-docs-v2/assets/images/img_cc2dd44b5278d77faabec70e802f8d7f4199f540.png) + + + +- 方式二:如果问题始终无法解决,请咨询[技术支持](https://applink.feishu.cn/TLJpeNdW)。 + +### 接收事件时为什么重复收到事件体数据? + +开放平台推送事件数据后,你的服务器需要在 3 秒内以 HTTP 200 状态码进行响应,否则开放平台认为本次推送失败,并会重新推送事件数据。详情参见[事件推送周期和频次](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM#9cd4c9b1)。 + + diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考.md b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考.md new file mode 100644 index 0000000..a539428 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书多维表格开发文档-完整参考.md @@ -0,0 +1,309 @@ +# 飞书多维表格(Bitable v1)开发文档完整参考(含子页面) + +## 1. 文档说明 + +- 目标:将飞书多维表格 `bitable-v1` 官方开发文档及其子页面整理为可直接用于后续 Agent Skill 制作的单一参考文档。 +- 覆盖范围:`概述`、`接入指南`、`数据结构`、业务指南页(记录筛选/字段编辑/附件字段/高级权限概述)以及所有 API 子页(含多维表格、数据表、仪表盘、视图、表单、记录、字段、高级权限)。 +- 补充范围:与多维表格强相关的事件页(字段变更、记录变更)。 +- 抓取时间:2026-03-23(Asia/Shanghai)。 + +## 2. 信息来源 + +- 官方入口: +- 官方镜像(可“复制页面”):`feishu.apifox.cn` +- 记录变更/复制仪表盘等少量页通过 `s.apifox.cn` 补齐。 + +说明:少数子页在镜像站打开返回空页/内部错误,但可通过目录项、同组 API 规律与检索结果补齐路径与用途;我已在对应条目标注“补齐/推断”。 + +## 3. 文档树(bitable-v1 全子页) + +### 3.1 基础页 + +1. 概述: +2. 接入指南: +3. 数据结构: + +### 3.2 多维表格 + +1. 获取多维表格元数据: +2. 更新多维表格元数据: + +### 3.3 数据表 + +1. 更新数据表: +2. 列出数据表: +3. 新增数据表: +4. 新增多个数据表: +5. 删除一个数据表: +6. 删除多个数据表: + +### 3.4 仪表盘 + +1. 复制仪表盘(补齐): +2. 列出仪表盘: + +### 3.5 视图 + +1. 更新视图: +2. 检索视图: +3. 列出视图: +4. 新增视图: +5. 删除视图: + +### 3.6 表单 + +1. 更新表单元数据: +2. 获取表单元数据: +3. 更新表单问题: +4. 列出表单问题: + +### 3.7 记录 + +1. 记录筛选开发指南: +2. 检索记录: +3. 列出记录: +4. 新增记录: +5. 更新记录: +6. 删除记录: +7. 新增多条记录: +8. 更新多条记录: +9. 删除多条记录: + +### 3.8 字段 + +1. 字段编辑指南: +2. 附件字段说明: +3. 列出字段: +4. 新增字段: +5. 更新字段: +6. 删除字段: + +### 3.9 高级权限 + +1. 概述: + +#### 自定义角色 + +1. 列出自定义角色: +2. 新增自定义角色: +3. 删除自定义角色: +4. 更新自定义角色: + +#### 协作者 + +1. 批量删除协作者: +2. 批量新增协作者: +3. 列出协作者: +4. 新增协作者: +5. 删除协作者(页面异常,路径补齐):`DELETE /bitable/v1/apps/{app_token}/roles/{role_id}/members/{member_id}` + +### 3.10 关联事件页(强相关) + +1. 多维表格字段变更: +2. 多维表格记录变更: + +## 4. 对象关系与 ID 流转(跨子页面关联) + +```mermaid +flowchart LR + A["App(app_token)"] --> B["Table(table_id)"] + B --> C["View(view_id)"] + B --> D["Field(field_id)"] + B --> E["Record(record_id)"] + B --> F["Form(form_id)"] + A --> G["Dashboard(dashboard_id)"] + A --> H["Role(role_id)"] + H --> I["Member(member_id)"] +``` + +ID 获取链路(来自“接入指南”) + +1. `app_token`:从多维表格 URL 中提取。 +2. `table_id`:通过“列出数据表”获取。 +3. `view_id`:通过“列出视图/检索视图”获取。 +4. `record_id`:通过“列出记录/新增记录”获取。 +5. `field_id`:通过“列出字段”获取。 +6. `form_id`:通过“获取表单元数据/列出表单问题”获取。 +7. `dashboard_id`:通过“列出仪表盘”获取。 +8. `role_id`:通过“列出自定义角色”获取。 +9. `member_id`:通过“列出协作者”获取。 + +## 5. 全量 API 参考(按资源) + +说明:以下为面向开发落地的“快速参考表”,包含 method + path + 用途;QPS 若页面有明确值则标注,否则标记为“见页面”。 + +### 5.1 多维表格 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 获取多维表格元数据 | GET | `/bitable/v1/apps/{app_token}` | 获取多维表格元信息 | 20 QPS | +| 更新多维表格元数据 | PATCH | `/bitable/v1/apps/{app_token}` | 更新多维表格元信息 | 10 QPS | + +### 5.2 数据表 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 更新数据表 | PATCH | `/bitable/v1/apps/{app_token}/tables/{table_id}` | 更新数据表属性 | 10 QPS | +| 列出数据表 | GET | `/bitable/v1/apps/{app_token}/tables` | 查询数据表列表 | 20 QPS | +| 新增数据表 | POST | `/bitable/v1/apps/{app_token}/tables` | 新建一个数据表 | 10 QPS | +| 新增多个数据表 | POST | `/bitable/v1/apps/{app_token}/tables/batch_create` | 批量新建数据表 | 10 QPS | +| 删除一个数据表 | DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}` | 删除指定数据表 | 10 QPS | +| 删除多个数据表 | POST | `/bitable/v1/apps/{app_token}/tables/batch_delete` | 批量删除数据表 | 10 QPS | + +### 5.3 仪表盘 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 复制仪表盘 | POST | `/bitable/v1/apps/{app_token}/dashboards/{dashboard_id}/copy` | 复制指定仪表盘 | 见页面 | +| 列出仪表盘 | GET | `/bitable/v1/apps/{app_token}/dashboards` | 查询仪表盘列表 | 20 QPS | + +### 5.4 视图 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 更新视图 | PATCH | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 更新视图配置 | 10 QPS | +| 检索视图 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 查询单个视图 | 20 QPS | +| 列出视图 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/views` | 查询视图列表 | 20 QPS | +| 新增视图 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/views` | 新建视图 | 10 QPS | +| 删除视图 | DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/views/{view_id}` | 删除视图 | 10 QPS | + +### 5.5 表单 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 更新表单元数据 | PATCH | `/bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}` | 更新表单信息(标题、描述等) | 10 QPS | +| 获取表单元数据 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}` | 获取表单信息 | 20 QPS | +| 更新表单问题 | PATCH | `/bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields/{field_id}` | 更新表单问题项 | 10 QPS | +| 列出表单问题 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/forms/{form_id}/fields` | 获取表单问题列表 | 20 QPS | + +### 5.6 记录 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 检索记录 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 查询单条记录 | 20 QPS | +| 列出记录 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/records` | 查询记录列表(支持 filter/sort) | 10 QPS(并含每分钟上限) | +| 新增记录 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records` | 新增一条记录 | 10 QPS | +| 更新记录 | PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 更新一条记录 | 10 QPS | +| 删除记录 | DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/{record_id}` | 删除一条记录 | 10 QPS | +| 新增多条记录 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create` | 批量新增记录 | 10 QPS | +| 更新多条记录 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_update` | 批量更新记录 | 10 QPS | +| 删除多条记录 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_delete` | 批量删除记录 | 10 QPS | + +### 5.7 字段 + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 列出字段 | GET | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields` | 查询字段列表 | 20 QPS | +| 新增字段 | POST | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields` | 新建字段 | 10 QPS | +| 更新字段 | PUT | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}` | 更新字段配置 | 10 QPS | +| 删除字段 | DELETE | `/bitable/v1/apps/{app_token}/tables/{table_id}/fields/{field_id}` | 删除字段 | 10 QPS | + +### 5.8 高级权限(角色与协作者) + +| API | Method | Path | 说明 | 频率 | +|---|---|---|---|---| +| 列出自定义角色 | GET | `/bitable/v1/apps/{app_token}/roles` | 查询角色列表 | 见页面 | +| 新增自定义角色 | POST | `/bitable/v1/apps/{app_token}/roles` | 创建角色 | 见页面 | +| 删除自定义角色 | DELETE | `/bitable/v1/apps/{app_token}/roles/{role_id}` | 删除角色 | 见页面 | +| 更新自定义角色 | PUT | `/bitable/v1/apps/{app_token}/roles/{role_id}` | 更新角色 | 见页面 | +| 批量删除协作者 | POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_delete` | 批量移除协作者 | 见页面 | +| 批量新增协作者 | POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/batch_create` | 批量添加协作者 | 见页面 | +| 列出协作者 | GET | `/bitable/v1/apps/{app_token}/roles/{role_id}/members` | 查询协作者 | 见页面 | +| 新增协作者 | POST | `/bitable/v1/apps/{app_token}/roles/{role_id}/members` | 添加协作者 | 见页面 | +| 删除协作者 | DELETE | `/bitable/v1/apps/{app_token}/roles/{role_id}/members/{member_id}` | 删除协作者 | 页面异常,按同组接口补齐 | + +## 6. 指南与数据结构要点(用于后续 Skill 建模) + +### 6.1 接入指南(doc-436427) + +1. 鉴权:使用云文档接口的 AccessToken 体系(tenant_access_token 或 user_access_token)。 +2. ID 链路:先拿 `app_token`,再逐层通过 list/get API 获取各子资源 ID。 +3. 典型调用顺序: + 1. 获取 app 元数据 + 2. 列出 tables + 3. 列出 views/fields + 4. 对 records 执行 CRUD +4. 错误定位:优先检查 `app_token/table_id/view_id/record_id/field_id` 是否匹配。 + +### 6.2 数据结构(doc-436428) + +1. 基础对象:App、Table、View、Field、Record。 +2. 记录值结构:`fields` 为 key-value 映射,key 常用字段名或字段 ID(取决于请求参数)。 +3. 字段配置:字段创建/更新时需携带 `type` 与 `property`;不同字段类型对应不同 `property` 子结构。 +4. 关联类字段:单向关联/双向关联字段涉及关联表信息(`table_id/table_name/back_field_id/back_field_name`)。 + +### 6.3 记录筛选开发指南(doc-436454) + +1. `filter`:用于服务端筛选,表达式需遵循文档语法并进行 URL 编码。 +2. `sort`:支持多字段排序,通常为 JSON 数组字符串。 +3. 调优建议:优先在服务端筛选,减少全量拉取。 + +### 6.4 字段编辑指南(doc-436742) + +1. 字段“更新”并非所有类型支持任意变更;需关注字段类型兼容性。 +2. 单选/多选等字段涉及选项集合(option id/name/color)维护。 +3. 公式、关联、人员、地理位置等复杂字段需按类型提供对应 property。 + +### 6.5 附件字段说明(doc-436743) + +附件返回结构核心字段: + +1. `file_token` +2. `name` +3. `size` +4. `tmp_url` +5. `type` +6. `url` + +上传附件前应先阅读素材上传相关文档(云空间素材接口)。 + +### 6.6 高级权限概述(doc-1964912) + +1. 模型:`Role -> Members`。 +2. 角色定义权限规则;成员绑定到角色后获得相应数据访问能力。 +3. 适合按“业务角色”隔离多维表格可见范围。 + +## 7. 通用错误码与排障规律 + +多维表格接口高频错误族(节选): + +1. `1254003`:`app_token` 错误。 +2. `1254004`:`table_id` 错误。 +3. `1254009`:`field_id` 错误。 +4. `1254015`:字段类型和值不匹配。 +5. `1254036`:多维表格正在复制,需稍后重试。 +6. `125404x`:资源不存在(app/table/view/record/field)。 + +建议:将 `错误码 -> 可执行动作` 固化到后续 Agent Skill 的“故障自愈规则”。 + +## 8. 事件文档(与 Bitable 强关联) + +### 8.1 多维表格字段变更事件 + +- 事件类型:`drive.file.bitable_field_changed_v1` +- 包含:操作人信息、`table_id`、字段变更前后值、`revision`、订阅者列表。 +- 适用:字段审计、结构变更同步、Schema Drift 监控。 + +### 8.2 多维表格记录变更事件 + +- 典型动作:`record_added`、`record_deleted`、`record_edited` +- 适用:数据同步、CDC、审计日志与自动化流程触发。 + +## 9. 面向 Agent Skill 的拆分建议(为下一阶段准备) + +1. `bitable-auth-and-bootstrap`:鉴权、ID 发现、基础连通性检查。 +2. `bitable-schema-management`:表/字段/视图/表单的结构管理。 +3. `bitable-record-ops`:记录 CRUD、筛选与批量处理。 +4. `bitable-permission-model`:高级权限(角色+协作者)编排。 +5. `bitable-event-driven-sync`:字段/记录事件订阅与消费。 + +--- + +## 附:抓取完整性说明 + +- 已覆盖导航中 `多维表格` 分组下 384-430 全部子页。 +- 其中 395、402、405、430 在镜像站存在空页或异常: + 1. 395(复制仪表盘)已由镜像检索页补齐 method/path 与用途。 + 2. 402(更新表单元数据)与 405(列出表单问题)已由页面地址与同组接口补齐。 + 3. 430(删除协作者)页面异常,已按目录项与同组 REST 规则补齐路径。 +- 若你后续需要“逐页原文 Markdown 合并版”(几乎 1:1 复制页面内容),可在此文档基础上继续自动化二次抓取并拼接。 diff --git a/18-基础架构及交付部署特战队/10-飞书多维表格/飞书(FeishuLark)官方文档与开发者资源深度研究报告.md b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书(FeishuLark)官方文档与开发者资源深度研究报告.md new file mode 100644 index 0000000..e6d2901 --- /dev/null +++ b/18-基础架构及交付部署特战队/10-飞书多维表格/飞书(FeishuLark)官方文档与开发者资源深度研究报告.md @@ -0,0 +1,408 @@ +# 飞书(Feishu/Lark)官方文档与开发者资源深度研究报告 + +## 执行摘要 + +飞书是一套“沟通(IM)+ 协作内容(云文档/表格/多维表格/知识库)+ 会议(视频会议/妙记)+ 流程(审批/任务/自动化)+ 门户与应用生态(工作台/应用中心)”的一体化协同平台;官网“版本对比”页明确将即时消息、云文档、视频会议、多维表格、日历、任务、知识库、企业邮箱作为核心功能入口,并将飞书项目、人事、会议室、招聘、OKR、绩效等列为“更多产品”。citeturn25search4turn22search0 + +从开发与集成视角,飞书开放平台提供“2,500+ 开放接口与事件”,覆盖身份验证、通讯录、消息与群组、云空间、文档、电子表格、多维表格、知识库、日历、视频会议、会议室、考勤、审批、服务台、任务、邮箱、工作台等主要业务域;这意味着**大多数协同数据对象具备可编程读写与事件驱动集成能力**。citeturn45search1 + +鉴权采用访问凭证机制,核心分为三类 `access_token`:`app_access_token`(应用身份短期令牌)、`tenant_access_token`(租户/企业资源访问凭证)、`user_access_token`(用户身份访问凭证)。citeturn32view5 服务台等少数域还存在额外的“服务台 token”头(`X-Lark-Helpdesk-Authorization`)以获得类似“服务台负责人”权限语义。citeturn33view3 + +Go 生态方面,官方(/v3)Go SDK(`github.com/larksuite/oapi-sdk-go/v3`)不仅封装了访问凭证、签名校验等样板逻辑,还提供事件订阅、卡片回调处理等能力;并且从 GitHub `v3_main` 分支提交记录看,2025–2026 年持续“update api”,2026-03-12 仍有修复提交,维护活跃;Go package 索引显示已发布 `v3.5.3`(2026-01-27)。citeturn17view0turn18view0turn15view0 + +“免费版是否能畅快使用”取决于你对**容量(存储/会议/自动化用量)**与**开发侧配额(API 调用量与频控等级)**的依赖:免费版支持 100 用户并包含即时消息、云文档、视频会议、多维表格、免费邮箱;但付费版提供更高会议时长/参会方数、更多存储、更多多维表格高级能力与定制工作台等。citeturn25search4turn21search3turn44search1 同时,开放平台对“基础版(免费)自建应用”存在月度 API 调用总量上限策略,并会在超限时阻断调用(并返回特定错误码)。citeturn11search1turn32view2 + +## 研究范围与主要信息源 + +本报告严格按你指定的优先顺序进行资料收集,并在文中以引用形式标注证据来源链接: + +优先信息源(按顺序,且**全部列出**):**apifox.cn、feishu.cn**。其中 apifox.cn 主要用于查阅飞书 API/SDK 文档镜像与示例(如鉴权、频控、Go SDK、各业务域接口与事件);feishu.cn 主要用于产品能力、版本对比、帮助中心与开放平台开发文档。citeturn25search3turn25search4turn45search1 + +补充信息源(高质量、尽量中文):飞书开放平台开发文档与公告、helpdesk 帮助中心、官方 GitHub 与 Go package 索引等,用于交叉验证 SDK 维护状态、能力范围与限制。citeturn45search1turn17view0turn18view0 + +## 飞书主要功能模块全景 + +下面以“主要模块 → 核心功能 → 典型用例 → 限制/边界 → 付费差异线索”的方式概括。由于你未指定组织规模/行业/是否订阅企业版,所有结论默认应用于“未指定”场景,并在涉及版本权益时以“官网版本对比/帮助中心/开放平台规则”为准。citeturn25search4turn35search7turn41search0 + +### 沟通协作与会议 + +即时消息(IM) +核心功能包括阅读状态、加急、话题回复、群内置顶、会话分组与免打扰等,且可与文档、日历、视频会议、任务、邮箱互联(例如从会话直接查看同事日历、发起视频通话、将消息转为任务)。citeturn41search0 +典型用例是团队日常沟通、跨职能协作、事件触发型通知(如工单/审批/任务变更提醒)。 +限制/边界包含:客户端侧存在明确“不支持将消息设置为已读”的能力边界(即便可以批量清除未读,也不是“置为已读”语义)。citeturn53search1 +付费差异线索:存储、历史可追溯与容量通常与“总存储空间”等权益绑定,且 IM 文件/消息文件会占用统一存储池(与云文档、妙记、邮箱共用)。citeturn54search3turn25search4 + +日历(Calendar) +日历用于管理日程事件,可共享日程信息、组织团队会议;帮助中心还展示了会议室视图、预约活动(一对一/轮流预约)、第三方日历同步等使用场景,强调与消息/云文档/视频会议联动提升时间管理效率。citeturn35search7 +典型用例:排期与资源协调、外部面试/客户演示的预约活动、跨系统同步(例如将 CRM 关键节点写入日程)。 +限制/边界:企业管理侧可对“日程参与者数量”做安全管控(大规模日程需要审批)。citeturn52search8 +付费差异线索:更偏向容量/安全/组织管控(如关联组织、审批/安全策略),而非日历本体是否可用。citeturn25search4turn52search8 + +视频会议(VC)与会议沉淀(妙记 Minutes) +视频会议强调“会前/会中/会后”的协作闭环:会中可录制(云录制会生成妙记)、AI 总结(生成智能纪要文档)、妙享共享云文档、字幕与翻译、布局切换、特效等;并通过主持人/联席主持人权限保障会议安全。citeturn41search2 +妙记用于音视频转文字与检索定位,适用于会议纪要、培训沉淀、访谈记录等,支持在会议历史、智能纪要助手、妙记主页查看;交互包括文字与音视频定位、关键词搜索高亮等。citeturn53search4turn41search2 +限制/边界:同时参会人数上限因版本而异,企业可通过升级版本或购买增值服务扩大容量。citeturn52search2 另外,妙记语音转文字在基础版存在“体验额度”上限,到达上限将无法继续使用;商业版/企业版不受限制(并且妙记会占用企业存储空间,存储不足会阻止生成)。citeturn24search7turn54search3 +付费差异线索:官网版本对比明确列出商业标准版起提供更高会议时长/参会方数、并提升总存储空间;更高套餐继续提升参会方数与存储,并叠加 SSO/高级安全等。citeturn25search4 + +### 内容协作与知识管理 + +云文档套件(文档/表格/思维笔记/幻灯片/多维表格/文件) +帮助中心将其统称为“云文档”,覆盖内容生产、协作与存储管理场景;并提供“历史版本保留与一键还原”机制(但查看/还原通常要求编辑权限)。citeturn36search0turn53search3 +典型用例:项目文档体系(PRD/会议纪要/复盘)、团队知识沉淀、跨部门协同写作。 +限制/边界:云文档与消息文件、妙记、邮箱共用企业存储空间,容量随版本不同;管理员可对成员/部门设置存储上限。citeturn54search2turn54search3 +付费差异线索:版本对比页展示存储空间随版本显著提升(例如商业标准版 1500GB、商业专业版 5TB、商业旗舰版 15TB)。citeturn25search4 + +电子表格(Sheets) +表格用于数据处理与分析,并强调多人实时协同、历史记录溯源等。citeturn46search2 +典型用例:轻量报表、数据清洗、运营台账;与 API 结合可作为“数据落地层/轻量 BI”载体。 +限制/边界:复杂权限与大规模数据治理通常依赖更高级的权限与容量策略(见多维表格高级能力/高级权限)。citeturn25search4turn46search3 +付费差异线索:更多体现在存储与高级能力组合上。citeturn25search4 + +多维表格(Bitable/Base) +多维表格定位为“表格形态的在线数据库”,除存储外强调分析可视化,并具备字段/视图/仪表盘/插件等个性化能力,多人实时协同与历史溯源也是核心卖点。citeturn36search1turn36search5 +其“自动化流程”允许配置触发条件与执行操作,在数据变更时自动运行(例如汇总多行记录并以消息卡片推送、定时提醒、状态变更通知等),但启用权限要求“所有者或可管理权限且同企业”。citeturn44search0 +限制/边界:自动化存在用量/次数管理与“即将耗尽”提醒,且企业可通过“扩容包”购买存储、多维表格自动化流程、视频会议用量等权益额度来避免影响使用。citeturn44search0turn44search1 +付费差异线索:官网明确商业专业版起包含“多维表格高级能力”,并进一步叠加“定制工作台”“关联组织能力”等。citeturn25search4 + +知识库(Wiki) +知识库用于将云文档按结构化分类与层级页面树组织起来,提升知识流转效率;帮助中心提供创建/成员与管理员权限管理、外部成员限制、以及“谁可新建知识库”等组织级管控说明。citeturn37search1turn37search5turn37search0 +典型用例:部门 SOP、项目知识库、领域专题库、个人知识管理。帮助中心还提到“知识库数量限制取消,企业全员都能免费创建知识库”。citeturn37search4 +限制/边界:不支持将外部用户设为知识库管理员;是否能为知识库添加外部成员依赖“关联组织能力”等组织设置。citeturn37search5turn25search4 +付费差异线索:涉及跨组织协作时,“关联组织能力”在更高版本中作为权益出现。citeturn25search4 + +### 流程与业务应用 + +任务(Task/Todo) +任务用于创建/分配/状态跟进与团队协作,通过任务清单推进协作;并可与会话/文档联动创建任务。citeturn35search0turn40search2 +典型用例:研发/运营任务看板、个人 GTD、缺陷/需求流转提醒(结合自动化与消息卡片)。 +限制/边界:面向开发者的任务开放 API 支持 tenant 与 user 两类鉴权,且商店应用需要平台与企业管理员的安装/升级链路。citeturn49search3turn49search2 +付费差异线索:更偏向组织规模与容量上限,而非任务是否可用。citeturn25search4 + +审批(Approval) +审批用于在线化企业流程(请假、报销、出差等),帮助企业快速建立内部审批流程;开放 API 支持飞书原生与三方系统接入,面向开发者的能力聚焦“审批实例与任务”的创建/查询/管理。citeturn35search1turn49search0turn49search1 +典型用例:将 OA/ERP/财务系统审批与飞书打通、审批通过后自动写入多维表格/日历、或触发机器人通知。 +限制/边界:审批属于强权限域,通常需要企业管理员审核权限申请并受组织策略约束。citeturn25search3turn32view4 +付费差异线索:更多落在组织管控/安全/容量(而不是“有没有审批”)。citeturn25search4 + +服务台(Helpdesk) +服务台 API 的“接入指南”指出:除 tenant/user access token 外,还需在 Header 中携带服务台 token(`X-Lark-Helpdesk-Authorization`),以获得与服务台负责人相当的权限语义;并且企业自建应用需在开发者后台申请并由企业管理员审核,且“暂不支持应用商店应用”。citeturn33view3 +典型用例:IT 工单系统、客服/内服工单与机器人联动、工单状态变更推送。 +限制/边界:鉴权链更复杂(双重鉴权),并具有更严格的权限与审计要求。citeturn33view3 +付费差异线索:与组织需求相关,但公开对比主要集中在容量/安全。citeturn25search4 + +飞书项目(专业项目管理平台) +官方产品页强调“可视化工作流引擎(节点流)”“多视图(列表/看板/甘特/树形/全景)”“高频流程自动化”“自定义页面搭建(轻应用)”,并声明提供 WebHook 与 API 以集成外部系统、扩展平台边界。citeturn22search0 +典型用例:复杂项目交付(PMO/产研)、跨团队流程标准化、连接代码/测试/工单系统形成闭环。 +限制/边界:飞书项目的开放能力细节需进一步以其专用 API 文档核对(本次仅从产品页获得“存在 WebHook/API”这一事实)。citeturn22search0 +付费差异线索:通常作为“更多产品”单独销售或与企业版方案绑定。citeturn25search4turn22search0 + +### 门户与生态集成 + +工作台与应用中心(第三方应用集成枢纽) +帮助中心将“默认工作台”定义为企业的**免费门户解决方案**:可用宣传栏展示组织信息,并聚合办公所需应用入口;管理员还可在应用中心为团队挑选安装应用。citeturn43search3turn43search4 +应用中心在 2024.08 升级为“应用中心”并可内置在飞书导航;管理员还能设置“免审安装应用”等策略。citeturn43search1 +限制/边界与付费差异:官网版本对比将“定制工作台”列为商业专业版能力;开放平台文档也指出“定制工作台小组件能力”面向商业专业版/商业旗舰版/企业版租户的自建应用开放。citeturn25search4turn21search3 + +## 开放 API 能力与接口分组 + +### API 总体覆盖与分组方法 + +飞书开发文档首页给出“2,500+ 开放接口与事件”,并按业务域披露接口数量(例如:通讯录 78 API/17 事件;消息与群组 75 API/14 事件;文档 12 API;电子表格 56 API;多维表格 52 API;知识库 16 API;日历 44 API/4 事件;视频会议 56 API/18 事件;审批 55 API/7 事件;任务 75 API/3 事件;服务台 50 API/4 事件;邮箱 67 API/1 事件;工作台 3 API)。citeturn45search1 +因此,本报告按“命名空间/业务域(如 contact/v3、im/v1、docx/v1、calendar/v4、vc/v1 等)”拆解能力,并为每类补充鉴权、权限与典型场景。citeturn45search0turn48search2turn47search0 + +### 鉴权、权限与调用限制的共性规则 + +鉴权与 Token +飞书开放平台将访问凭证分为 `app_access_token`、`tenant_access_token`、`user_access_token` 三类。citeturn32view5 其中 `user_access_token` 可通过登录预授权码 `code` 获取,并可在过期后用 `refresh_token` 刷新;文档明确其最大有效期为 6900 秒。citeturn33view1turn33view2 +服务端 API 调用需要将访问凭证放入请求 Header(`Authorization: Bearer `),并在完成创建应用、申请权限、获取访问凭证、设置 IP 白名单后再调用。citeturn25search3 + +权限申请与审查 +权限以 scope 形式呈现,存在“普通/高级”等分级;例如通讯录相关 scope 可细分到用户基础信息、组织架构信息、邮箱信息等。citeturn32view4 高敏感字段也可能要求“字段权限”,否则响应不会返回相应字段。citeturn33view1turn38search2 + +频控与配额 +开放平台存在分级频控策略,触发时通常返回 HTTP 429,并在响应头给出窗口上限与重置时间(示例:`x-ogw-ratelimit-limit`、`x-ogw-ratelimit-reset`)。citeturn32view2 +另有按接口粒度的频控示例:如“更新应用发送的消息卡片”注明单条消息更新频控 5 QPS;“docx 获取文档纯文本内容”注明单应用 5 次/秒;“docx 更新块”注明单应用 3 次/秒;“获取工作表(电子表格)”示例为每分钟 100 次。citeturn38search0turn47search2turn38search3turn46search4 +在“基础版(免费)”场景,开放平台还存在“自建应用 API 调用量上限”政策,并可能在超限后阻断调用(并返回错误码提示)。citeturn11search1turn32view2 + +### 按业务域列出可实现能力 + +身份验证与账号体系(auth/authen) +可实现:获取/刷新 `user_access_token`、获取企业自建应用 `tenant_access_token`/`app_access_token`、基于 `user_access_token` 获取登录用户信息等;开放平台“API 列表”示例也在“身份验证”域给出这些接口。citeturn45search0turn33view1turn33view2turn32view0turn32view1 +权限与认证:典型为应用凭证 + Bearer token;网页应用免登场景依赖用户授权码 `code`。citeturn33view1turn21search1 +示例场景:企业内门户(H5)免登后读取用户信息并按角色展示功能;或在服务端定时刷新 token 维持后台集成服务长期运行。citeturn21search1turn25search3 + +通讯录(contact/v3 等) +可实现:读取/创建/更新/删除用户与部门、查询授权范围(scopes)、用户组管理等;开放平台 API 列表给出了“创建用户=员工入职”“删除用户=离职”的语义与 PATCH 更新语义。citeturn45search0turn32view4 +权限与认证:高颗粒度 scope(如 `contact:user.base:readonly` 等)决定字段是否返回;通讯录授权范围影响能访问哪些组织数据。citeturn32view4turn45search0 +示例场景:HR 主数据同步;入离职事件触发自动开通/回收系统权限。citeturn45search1turn55search1 + +消息与群组(im/v1 等) +可实现:发送消息、回复、撤回、查询历史消息、消息加急、Pin、表情回复;对“消息卡片”可 PATCH 更新(但仅共享卡片、需 `update_multi:true`,且仅支持 14 天内消息、并有大小与频控限制)。citeturn38search0turn38search5 +事件能力:可订阅“消息已读”“消息撤回”等事件,用于构建自动化与审计链路。citeturn38search2turn38search1turn38search6 +示例场景:审批通过自动推送卡片并可后续更新状态;机器人拉群告警(SDK 示例也提及此类组合场景)。citeturn38search0turn15view0 + +云空间与文件(drive/import/export 等) +可实现:文件上传后导入生成 doc/docx/sheet/bitable 等类型;导入任务/查询结果等异步任务模式。citeturn46search0 +示例场景:把历史 Office/Markdown 资产批量导入飞书;把外部系统生成的报表文件导入到云文档并共享。citeturn46search0 + +新版文档(docx/v1) +可实现:创建文档、获取文档基本信息、获取纯文本内容、获取/创建/更新/批量更新/删除 Block(文档以 `document_id` 标识,Block 为内容树最小构建单元)。citeturn47search0turn47search2 +限制:docx 接口存在较多结构校验与上限错误码(Block 数量、层级深度、表格单元格数量等),并明确频率限制。citeturn47search2turn38search3 +示例场景:自动生成周报/会议纪要、把外部系统状态以结构化 Block 写入文档、用文档作为人机协作“可读可写视图”。citeturn47search0turn47search2 + +电子表格(sheets 系列) +可实现:读取/写入/筛选数据、操作工作表/范围等;官方概述强调用于数据处理、展示与分析。citeturn46search1turn46search4 +限制:接口粒度频控示例(每分钟 100 次)。citeturn46search4 +示例场景:将 BI 指标写入表格并用作团队日报;批量填表、批量导出素材列表等(SDK 示例也覆盖表格素材场景)。citeturn46search4turn15view0 + +多维表格(bitable/v1) +可实现:以 `app_token` 为核心,管理数据表(table)、视图(view)、记录(record)、字段(field)、以及高级权限 role/member;并支持 tenant/user 两类 token 调用(取决于权限与场景)。citeturn46search3turn46search5 +示例场景:把多维表格作为轻量业务系统(项目/客户/巡检)数据底座;用 API 做双向同步与批量写入;配合自动化规则做通知与流转。citeturn46search5turn44search0 + +知识库(wiki/v2) +可实现:管理知识空间(space/workspace)、成员、设置、节点(node)与异步任务;文档明确所需权限(如 `wiki:wiki` 与 `wiki:wiki.readonly`)以及应用获得权限的方式(加入知识空间成员/管理员或成为文档协作者)。citeturn50search0turn50search3 +关键边界:并非所有节点类型都能通过 API 编辑;Apifox 常见问题指出“目前支持通过 API 编辑的类型有:文档、电子表格、多维表格”,其他类型节点需以“创建节点/移动已有文档到知识库”方式组织,而内容编辑要回到对应业务域接口。citeturn50search1turn50search0 +示例场景:自动化搭建项目知识库骨架;把项目文档/表格/多维表格节点按规则挂入知识空间目录树。citeturn50search0turn50search1 + +日历(calendar/v4) +可实现:操作日历、日程、忙闲信息等实体;开发者可“以应用或用户身份”调用日历 API 操作数据,并支持会议室资源与参与者管理。citeturn48search2turn48search3 +示例场景:自动创建会议日程、同步请假状态到日历、将外部系统的里程碑写入团队公共日历。citeturn48search3turn52search8 + +视频会议与会议室(vc/v1、meeting_room 等) +可实现:会议预约/操作/录制/报告/会议室管理等;并可订阅“会议开始”等事件(如 `vc.meeting.meeting_started_v1`)以触发外部系统动作。citeturn48search1turn48search0 +示例场景:会议开始自动创建纪要文档、会后导出参会人数据、生成会议报告。citeturn48search1turn52search4 + +审批(approval/v4) +可实现:面向审批实例与任务的集成,支持飞书原生与三方系统接入。citeturn49search0turn49search1 +示例场景:第三方 OA 触发飞书审批;审批通过后回写 ERP 并推送消息卡片、写入多维表格台账。citeturn49search0turn38search0turn46search3 + +服务台(helpdesk) +可实现:工单/实体的创建、修改、删除、获取;并采用 tenant/user token + 服务台 token 的复合鉴权;且文档指出“暂不支持商店应用”。citeturn33view3 +示例场景:企业 IT 工单系统与飞书集成、机器人查询工单详情。citeturn33view3 + +任务(task/v1) +可实现:任务增删改查、权限管理,支持 tenant/user token;并支持 AppLink 直达任务详情页。citeturn49search2 +示例场景:将外部 Issue 同步为飞书任务并在会话中流转。citeturn49search2turn41search0 + +邮箱(mail) +可实现:开放平台统计为 67 API,并有事件能力(1 事件)。citeturn45search1 帮助中心也强调邮箱与消息/文档/日历深度融合、可在飞书内直接管理邮件。citeturn35search2 +示例场景:自动归档/同步邮件到项目空间;重要邮件触发群通知与任务创建。citeturn35search2turn49search2 + +组织业务套件(人事/招聘/OKR 等) +开放平台文档显示人事(EHR/CoreHR)、招聘(Hire)、OKR 等均提供服务端 API,用于对接员工花名册、招聘生命周期、目标管理等。citeturn55search0turn55search6turn55search3 +示例场景:HR 主数据与入职流程自动化;招聘投递/面试/Offer 状态同步;OKR 周期与目标指标的系统对齐。citeturn55search0turn55search6turn55search7 + +### API 调用流程图(示意) + +```mermaid +flowchart TD + A[创建应用
自建/商店] --> B[申请权限 Scopes
管理员/平台审核] + B --> C[配置安全设置
IP 白名单/回调地址等] + C --> D{选择身份} + D -->|应用身份| E[获取 app_access_token] + D -->|租户身份| F[获取 tenant_access_token] + D -->|用户身份| G[免登/OAuth 获取 user_access_token
可 refresh] + E --> H[调用 OpenAPI
Authorization: Bearer token] + F --> H + G --> H + H --> I{触发频控/配额?} + I -->|否| J[成功返回 JSON] + I -->|是| K[HTTP 429 / 错误码
按 reset 等待重试] +``` + +流程中“完成创建应用、申请权限、获取访问凭证、设置 IP 白名单后才能调用 API”与“Authorization: Bearer ”来自 API 调用指南;频控触发返回 429 与 `x-ogw-ratelimit-*` 响应头来自频控策略说明。citeturn25search3turn32view2 + +## 飞书 Go SDK 能力、与 HTTP 直调差异及维护状态 + +### Go SDK 能实现什么 + +Apifox 的 Go SDK“开发前准备”文档明确:Go SDK 用于“调用服务端 API、处理事件和回调”;安装方式为 `go get -u github.com/larksuite/oapi-sdk-go/v3@latest`,并给出后续“调用服务端 API / 处理事件 / 处理回调 / 场景示例”等入口。citeturn32view3 +GitHub 仓库 README 也说明 SDK 目标是让开发者便捷调用开放 API、处理订阅事件、处理服务端推送的卡片行为,并指出 SDK 封装了 token 维护、加解密、签名校验等“长逻辑”,提供类型系统与语义化接口。citeturn15view0 + +从 Go package 文档可见 SDK `Client` 聚合了大量业务域 Service(如 `Im`、`Calendar`、`Vc`、`Docx`、`Sheets`、`Base`、`Wiki`、`Approval`、`Task`、`Mail`、`Helpdesk`、`Corehr`、`Hire`、`Okr` 等),并提供 `GetTenantAccessTokenBySelfBuiltApp`、`Post/Get/Put/Patch/Delete` 等方法;同时内置 `FeishuBaseUrl` 与 `LarkBaseUrl`,暗示同一 SDK 可面向 Feishu(国内)与 Lark(海外)调用不同基址。citeturn18view0 + +### 与直接调用 HTTP API 的差异 + +开发体验差异 +HTTP 直调需要自行处理:token 获取与续期、请求签名/验签、序列化、错误码与重试、事件回调解析等;SDK 则将这些样板逻辑内聚,并提供强类型模型与语义化方法(降低“路径/参数拼错”的概率)。citeturn15view0turn25search3 + +事件/回调差异 +开放平台“卡片回调处理”文档指出:若已集成飞书 SDK 且为企业自建应用,推荐使用更安全高效的“长连接订阅方式”,SDK 可与开放平台建立 WebSocket 全双工通道接收回调。citeturn19search2turn32view3 +这类能力若用 HTTP 直调实现,通常需要自行搭建公网回调服务、验签、解析与重试队列。 + +覆盖范围差异 +SDK 覆盖了大量业务域,但开放平台接口版本迭代较快;当 SDK 尚未封装某新 API/或遇到少量“历史版本(不推荐)”接口时,仍可能需要使用 SDK 的通用请求能力(如 `Client.Do` / `Client.Get/Post`)或退回 HTTP 直调。Go package 中展示了 `Do/Get/Post/Patch/...` 等通用方法就是这种“兜底”能力。citeturn18view0turn15view0 + +### 维护状态与兼容性判断 + +维护活跃性 +GitHub `v3_main` 分支提交历史显示:2025 年到 2026 年持续更新,且 2026-03-12 仍有 bugfix 提交。citeturn17view0 +Go package 索引显示版本 `v3.5.3` 发布于 2026-01-27,并提示并非模块最新版本(意味着仍在迭代)。citeturn18view0 + +兼容性与环境风险 +开放平台首页公告提示 2026-03-17 至 2026-03-24 进行服务器证书升级,并提醒旧版 JDK 可能无法验证新证书导致 API 调用报错(点名 Java/JDK 版本要求)。虽然这是 Java 例子,但对所有语言集成而言都提示了“证书/信任库更新”是生产风险点。citeturn43search2 + +### Go SDK 示例代码片段(最小形态,示意) + +> 说明:以下示例为“结构示意”,具体 Service 方法名应以你要调用的业务域 SDK 文档与接口版本为准;当 SDK 尚未封装目标 API,可使用 `Client.Do`/`Client.Post` 的通用能力。Go SDK 的安装方式与 Client 能力边界来自官方文档与 go.dev。citeturn32view3turn18view0turn15view0 + +```go +package main + +import ( + "context" + lark "github.com/larksuite/oapi-sdk-go/v3" +) + +func main() { + // 1) 初始化客户端(自建应用) + cli := lark.NewClient("APP_ID", "APP_SECRET") + + // 2) 以通用方式调用某个 OpenAPI(示意) + // 实际调用时需选择 access token 类型(tenant/app/user),并按 API 要求构造 path/body + _, _ = cli.Get(context.Background(), + "/open-apis/contact/v3/scopes", // 示例:获取通讯录授权范围 + nil, + lark.AccessTokenTypeTenant, // 示例:tenant_access_token + ) +} +``` + +上例中“通讯录授权范围”接口在官方 API 列表中存在;token 类型与 Bearer 方式为开放平台通用鉴权框架。citeturn45search0turn32view5turn25search3 + +## 可通过 API 修改/自动化的边界与前端平台可行性评估 + +### 哪些功能可以通过 API 修改/自动化 + +结论:飞书的“协同数据对象”(人/组织、消息、日程、文档/表格/多维表格、知识库节点、任务、审批实例等)大多可以通过 API 读写;并可通过“事件订阅/回调”实现事件驱动自动化。证据是开放平台对这些域提供大量 API 与事件计数,并在各域概述中明确“创建/更新/删除/查询”等能力。citeturn45search1turn47search0turn46search3turn49search0turn49search2turn50search0 + +较强的可自动化场景包括: + +文档/表格/多维表格的内容生成与同步 +docx/v1 能以 Block 树方式创建与编辑文档,并提供批量更新;电子表格与多维表格提供数据写入、视图/字段/记录管理等。citeturn47search0turn47search2turn46search1turn46search3 + +知识库的结构化编排 +wiki/v2 提供知识空间、节点、成员与权限说明;并可将已有云文档加入知识库、移动节点。citeturn50search0turn50search3 + +流程驱动(审批/任务/会议)联动通知 +审批开放 API 面向审批实例/任务;任务 API 面向任务增删改查;视频会议可订阅会议开始等事件,并结合消息卡片推送与后续更新。citeturn49search0turn49search2turn48search0turn38search0 + +### 哪些功能不能或很难通过 API 修改/自动化 + +结论:主要受限于三类原因:未开放接口、权限/合规限制、UI/交互语义不提供“远程操控”。 + +典型“不能/较难”点位(明确证据或强提示): + +无法实现某些客户端交互语义的“强制化” +例如帮助中心明确“不支持将消息设置为已读”。这通常意味着即便有事件(如机器人消息已读事件),也不提供“写回已读状态”的接口语义。citeturn53search1turn38search2 + +消息编辑能力在 OpenAPI 中是“受限子集” +客户端支持编辑已发送消息(默认 24 小时内、单条最多 20 次),但 OpenAPI 明确支持的是“更新应用已发送的消息卡片”,且要求共享卡片、14 天内、大小限制、5QPS 等;两者并不等价。citeturn29search2turn38search0 +因此,若你的自动化需要“像人一样编辑任意文本消息”,应默认不可行;更可行的是“发送卡片并更新卡片状态”。 + +知识库节点并非全类型可编辑 +wiki 常见问题明确:可通过 API 编辑的节点类型目前支持“文档、电子表格、多维表格”,其他类型需要通过节点组织/挂载实现,而内容编辑要落回对应域或不支持。citeturn50search1turn50search0 + +服务台等强权限域存在额外鉴权与应用形态限制 +服务台 API 需要额外 `X-Lark-Helpdesk-Authorization`,且“暂不支持应用商店应用”。这类限制会直接影响你能否把能力做成对外售卖的通用 SaaS。citeturn33view3 + +### 飞书是否可作为“项目协同的前端页面平台” + +结论:**可以**,且形态丰富;但需要把它视为“门户+多种嵌入式运行时”的平台,而不是传统意义的“任意自定义网页托管平台”。你的设计需要在“入口(工作台/会话/文档/多维表格)→ 形态(H5/小程序/卡片/组件/插件/小组件)→ 权限(scope 与可见范围)→ 数据(本地缓存 vs 服务端存储)”的约束下做架构取舍。citeturn19search0turn20search1turn21search3turn21search0turn25search3 + +可选前端形态与适用点: + +网页应用(H5 in Feishu) +官方定义为运行在飞书客户端内的 H5 应用,可调用客户端开放接口(JSAPI),包含系统能力与通讯录/云文档等;支持免登录,并可配置多种入口(搜索快捷入口、聊天框“+”菜单等)。其限制包括:交互响应可能慢于原生、对网络质量要求高。citeturn19search0turn21search1turn21search2 +适用:已有 H5 业务系统快速接入飞书、轻量业务门户、需要频繁更新内容的场景。citeturn19search0 + +小程序(Mini App) +开放平台提供“企业内发布小程序”的上手路径与开发工具链。citeturn19search1 +数据存储限制:小程序本地缓存类似 LocalStorage,数据以“用户+小程序”隔离,单 key 最大 1MB,总上限 10MB,并提示不要存放重要数据(可能丢失)。citeturn21search0 +适用:需要更接近原生的体验/组件体系、且能接受“关键数据落在自建后端/多维表格/云文档”的架构。 + +飞书卡片(消息内 UI) +卡片可做信息呈现与交互,且可订阅/处理卡片回调;文档建议自建应用优先使用 SDK 长连接接收回调。citeturn19search2turn32view3 +适用:审批/工单/告警等“状态型信息流”,在消息里完成轻量操作。 + +云文档小组件、多维表格插件、网页组件 +云文档小组件:在文档中嵌入垂直场景模块,打通工作流与文档协作。citeturn19search3 +多维表格插件:在多维表格中嵌入自定义产品,扩展表格能力(含记录视图/数据表视图/自动化操作等类型)。citeturn20search0 +网页组件:在企业自有系统网页中嵌入飞书模块(云文档组件、成员名片组件、搜索组件),并明确“仅适用于自建应用,暂不支持商店应用”。citeturn20search1 +适用:把飞书能力“嵌回”企业系统,或把企业系统“嵌进”飞书,从而实现双向协同。 + +工作台小组件(Block) +工作台小组件是“轻量级功能块”,可作为独立应用发布能力;但“定制工作台小组件能力”面向商业专业版/商业旗舰版/企业版租户的自建应用开放(免费版不可用)。citeturn21search3turn25search4 +适用:在工作台首页做数据看板/项目入口/运营公告等“门户型信息消费”。 + +## 免费版能力与限制评估与结论性建议 + +### 免费版可用功能与关键限制 + +可用功能(官方明示) +官网版本对比页明确:免费版包含“即时消息、云文档、视频会议、多维表格、免费邮箱”,并支持 100 用户。citeturn25search4 +知识库侧,帮助中心文章明确“知识库数量限制取消,企业全员都能免费创建知识库”。citeturn37search4 + +容量与用量限制(对“畅快使用”影响最大) +存储:即时消息、云文档、妙记、邮箱共用存储空间,且不同版本存储容量不同;用户/管理员可能收到存储不足通知,需要清理或扩容。citeturn54search3turn54search2 +会议:参会人数上限因版本不同,需升级或购买增值服务提升。citeturn52search2 +妙记:基础版语音转文字存在体验额度上限;商业版/企业版不受限制。citeturn24search7 +多维表格自动化:自动化流程存在运行次数/用量管理与耗尽提醒;企业还可购买“扩容包”补足存储、自动化、视频会议用量等权益。citeturn44search0turn44search1 + +开发者能力限制(API 配额与频控) +频控:触发会返回 HTTP 429,需按 `x-ogw-ratelimit-reset` 等等待重试。citeturn32view2 +基础版自建应用 API 调用量:开放平台公告明确基础版存在“自建应用 API 调用量上限”策略,并会在超限后限制调用(返回特定错误码)。citeturn11search1 +此外,一些“门户/小组件类能力”本身就要求更高套餐,例如“定制工作台”“工作台小组件(定制)”。citeturn25search4turn21search3 + +### 结论性建议 + +若你的目标是“把飞书当作项目协同主阵地 + 自动化引擎” +优先建议采用“多维表格(数据底座)+ 文档/知识库(沉淀)+ 消息卡片(通知与轻交互)+ 审批/任务(流程)”的组合,因为这些对象均有清晰 API 读写域与事件机制支撑自动化闭环。citeturn46search3turn47search0turn49search0turn49search2turn38search0turn38search6 +在前端承载上,优先从“网页应用(H5,免登 + JSAPI)”切入,用工作台作为统一入口;当对性能/交互有更高要求再转小程序或小组件。citeturn19search0turn21search1turn20search2 + +若你处于免费版且希望“尽量不被限制卡住” +需要提前评估三件事:企业存储池是否够用、会议与妙记的用量是否会达上限、多维表格自动化是否会频繁耗尽;如果你的协作强依赖“长会议 + 大量录制转写 + 大文件 + 大规模自动化/集成调用”,免费版很可能会出现体验断点。citeturn54search3turn24search7turn44search1turn11search1 +若必须免费起步,建议把“高消耗计算与存储”外置:妙记只对关键会议启用;长周期材料沉淀到文档/知识库而非大量视频;数据聚合优先多维表格而非大量消息附件;并对 API 调用做缓存/合并写入,降低配额压力。citeturn24search7turn46search3turn32view2turn11search1 + +### 综合对比表 + +| 功能模块 | 典型对象/能力 | API 支持(证据) | Go SDK 支持(证据) | 是否可通过 API 修改/自动化 | 免费版主要限制线索 | +|---|---|---|---|---|---| +| 即时消息/群组 | 发消息、群管理、卡片交互与更新 | 消息与群组 75 API/14 事件;支持更新卡片但受限 | SDK 含 `Im` Service;并支持卡片回调处理 | **部分可改**:可发消息/撤回/更新卡片;“置为已读”等语义不支持 | 存储池共用;API 配额/频控;部分交互语义不可控 | +| 日历 | 日历/日程/忙闲/会议室预约 | 日历 44 API/4 事件;calendar/v4 概述 | SDK 含 `Calendar` Service | **可改**:创建/更新日程、查忙闲;可做事件驱动联动 | 主要受组织安全/人数管控与容量影响 | +| 视频会议 + 妙记 | 会议预约/录制/报告;会议转写与纪要 | 视频会议 56 API/18 事件;vc/v1 概述;妙记存在 API | SDK 含 `Vc`、`Minutes` Service | **部分可改**:会议管理/导出/事件触发;会议内 UI 操控有限 | 参会人数上限随版本;妙记转写基础版有额度上限 | +| 云文档(Docx/Drive) | 文档创建与 Block 级编辑;导入导出 | 文档 12 API;docx/v1 方法列表;导入能力 | SDK 含 `Docx`/`Drive`/`Docs` 等 Service | **可改**:可自动生成与更新内容(但有结构/频控约束) | 存储池共用且随版本不同;大规模写入受频控影响 | +| 电子表格(Sheets) | 表格/工作表/范围数据读写 | 电子表格 56 API;支持读写与频控示例 | SDK 含 `Sheets` Service | **可改**:数据同步、批量写入;注意接口频控 | 存储池共用;API 配额/频控 | +| 多维表格(Bitable) | 数据表/视图/记录/字段/高级权限;自动化 | 多维表格 52 API;bitable/v1 全资源方法 | SDK 含 `Base` Service | **强可改**:可作为业务系统底座;可与自动化/消息结合 | 专业版含“高级能力”;自动化有用量/扩容机制 | +| 知识库(Wiki) | 知识空间/节点树/成员与权限 | 知识库 16 API;wiki/v2 概述 + 权限说明 | SDK 含 `Wiki` Service | **部分可改**:结构/权限可自动化;内容编辑仅 doc/sheet/bitable 等类型 | 免费可创建;跨组织成员与“关联组织能力”相关 | +| 任务(Task) | 任务增删改查、评论、权限 | 任务 75 API/3 事件;task/v1 概述 | SDK 含 `Task` Service | **可改**:任务同步、提醒、与审批/消息联动 | 主要受 API 配额与组织规模/容量影响 | +| 审批(Approval) | 实例与任务管理、三方系统接入 | 审批 55 API/7 事件;approval/v4 概述 | SDK 含 `Approval` Service | **可改**:发起/查询/回写审批数据(强权限域) | 权限申请与管理员审核成本;与组织管控相关 | +| 工作台/应用中心 | 门户、应用入口、分发与安装策略 | 工作台 3 API;门户/应用中心机制在帮助中心 | SDK 含 `Application`/`Workplace` 等(以 Client 为准) | **部分可改**:更多是“入口与分发”,核心是配置/形态接入 | 定制工作台/小组件对更高版本开放 | +| 服务台(Helpdesk) | 工单、知识库等服务台实体 | 服务台 50 API/4 事件;需服务台 token;限制商店应用 | SDK 含 `Helpdesk` Service;且可配置 helpdesk credential | **可改但门槛高**:双重鉴权、强权限 | 应用形态受限(不支持商店应用);合规与权限成本 | + +表中“API 数量证据”来自开发文档首页“开放接口一览”;各域概述/接口限制来自开放平台/Apifox 文档;Go SDK 的 Service 证据来自 Go package 文档中的 `Client` 字段列表与 SDK 介绍。citeturn45search1turn38search0turn48search3turn47search0turn46search4turn46search3turn50search0turn49search2turn49search0turn33view3turn18view0 + +## 未明确覆盖的开放问题与风险假设 + +消息“存储时长/可检索时长”的最新口径 +官网版本对比、公告与帮助中心之间可能存在信息更新与口径差异;本次在可公开抓取的页面中未能获得一份“可逐条核对的、含生效日期的消息存储时长对比表”,因此在需要合规留痕/审计的场景应进一步以企业合同/最新公告与管理后台配置为准。citeturn25search4turn26search1 + +飞书项目(Project)开放 API 的细粒度能力范围 +产品页明确“提供全面 WebHook 和 API 接口”,但是否覆盖“流程节点/自定义页面组件/权限模型”等仍需以其专用开发文档核实。citeturn22search0 + +免费版 API 配额政策的持续变动风险 +开放平台对基础版自建应用的调用量上限策略带有阶段性调整与临时措施描述,且会发生变更;任何“依赖高频 API 调用”的方案都应设计降级策略(缓存、批处理、异步队列、幂等与重试退避)。citeturn11search1turn32view2 + +证书/信任库变更导致的生产故障风险 +开放平台证书升级公告(2026-03-17~2026-03-24)提示了底层 TLS 依赖变更会影响 API 调用;建议将“证书/信任库”纳入发布前检查项。citeturn43search2 + +## 主要参考链接 + +优先站点(按你指定顺序) +apifox.cn:飞书 API/SDK 文档镜像(鉴权、频控、各业务域接口与事件、Go SDK 指南等)。citeturn25search3turn32view2turn32view3turn47search0turn46search3 +feishu.cn:产品版本对比与能力概览、帮助中心与开放平台开发文档。citeturn25search4turn45search1turn41search0turn43search3turn19search0 + +补充高质量来源 +飞书开放平台开发文档首页与 API 列表。citeturn45search1turn45search0 +飞书开放平台网页应用、小程序、网页组件、多维表格插件、工作台小组件等指南。citeturn19search0turn19search1turn20search1turn20search0turn21search3 +官方 Go SDK:GitHub 仓库、提交历史与 Go package 索引。citeturn15view0turn17view0turn18view0 \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/3-对行业组交接需求/快文-协作规范.md b/18-基础架构及交付部署特战队/3-对行业组交接需求/快文-协作规范.md index dd2b461..d0916a9 100644 --- a/18-基础架构及交付部署特战队/3-对行业组交接需求/快文-协作规范.md +++ b/18-基础架构及交付部署特战队/3-对行业组交接需求/快文-协作规范.md @@ -20,7 +20,7 @@ ## 工作职责及界面说明 1. 客户组 - 1. 填写部署需求 + 1. 填写部署或者升级需求 1. 「中移凌云本地化部署-需求收集表」https://f.kdocs.cn/ksform/w/write/tyEGyJMm/ 2. 「中移凌云本地化部署-升级-需求收集表」https://f.kdocs.cn/g/Wl3ZK1b5/ 2. 追踪部署进度 diff --git a/18-基础架构及交付部署特战队/8-AI及视频流媒体对接规范/1-视频流媒体部署标准化-prompt.md b/18-基础架构及交付部署特战队/8-AI及视频流媒体对接规范/1-视频流媒体部署标准化-prompt.md new file mode 100644 index 0000000..29c6e78 --- /dev/null +++ b/18-基础架构及交付部署特战队/8-AI及视频流媒体对接规范/1-视频流媒体部署标准化-prompt.md @@ -0,0 +1,44 @@ +标题:关于视频流媒体部署标准化的要求说明 + +## 背景 +针对视频流媒体在项目项目交付部署中遇到的实际问题, +1. 存在诸多要求全量k8s部署模式的场景(如湖南二级平台,重庆二级平台,深圳龙华项目等) +2. 视频流媒体部分部署脱离k8s使用独立部署的方式 + 1. 缺失统一监控,统一告警,统一日志,统一管理的能力 + 2. 配置分散且变更频繁,导致交付部署工作量大,且容易出错 + 3. 端口与k8s可能产生冲突,已经造成多次项目事故 + 4. 转发配置复杂,且容易出错 + +## 整改要求 +1. 部署方式标准化:统一采用k8s部署模式 +2. 公网暴露端口的的标准化 + 1. 集群统一采用 30000-40000的nodePort端口范围 + 2. 建议考虑安全风险,尽量不暴露NodePort + 3. 建议采用Ingress中转HTTP API接口,避免NGINX配置 + 4. 建议复用对外统一端口 31935 30080 30554等 +3. 配置标准化 + 1. 固定配置无需暴露(考虑写死) + 2. 需要修改的配置请使用中文注释说明 + 3. 避免使用nacos + 4. 建议环境变量注入方式,并且环境变量优先级高于配置文件,进行配置覆盖即可 +4. 初始化标准化 + 1. 仿照业务平台提供特定版本的数据库初始化脚本 + 2. 视频流媒体与业务平台之间的匹配关系矩阵 +5. 与业务系统的交互方式 + 1. 请说明与飞服平台的交互方式 + 2. 请说明与监管平台的交互方式 + 3. 请说明与AI部分的交互方式 +6. 镜像交付物标准化 + 1. 镜像名称统一采用 三级命名规范 + 视频流媒体 harbor.cdcyy.com.cn/cmii/cmii-live-xxxxx:v1.0.0 + 飞服平台 harbor.cdcyy.com.cn/cmii/cmii-uav-xxxxx:v1.0.0 + 监管平台 harbor.cdcyy.com.cn/cmii/cmii-uas-xxxxx:v1.0.0 + AI平台 harbor.cdcyy.com.cn/cmii/cmii-ai-xxxxx:v1.0.0 + 2. ARM版本镜像统一命名规范为 视频流媒体 harbor.cdcyy.com.cn/cmii/cmii-live-xxxxx:v1.0.0-arm + +## 远景建议 +1. 视频流媒体组件需要设计良好的存活检测探针 +2. 【基础架构-配置中心】基础架构保证后续前端、后端、AI、视频流媒体等所有业务组件的环境信息通过基础组件环境变量注入给Pod +3. 【基础架构-监控中心】暴露mertrics接口,统一接入监控中心 +4. 【基础架构-日志中心】统一接入日志中心 + diff --git a/18-基础架构及交付部署特战队/9-人员分工管理规范/1.1-工作粗项.png b/18-基础架构及交付部署特战队/9-人员分工管理规范/1.1-工作粗项.png deleted file mode 100644 index c0a9d25..0000000 Binary files a/18-基础架构及交付部署特战队/9-人员分工管理规范/1.1-工作粗项.png and /dev/null differ diff --git a/18-基础架构及交付部署特战队/9-人员分工管理规范/1.2-工作细项.png b/18-基础架构及交付部署特战队/9-人员分工管理规范/1.2-工作细项.png deleted file mode 100644 index 607f747..0000000 Binary files a/18-基础架构及交付部署特战队/9-人员分工管理规范/1.2-工作细项.png and /dev/null differ diff --git a/18-基础架构及交付部署特战队/9-人员分工管理规范/2-工作优先级排期.md b/18-基础架构及交付部署特战队/9-人员分工管理规范/2-工作优先级排期.md index e74ead9..61224f1 100644 --- a/18-基础架构及交付部署特战队/9-人员分工管理规范/2-工作优先级排期.md +++ b/18-基础架构及交付部署特战队/9-人员分工管理规范/2-工作优先级排期.md @@ -25,22 +25,97 @@ | **其他工作** | 5% | PMO 组 | 其他工作 | 完成部门临时性、突发性任务(如协助撰写技术材料、临时资源调配等)。 | 100% | ### 核心RMDC平台远景规划 -1. 一键交付物构建:实现从源码到交付包的单界面全自动产出,消除人工打包误差。 -2. 跨网持续更新:具备穿透公网能力,实现全国任意节点的一键微服务升级,响应定制化开发需求。 -3. 全景监控中心:实时监控全国项目运行状态,变“被动救火”为“主动预警”。 -4. 全链路审计:提供“谁提交、谁审批、谁更新”的全生命周期操作记录,确保安全合规。 -5. 部署信息指纹:精细化管理每个项目的配置差异,为定制化开发提供精准的底层数据支撑。 +1. 一键交付物构建:实现从源码到交付包的单界面全自动产出,消除人工打包误差。 +2. 跨网持续更新:具备穿透公网能力,实现全国任意节点的一键微服务升级,响应定制化开发需求。 +3. 全景监控中心:实时监控全国项目运行状态,变“被动救火”为“主动预警”。 +4. 全链路审计:提供“谁提交、谁审批、谁更新”的全生命周期操作记录,确保安全合规。 +5. 部署信息指纹:精细化管理每个项目的配置差异,为定制化开发提供精准的底层数据支撑。 +6. 自动化部署:借助部署流程编排,实现自动化部署。 + +### RMDC-watchdog模块功能介绍 +1. rmdc-project-management是一级授权中心 + 1. 授权所有二级授权中心 + 2. 维护二级授权中心的授权信息 + 3. 该模块之前为 rmdc-watchdog-center + 1. 但是由于功能单一并且与rmdc-project-management功能冲突 + 2. 该模块已被移除,并且功能完全移动至rmdc-project-management中实现 +2. RMDC-watchdog作为项目授权中心(二级授权中心) + 1. 接受来自RMDC-watchdog-node的主机信息,唯一主机信息加密 + 2. 将授权文件上传至rmdc-project-management + 3. 接受来自rmdc-project-management的授权文件,并解析授权信息 + 4. 接受来自RMDC-watchdog-agent的心跳查询是否授权信息 + 5. 向RMDC-watchdog-agent发送已授权信息,避免agent自毁 +3. RMDC-watchdog-agent是嵌入到业务运行的启动器 + 1. 监控业务运行的一切 + 2. 向RMDC-watchdog发送心跳查询是否授权信息 + 3. 若长时间未被授权,则自毁 + 4. 解析RMDC-watchdog的心跳回复,确保不会自毁 + 5. 设计方案类似于 死手系统 +4. RMDC-watchdog-node通常是以二进制systemd的形式运行 + 1. 可以收集每台主机的运行状态信息 + 1. CPU + 2. 内存 + 3. 磁盘 + 4. 网络 + 2. 执行预定义的服务器指令 + 1. 通过RMDC-watchdog的业务编排,实现系统的自动化部署工作 + 3. 可以通过cli的方式运行,用来调用执行预定义的指令 + 1. 手动实现系统的部署工作 + 4. 只能接受来自RMDC-watchdog的调用 + 1. 只暴露有限的、经过审计的操作接口(重启服务、收集日志、健康检查等) + 2. 通过严格认证与授权调用 +5. 授权系统防篡改核心 + 1. TOTP算法防止信息篡改 + 2. 每个项目的二级授权中心密钥均不同 + 3. 每个项目的一级授权中心密钥均不同 + 4. rmdc-project-management和RMDC-watchdog之间交互信息需要加密 + 5. RMDC-watchdog和RMDC-watchdog-agent之间交互信息不需要加密,但是首先需要验证TOTP码 +6. 取消授权 + 1. rmdc-project-management应该可以取消对一个项目的授权 + 2. RMDC-watchdog应该有相应的接口,能够接收取消授权 + 1. 取消特定主机的授权 +7. 授权时间 + 1. rmdc-project-management应该能够设置授权时间 + 2. RMDC-watchdog应该新增授权时间管理功能, + 1. 在解析授权文件中,应该解析授权时间,并设置授权时间 + ### 人员安排 -| 人员 | 角色 | 核心能力 | 职责 | 开发能力 | -| :--- | :--- | :--- | :--- | :--- | -| 我 | 代理组长 | 架构师、项目管理专家、开发专家 | 负责小组的整体工作安排和协调,确保各项任务按时完成。 | 强 | -| 袁 | 核心成员 | 交付部署专家、项目生命周期维护专家、开发能力 | 负责交付部署和项目生命周期维护工作。 | 弱 | -| 冉 | 核心成员 | 研发环境优化专家、项目验收环境专家 | 负责研发环境优化和项目验收环境工作。 | 强 | -| A | 待定人员 | 待定 | 负责院内资源维护和研发工具链维护工作。 | 弱 | -| B | 待定人员 | 待定 | 负责项目安全维护和部署安全合规工作。 | 弱 | +| 人员 | 角色 | 核心能力 | 职责 | 开发能力 | 年龄 | 家庭 | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| 我 | 代理组长 | 架构师、项目管理专家、开发专家 | 负责小组的整体工作安排和协调,确保各项任务按时完成。 | 强 | 30 | 已婚已育 | +| A | 核心成员 | 交付部署专家、项目生命周期维护专家、开发能力 | 负责交付部署和项目生命周期维护工作。 | 弱 | 38 | 已婚已育 | +| B | 成员 | 研发环境优化专家、项目验收环境专家 | 负责研发环境优化和项目验收环境工作。 | 强 | 25 | 未婚 | +| C | 待定人员 | 待定 | 规划为安排交付部署操作、运维工作、院内资源维护和研发工具链维护工作 | 弱 | 未知 | 未知 | +| D | 待定人员 | 待定 | 规划为安排交付部署操作、运维工作、院内资源维护和研发工具链维护工作 | 弱 | 未知 | 未知 | +请注意,A是核心成员,B是年轻的成员,C和D是待定人员,还没有到位 +### 工作材料与背景 +1. 我具备丰富且强大的部署能力 +2. 熟练掌握k8s、Gitea等各类开源工具的安装及部署工作 +3. 熟练掌握大模型的使用,提示词工程,Agent Skills等 +4. 具备出色的技术开发能力,熟练掌握Golang、Java、Python等编程语言,熟练掌握PostgreSQL、MySQL、SQLite3等数据库 +5. 具备出色的项目管理能力,熟练掌握项目管理工具,熟练掌握项目管理流程 +6. 具备出色的团队管理能力,能够带领团队高效工作 + +7. 我已经建立了一套完善的 《交付部署总览表》的多维数据表格 + 1. 与行业组同步项目部署状态信息 + 2. 与交付部署人员同步项目部署信息 + 3. 与研发组同步项目持续交付部署的进度及信息 +8. + ### 已知代办事项 1. 我需要一个能够管理小组日常工作安排和协调的工具,能够记录和跟踪各项任务的进度,包括任务的分配、执行情况、完成情况等的工具,请分析金山多维表格能否满足我的需求,如果不能请推荐其他工具。 -2. \ No newline at end of file +2. 我应该如何建立研发内容的同步机制,如何提供研发要求之类的资料,同步项目研发进度 +3. 我应该有包含二进制文件、配置文件、数据库脚本,需要能够附带版本控制的工具,目前我使用的是cloudreve,请分析是否能够满足我的需求,如果不能请推荐其他工具。 +4. 请帮我完整的分析飞书工具套件具备的能力,飞书客户端对于机器人的支持程度,飞书进行项目管理的能力,飞书二次开发的能力 + + +## 已解决 +2. 小组现在是成立初期阶段,有很多工作流程需要梳理,与其他小组之间的工作界面与规范需要明确,这占据了大量的时间与精力 +3. 我和A现在需要承担大量的交付部署工作,这占据了大量的时间与精力 +4. 前期阶段项目部署的内容过于繁琐,B本身不具备项目交付部署的能力, + 1. 交付部署的核心能力不想被他获取,因此我考虑提供rmdc-watchdog-node作为手动部署工具,将核心能力封装起来,但是rmdc-watchdog-node需要具备TOTP与机器锁定的功能,这部分的开发占据了大量精力与时间 B应该如何快速的上手与工作,应该如何被统筹安排 + 2. 放弃核心机密,此部分的工作交由他来处理,他应该是值得信赖的,不会将我方机密泄露给第三方 + 3. A现在基本不具备开发改造的能力 \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/9-人员分工管理规范/2.1-解决方案.md b/18-基础架构及交付部署特战队/9-人员分工管理规范/2.1-解决方案.md new file mode 100644 index 0000000..c841fd6 --- /dev/null +++ b/18-基础架构及交付部署特战队/9-人员分工管理规范/2.1-解决方案.md @@ -0,0 +1,65 @@ +## 1. 任务管理工具分析:金山多维表格 + +**结论:金山多维表格是目前最适合你且能快速上手的工具。** + +对于你这类具有“强技术背景”的管理者,金山多维表格(或飞书多维表格)的优势在于其**“数据结构化”**能力,完全可以满足你的以下需求: + +* **KPI 直接关联:** 你可以将那张复杂的“考核细项表”直接录入,作为任务分配的基准。 +* **多维度视图:** + * **看板视图:** 跟踪 A、B 的任务状态。 + * **甘特图视图:** 规划 RMDC 各模块(node, agent, management)的开发排期。 + * **架构关系视图:** 记录全国各项目的“部署信息指纹”。 +* **自动化流:** 设定逻辑,当交付工单状态变为“已完成”时,自动触发 B 进行“最简冒烟测试”任务,实现流程闭环。 + +--- + +## 2. 核心技术冲突解决:B 的使用与 RMDC 架构落地 + +这是你目前最纠结的点:**如何让开发能力强但交付能力弱且非核心的 B 产生价值,同时保护核心部署机密?** + +### 解决方案:实施“前后端分离”的交付模式 +不要让 B 直接参与现场交付(避免接触核心机密),而是让 B 成为你 **RMDC 平台的“兵工厂”建设者**。 + +* **B 的工作安排:** 1. **负责 RMDC-watchdog-node 的 CLI 与基础监控开发:** 利用 B 强的开发能力,让他实现 CPU/内存/磁盘监控以及 systemd 运行逻辑。 + 2. **实现“黑盒指令”:** 你定义好部署的逻辑脚本(核心机密),B 负责将这些脚本封装进 `node` 的审计接口中。B 只需要知道“调用接口 A 执行部署”,而不需要知道脚本内部的敏感逻辑。 + 3. **开发 TOTP 逻辑:** 这部分通用算法开发完全可以交给 B,作为他的 KPI。 + +* **你的角色(架构师):** + 1. 你负责核心安全协议(授权中心加密、密钥分发逻辑)的设计和核心代码编写。 + 2. 利用你的 **Agent Skills** 编写自动化生成部署文档的 Prompt,减少文档压力。 + +--- + +## 3. 流程梳理与人力释放策略 + + + +### 策略 A:建立“标准化隔离带” +* **对外:** 强制执行“工单签字制”。项目经理没给《配置信息表》,你和 A 坚决不进场。这能过滤掉 30% 的无效沟通。 +* **对内:** A 负责“守城”,即维护现有生命周期和故障排查。你负责“攻城”,即 RMDC 的架构核心。 + +### 策略 B:C/D 到位后的职能预演 +一旦 C/D 到位,立即将他们推向 **“院内资源维护”和“项目安全合规”**。 +* 这两项在考核中占 15%-25%,且技术要求(漏洞修复、服务器整改)相对标准。 +* 让他们作为 `RMDC-watchdog-node` 的第一批“纯执行用户”,验证工具的易用性。 + +--- + +## 4. 针对代办事项的具体行动建议 + +| 事项 | 建议方案 | 执行人 | +| :--- | :--- | :--- | +| **工具管理** | 在金山多维表格建立“小组任务全生命周期管理系统”。 | 你(搭建框架) | +| **交付减压** | **放弃方案 4.2(全盘交给 B)**。采用方案 4.1:你定义接口规范,让 B 开发 `rmdc-watchdog-node` 的外壳,实现黑盒操作。 | 你(设计)+ B(开发) | +| **核心能力保护** | 核心部署脚本存放在私有 Gitea,通过 `watchdog-node` 以加密二进制形式分发或动态下载执行。 | 你 | +| **A 的安排** | A 的开发弱,不要强行安排开发任务。让 A 负责输出《中移凌云部署说明书》的业务逻辑,你来审定。 | A | + +--- + +## 5. 总结建议 + +作为代理组长,你现在的重点不是“亲自部署项目”,而是**“定义部署的标准”**。 + +1. **利用 B 的手:** 把他当作 RMDC 平台的“打工人”,让他把繁杂的 TOTP、监控逻辑写完。 +2. **利用 A 的眼:** 让他盯着现场交付质量,确保冒烟测试通过。 +3. **留住你的脑:** 专注于 RMDC 的“死手系统”(Agent + Watchdog)的顶层逻辑和安全加密。 \ No newline at end of file diff --git a/18-基础架构及交付部署特战队/9-人员分工管理规范/3-下一步工作计划.md b/18-基础架构及交付部署特战队/9-人员分工管理规范/3-下一步工作计划.md new file mode 100644 index 0000000..1c05c39 --- /dev/null +++ b/18-基础架构及交付部署特战队/9-人员分工管理规范/3-下一步工作计划.md @@ -0,0 +1,6 @@ +# 研发组对接工作-2026年3月18日 + +## 部署资源来源规范 +## 数据库SQL整理规范 +## 交付部署配置信息表 +## 交付部署时效承诺表 \ No newline at end of file diff --git a/19-CMII快文规范/中国移动快文prompt.md b/19-CMII快文规范/中国移动快文prompt-no.md similarity index 100% rename from 19-CMII快文规范/中国移动快文prompt.md rename to 19-CMII快文规范/中国移动快文prompt-no.md diff --git a/19-CMII快文规范/快文prompt.md b/19-CMII快文规范/快文prompt.md index 8526b39..53eb77c 100644 --- a/19-CMII快文规范/快文prompt.md +++ b/19-CMII快文规范/快文prompt.md @@ -8,7 +8,7 @@ - 发文人身份:交付部署特战队 代理组长 - 发文人姓名:{你的姓名} -- 所在部门:中移凌云(中移(成都)信息通信科技有限公司) +- 所在部门: - 小组规模:4人(含组长) - 小组职责: 1. 负责中移凌云各平台(飞行服务平台、监管平台、AI及视频流媒体平台等)的本地化交付部署工作 diff --git a/20-物理服务器虚拟机/1-2026年3月25日-安装.md b/20-物理服务器虚拟机/1-2026年3月25日-安装.md new file mode 100644 index 0000000..28ccee0 --- /dev/null +++ b/20-物理服务器虚拟机/1-2026年3月25日-安装.md @@ -0,0 +1,271 @@ +关键发现:`collectd` 不在 EPEL,而在 **CentOS Stream 9 OpsTools SIG** 仓库中 。oVirt 完整安装需要 **10+ 个 CentOS SIG 仓库**,以下给出从头开始的完整操作。 [computingforgeeks](https://computingforgeeks.com/how-to-install-ovirt-engine-on-centos-stream/) + +*** + +## 第一步:修复 OpenEuler dnf 兼容性 + +```bash +# 解决 "Detection of Platform Module failed" 问题 +echo "module_platform_id=platform:el9" >> /etc/dnf/dnf.conf + +# 验证 +grep module_platform_id /etc/dnf/dnf.conf +``` + +*** + +## 第二步:清理之前添加的错误仓库 + +```bash +# 删除上次添加的错误仓库 +rm -f /etc/yum.repos.d/ovirt-master.repo +rm -f /etc/yum.repos.d/ovirt-4.5.repo +rm -f /etc/yum.repos.d/epel9-manual.repo + +dnf clean all +``` + +*** + +## 第三步:添加全套依赖仓库(全部使用国内镜像) + +```bash + +# 直接覆盖写入正确的 SIG 仓库文件 +cat > /etc/yum.repos.d/centos9-stream-sigs.repo << 'EOF' +[c9s-ovirt45] +name=CentOS Stream 9 - oVirt 4.5 SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/virt/x86_64/ovirt-45/ +enabled=1 +gpgcheck=0 + +[c9s-opstools] +name=CentOS Stream 9 - OpsTools SIG (collectd) +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/opstools/x86_64/collectd-5/ +enabled=1 +gpgcheck=0 + +[c9s-openstack-yoga] +name=CentOS Stream 9 - OpenStack Yoga SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/cloud/x86_64/openstack-yoga/ +enabled=1 +gpgcheck=0 + +[c9s-rabbitmq] +name=CentOS Stream 9 - RabbitMQ 38 SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/messaging/x86_64/rabbitmq-38/ +enabled=1 +gpgcheck=0 + +[c9s-nfv-openvswitch] +name=CentOS Stream 9 - NFV OpenvSwitch SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9/nfv/x86_64/openvswitch-common/ +enabled=1 +gpgcheck=0 + +[c9s-ceph-pacific] +name=CentOS Stream 9 - Ceph Pacific SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/storage/x86_64/ceph-pacific/ +enabled=1 +gpgcheck=0 + +[c9s-gluster10] +name=CentOS Stream 9 - Gluster 10 SIG +baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/storage/x86_64/gluster-10/ +enabled=1 +gpgcheck=0 + +[c9s-extras] +name=CentOS Stream 9 - Extras +baseurl=https://mirrors.aliyun.com/centos-stream/SIGs/9-stream/extras/x86_64/extras-common/ +enabled=1 +gpgcheck=0 +EOF + +# 一次性写入所有必需仓库文件 +cat > /etc/yum.repos.d/centos9-stream-base.repo << 'EOF' +[c9s-baseos] +name=CentOS Stream 9 - BaseOS +baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/ +enabled=1 +gpgcheck=0 + +[c9s-appstream] +name=CentOS Stream 9 - AppStream +baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/x86_64/os/ +enabled=1 +gpgcheck=0 + +[c9s-crb] +name=CentOS Stream 9 - CRB +baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/CRB/x86_64/os/ +enabled=1 +gpgcheck=0 +EOF + +cat > /etc/yum.repos.d/epel9.repo << 'EOF' +[epel9] +name=EPEL 9 - x86_64 (Aliyun Mirror) +baseurl=https://mirrors.aliyun.com/epel/9/Everything/x86_64/ +enabled=1 +gpgcheck=0 +priority=99 +EOF + +cat > /etc/yum.repos.d/ovirt-4.5-upstream.repo << 'EOF' +[ovirt-4.5] +name=oVirt 4.5 Upstream +baseurl=https://resources.ovirt.org/pub/ovirt-4.5/rpm/el9/ +enabled=1 +gpgcheck=0 +EOF +``` + +*** + +## 第四步:验证仓库并更新缓存 + +```bash +dnf clean all && dnf makecache + +# 验证关键包可以被找到 +dnf info collectd | grep -E "Name|Version|Repo" +dnf info python3-os-brick | grep -E "Name|Version|Repo" +dnf info ovirt-engine | grep -E "Name|Version|Repo" +``` + +预期输出示例: +``` +Name : collectd +Version : 5.12.0 +Repository : c9s-opstools + +Name : ovirt-engine +Version : 4.5.7 +Repository : ovirt-4.5 +``` + +*** + +## 第五步:安装 oVirt Engine + +```bash +# 安装 oVirt Engine(忽略 OpenEuler 与 RHEL 的轻微包名差异) +dnf install -y ovirt-engine \ + --setopt=module_platform_id=platform:el9 \ + --allowerasing + +# 安装过程中如有提示 "is it ok [y/N]" 类问题,输入 y 确认 +``` + +> 安装过程约下载 **500MB~1GB** 的包,根据网速需要 5-15 分钟。 + +*** + +## 第六步:配置主机名(FQDN 必须可解析) + +```bash +# 设置 FQDN +hostnamectl set-hostname ovirt.local.lan + +# 添加本地解析 +echo "192.168.11.14 ovirt.local.lan ovirt" >> /etc/hosts + +# 验证(必须返回 FQDN,不能是 localhost) +hostname -f +ping -c 2 $(hostname -f) +``` + +*** + +## 第七步:运行配置向导 + +```bash +engine-setup +``` + +**交互配置参考(直接回车使用默认值即可):** + +``` +Configure Engine on this host (Yes, No) [Yes]: ↵ 回车 +Configure Image I/O Proxy on this engine (Yes, No) [Yes]: ↵ 回车 +Configure WebSocket Proxy on this machine (Yes, No) [Yes]: ↵ 回车 +Configure Data Warehouse on this engine (Yes, No) [Yes]: ↵ 回车 +Application mode (both, virt, gluster) [both]: ↵ 回车 +Default SHE Storage Domain type (glusterfs, nfs) [nfs]: ↵ 回车 + +Engine database host [localhost]: ↵ 回车 +Engine database port [5432]: ↵ 回车 +Engine database name [engine]: ↵ 回车 +Engine database user [engine]: ↵ 回车 +Engine database password: 输入密码 +oVirt Engine FQDN [ovirt.local.lan]: ↵ 回车 + +Use default credentials (admin@internal) [Yes]: ↵ 回车 +Engine admin password: 输入Web登录密码 + +Firewall manager to configure (iptables, firewalld) [firewalld]: ↵ 回车 + +Confirm installation settings [OK]: ↵ 回车 +``` + +成功后输出: +``` +--== SUMMARY ==-- +Web access is enabled at: + https://ovirt.local.lan/ovirt-engine + http://ovirt.local.lan/ovirt-engine +Please use "admin" user to login +``` + +*** + +## 第八步:安装 VDSM(宿主节点代理) + +```bash +dnf install -y ovirt-host \ + --setopt=module_platform_id=platform:el9 \ + --allowerasing + +systemctl enable --now vdsmd supervdsmd + +# 验证 +systemctl status vdsmd | grep -E "Active|Main" +``` + +*** + +## 第九步:登录 Web Portal 添加宿主机 + +浏览器访问 `https://192.168.11.14/ovirt-engine`,用户名 `admin`,密码为 `engine-setup` 中设置的密码。 + +``` +计算 → 主机 → 新建 + 名称: node-openeuler + 主机名: 192.168.11.14 + SSH端口: 22 + 认证方式: 密码(填 root 密码) + → 确定 + +# 等待约 3-5 分钟,状态变为「已开机」即成功 +``` + +*** + +## 第十步:安装完成后清理临时仓库 + +```bash +# 保留 ovirt-4.5-upstream(后续升级用),删除临时的 CentOS 依赖仓库 +rm -f /etc/yum.repos.d/centos9-stream-base.repo +rm -f /etc/yum.repos.d/centos9-stream-sigs.repo +rm -f /etc/yum.repos.d/epel9.repo + +# 仅保留: +ls /etc/yum.repos.d/ +# openEuler 原始仓库(不动) +# ovirt-4.5-upstream.repo(保留,用于 oVirt 后续更新) + +dnf clean all +``` + +> **说明**:清理仓库后已安装的包不受影响,仅禁止后续从这些源拉取新包,符合"安装完成后去除"的要求。 \ No newline at end of file diff --git a/20-物理服务器虚拟机/1-2026年4月15日-管理方案/init-ip-change.ps1 b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/init-ip-change.ps1 new file mode 100644 index 0000000..c8f898c --- /dev/null +++ b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/init-ip-change.ps1 @@ -0,0 +1,151 @@ +# ================================ +# Windows 主机名 / IP 配置脚本 +# 使用方法: +# 1. 先修改下面的配置区 +# 2. 用管理员权限运行 PowerShell +# 3. 执行本脚本 +# 4. 执行完成后重启系统 +# ================================ + +# ===== 配置区开始 ===== +$NewComputerName = "ws2022-192-168-11-160" +$IPAddress = "192.168.11.160" +$PrefixLength = 24 +$Gateway = "192.168.11.1" +$DnsServers = @("192.168.34.40","223.5.5.5") +# 如需指定网卡名,可填写,例如 "以太网" +# 留空则自动选择当前状态为 Up 的第一块物理/虚拟以太网卡 +$PreferredAdapterName = "" +# ===== 配置区结束 ===== + +$ErrorActionPreference = "Stop" + +function Write-Info($msg) { + Write-Host "[INFO] $msg" -ForegroundColor Cyan +} + +function Write-Ok($msg) { + Write-Host "[ OK ] $msg" -ForegroundColor Green +} + +function Write-WarnMsg($msg) { + Write-Host "[WARN] $msg" -ForegroundColor Yellow +} + +function Write-Fail($msg) { + Write-Host "[FAIL] $msg" -ForegroundColor Red +} + +try { + Write-Info "开始执行主机名与网络配置" + + # 1. 检查管理员权限 + $currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent() + $principal = New-Object Security.Principal.WindowsPrincipal($currentIdentity) + $isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + if (-not $isAdmin) { + throw "请使用管理员权限运行 PowerShell" + } + Write-Ok "管理员权限检查通过" + + # 2. 校验 IP + [void][System.Net.IPAddress]::Parse($IPAddress) + [void][System.Net.IPAddress]::Parse($Gateway) + foreach ($dns in $DnsServers) { + [void][System.Net.IPAddress]::Parse($dns) + } + if ($PrefixLength -lt 0 -or $PrefixLength -gt 32) { + throw "PrefixLength 必须在 0 到 32 之间" + } + Write-Ok "IP 参数校验通过" + + # 3. 选择网卡 + if ($PreferredAdapterName -and $PreferredAdapterName.Trim() -ne "") { + $nic = Get-NetAdapter -Name $PreferredAdapterName -ErrorAction Stop + } + else { + $nic = Get-NetAdapter | + Where-Object { + $_.Status -eq "Up" -and + $_.InterfaceDescription -notmatch "Bluetooth|Wireless|Wi-Fi|VPN" -and + $_.Name -notmatch "Bluetooth|无线|Wi-Fi|VPN" + } | + Sort-Object InterfaceMetric, ifIndex | + Select-Object -First 1 + } + + if (-not $nic) { + throw "未找到可用网卡,请手工指定 `$PreferredAdapterName" + } + + Write-Info "选中的网卡: Name=$($nic.Name), ifIndex=$($nic.ifIndex), Status=$($nic.Status)" + Write-Ok "网卡选择完成" + + # 4. 删除旧 IPv4 地址 + $oldIPs = Get-NetIPAddress -InterfaceIndex $nic.ifIndex -AddressFamily IPv4 -ErrorAction SilentlyContinue | + Where-Object { $_.IPAddress -ne "127.0.0.1" } + + foreach ($item in $oldIPs) { + Write-Info "删除旧 IP: $($item.IPAddress)" + Remove-NetIPAddress ` + -InterfaceIndex $nic.ifIndex ` + -IPAddress $item.IPAddress ` + -Confirm:$false ` + -ErrorAction SilentlyContinue + } + + # 5. 删除旧默认路由 + $oldRoutes = Get-NetRoute -InterfaceIndex $nic.ifIndex -AddressFamily IPv4 -DestinationPrefix "0.0.0.0/0" -ErrorAction SilentlyContinue + foreach ($route in $oldRoutes) { + Write-Info "删除旧默认路由: NextHop=$($route.NextHop)" + Remove-NetRoute ` + -InterfaceIndex $nic.ifIndex ` + -DestinationPrefix "0.0.0.0/0" ` + -NextHop $route.NextHop ` + -Confirm:$false ` + -ErrorAction SilentlyContinue + } + + Write-Ok "旧 IP 和默认路由清理完成" + + # 6. 配置新 IP / 网关 + Write-Info "写入新 IP: $IPAddress/$PrefixLength, Gateway=$Gateway" + New-NetIPAddress ` + -InterfaceIndex $nic.ifIndex ` + -IPAddress $IPAddress ` + -PrefixLength $PrefixLength ` + -DefaultGateway $Gateway ` + -AddressFamily IPv4 ` + -ErrorAction Stop | Out-Null + + Write-Ok "静态 IP 配置完成" + + # 7. 配置 DNS + Write-Info "写入 DNS: $($DnsServers -join ', ')" + Set-DnsClientServerAddress ` + -InterfaceIndex $nic.ifIndex ` + -ServerAddresses $DnsServers ` + -ErrorAction Stop + + Write-Ok "DNS 配置完成" + + # 8. 修改主机名 + if ($env:COMPUTERNAME -ne $NewComputerName) { + Write-Info "当前主机名: $env:COMPUTERNAME" + Write-Info "目标主机名: $NewComputerName" + Rename-Computer -NewName $NewComputerName -Force -ErrorAction Stop + Write-Ok "主机名修改完成,重启后生效" + } + else { + Write-WarnMsg "主机名已经是目标值,无需修改" + } + + Write-Host "" + Write-Ok "全部配置已完成" + Write-Host "请执行以下命令重启系统使主机名完全生效:" -ForegroundColor Yellow + Write-Host "Restart-Computer" -ForegroundColor Green +} +catch { + Write-Fail $_.Exception.Message + exit 1 +} \ No newline at end of file diff --git a/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager.py b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager.py new file mode 100644 index 0000000..a4e377d --- /dev/null +++ b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager.py @@ -0,0 +1,773 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import argparse +import ipaddress +import json +import os +import secrets +import shutil +import subprocess +import sys +import tempfile +import uuid +from dataclasses import dataclass +from pathlib import Path +from typing import Dict, List, Optional, Tuple +import xml.etree.ElementTree as ET + + +DEFAULT_SYS_DIR = "/vm/sys" +DEFAULT_DATA_DIR = "/vm/data" +DEFAULT_SYS_POOL = "vm-sys" +DEFAULT_DATA_POOL = "vm-data" +DEFAULT_BRIDGE = "br0" +DEFAULT_GATEWAY = "192.168.11.1" +DEFAULT_PREFIX = 24 +DEFAULT_DNS = ["223.5.5.5", "114.114.114.114"] +DEFAULT_NVRAM_DIR = "/var/lib/libvirt/qemu/nvram" + + +class CommandError(RuntimeError): + pass + + +@dataclass +class DiskInfo: + xml_elem: ET.Element + device: str + source_path: Optional[str] + target_dev: Optional[str] + target_bus: Optional[str] + driver_type: Optional[str] + + +@dataclass +class InterfaceInfo: + xml_elem: ET.Element + mac: Optional[str] + bridge: Optional[str] + model: Optional[str] + + +@dataclass +class ClonePlan: + name: str + hostname: str + ip: Optional[str] + prefix: Optional[int] + gateway: Optional[str] + dns: List[str] + template: str + guest_type: str + vcpus: Optional[int] + memory_mb: Optional[int] + bridge: str + sys_dir: str + data_dir: str + sys_pool: str + data_pool: str + data_size: Optional[str] + autostart: bool + + +def run(cmd: List[str], check: bool = True, capture_output: bool = True, text: bool = True) -> subprocess.CompletedProcess: + proc = subprocess.run(cmd, check=False, capture_output=capture_output, text=text) + if check and proc.returncode != 0: + raise CommandError( + f"命令执行失败: {' '.join(cmd)}\n退出码: {proc.returncode}\nSTDOUT:\n{proc.stdout}\nSTDERR:\n{proc.stderr}" + ) + return proc + + +def require_cmd(name: str) -> None: + if shutil.which(name) is None: + raise CommandError(f"缺少命令: {name}") + + +def first_existing_cmd(candidates: List[str]) -> str: + for name in candidates: + path = shutil.which(name) + if path: + return path + raise CommandError(f"缺少可用命令,候选: {', '.join(candidates)}") + + +def validate_ip(ip_str: str) -> str: + return str(ipaddress.ip_address(ip_str)) + + +def validate_prefix(prefix: int) -> int: + if prefix < 0 or prefix > 32: + raise ValueError("prefix 必须在 0~32 之间") + return prefix + + +def normalize_dns(dns_value: str) -> List[str]: + if not dns_value: + return [] + items = [x.strip() for x in dns_value.split(",") if x.strip()] + return [validate_ip(x) for x in items] + + +def ensure_dir(path: str) -> None: + Path(path).mkdir(parents=True, exist_ok=True) + + +def random_mac() -> str: + suffix = [secrets.randbelow(256) for _ in range(3)] + return "52:54:00:%02x:%02x:%02x" % tuple(suffix) + + +def safe_hostname(name: str) -> str: + value = name.strip().lower().replace("_", "-") + value = value.replace(".", "-") + if len(value) > 63: + value = value[:63] + return value.strip("-") + + +def default_name(prefix: str, ip: str) -> str: + return f"{prefix}-{ip.replace('.', '-')}" + + +def vm_exists(name: str) -> bool: + proc = run(["virsh", "dominfo", name], check=False) + return proc.returncode == 0 + + +def pool_refresh(pool: str) -> None: + run(["virsh", "pool-refresh", pool], check=False) + + +def prefix_to_netmask(prefix: int) -> str: + network = ipaddress.IPv4Network(f"0.0.0.0/{prefix}") + return str(network.netmask) + + +def dumpxml(domain: str, inactive: bool = True) -> ET.ElementTree: + cmd = ["virsh", "dumpxml", domain] + if inactive: + cmd.insert(2, "--inactive") + xml_text = run(cmd).stdout + return ET.ElementTree(ET.fromstring(xml_text)) + + +def get_domain_disks(root: ET.Element) -> List[DiskInfo]: + result: List[DiskInfo] = [] + for disk in root.findall("./devices/disk"): + device = disk.get("device", "disk") + source = disk.find("source") + target = disk.find("target") + driver = disk.find("driver") + source_path = None + if source is not None: + source_path = source.get("file") or source.get("dev") or source.get("name") + result.append( + DiskInfo( + xml_elem=disk, + device=device, + source_path=source_path, + target_dev=target.get("dev") if target is not None else None, + target_bus=target.get("bus") if target is not None else None, + driver_type=driver.get("type") if driver is not None else None, + ) + ) + return result + + +def pick_system_disk(disks: List[DiskInfo], sys_dir: str) -> DiskInfo: + file_disks = [d for d in disks if d.device == "disk" and d.source_path] + if not file_disks: + raise CommandError("模板虚拟机未找到可用系统盘") + + for d in file_disks: + if d.source_path and os.path.abspath(d.source_path).startswith(os.path.abspath(sys_dir) + os.sep): + return d + return file_disks[0] + + +def get_domain_interface(root: ET.Element) -> InterfaceInfo: + iface = root.find("./devices/interface[@type='bridge']") + if iface is None: + iface = root.find("./devices/interface") + if iface is None: + raise CommandError("模板虚拟机未找到网卡配置") + mac_elem = iface.find("mac") + source_elem = iface.find("source") + model_elem = iface.find("model") + return InterfaceInfo( + xml_elem=iface, + mac=mac_elem.get("address") if mac_elem is not None else None, + bridge=source_elem.get("bridge") if source_elem is not None else None, + model=model_elem.get("type") if model_elem is not None else None, + ) + + +def set_domain_identity(root: ET.Element, name: str) -> None: + name_elem = root.find("name") + if name_elem is None: + name_elem = ET.SubElement(root, "name") + name_elem.text = name + + uuid_elem = root.find("uuid") + if uuid_elem is None: + uuid_elem = ET.SubElement(root, "uuid") + uuid_elem.text = str(uuid.uuid4()) + + for tag in ["id", "title", "description"]: + elem = root.find(tag) + if elem is not None and tag == "id": + root.remove(elem) + + +def set_domain_resources(root: ET.Element, memory_mb: Optional[int], vcpus: Optional[int]) -> None: + if memory_mb: + memory_kib = str(memory_mb * 1024) + memory_elem = root.find("memory") + if memory_elem is None: + memory_elem = ET.SubElement(root, "memory", {"unit": "KiB"}) + else: + memory_elem.set("unit", "KiB") + memory_elem.text = memory_kib + + current_elem = root.find("currentMemory") + if current_elem is None: + current_elem = ET.SubElement(root, "currentMemory", {"unit": "KiB"}) + else: + current_elem.set("unit", "KiB") + current_elem.text = memory_kib + + if vcpus: + vcpu_elem = root.find("vcpu") + if vcpu_elem is None: + vcpu_elem = ET.SubElement(root, "vcpu") + vcpu_elem.text = str(vcpus) + + +def next_disk_target(existing_targets: List[str], bus: str) -> str: + if bus == "virtio": + prefix = "vd" + elif bus in ("sata", "scsi"): + prefix = "sd" + else: + prefix = "vd" + + for letter_ord in range(ord("b"), ord("z") + 1): + cand = f"{prefix}{chr(letter_ord)}" + if cand not in existing_targets: + return cand + raise CommandError("没有可用的数据盘 target 名称") + + +def clone_nvram_if_needed(root: ET.Element, vm_name: str, nvram_dir: str = DEFAULT_NVRAM_DIR) -> None: + nvram_elem = root.find("./os/nvram") + if nvram_elem is None: + return + + src_path = (nvram_elem.text or "").strip() + if not src_path: + return + + ensure_dir(nvram_dir) + dst_path = os.path.join(nvram_dir, f"{vm_name}_VARS.fd") + shutil.copy2(src_path, dst_path) + nvram_elem.text = dst_path + + +def remove_nonessential_disks(root: ET.Element, keep_disk: DiskInfo) -> None: + devices = root.find("devices") + if devices is None: + raise CommandError("XML 中缺少 devices 节点") + + for disk in list(devices.findall("disk")): + if disk is keep_disk.xml_elem: + continue + devices.remove(disk) + + +def sanitize_virtio_disk_addresses(root: ET.Element) -> None: + for disk in root.findall("./devices/disk[@device='disk']"): + target = disk.find("target") + if target is not None and target.get("bus") == "virtio": + addr = disk.find("address") + if addr is not None and addr.get("type") == "drive": + disk.remove(addr) + + +def update_system_disk_source(os_disk: DiskInfo, new_path: str) -> None: + source_elem = os_disk.xml_elem.find("source") + if source_elem is None: + raise CommandError("系统盘 disk 节点缺少 source") + for attr in ["file", "dev", "name"]: + if source_elem.get(attr) is not None: + source_elem.set(attr, new_path) + for other in ["file", "dev", "name"]: + if other != attr and source_elem.get(other) is not None: + del source_elem.attrib[other] + return + source_elem.set("file", new_path) + + +def add_data_disk(root: ET.Element, data_path: str, bus: str = "virtio", driver_type: str = "qcow2") -> None: + devices = root.find("devices") + if devices is None: + raise CommandError("XML 中缺少 devices 节点") + + existing_targets: List[str] = [] + for disk in root.findall("./devices/disk"): + target = disk.find("target") + if target is not None and target.get("dev"): + existing_targets.append(target.get("dev")) + + target_dev = next_disk_target(existing_targets, bus) + + disk_elem = ET.SubElement(devices, "disk", {"type": "file", "device": "disk"}) + ET.SubElement(disk_elem, "driver", {"name": "qemu", "type": driver_type}) + ET.SubElement(disk_elem, "source", {"file": data_path}) + ET.SubElement(disk_elem, "target", {"dev": target_dev, "bus": bus}) + + if bus in ("sata", "ide", "scsi"): + ET.SubElement(disk_elem, "address", { + "type": "drive", + "controller": "0", + "bus": "0", + "target": "0", + "unit": str(len(existing_targets) + 1), + }) + + +def add_cdrom_iso(root: ET.Element, iso_path: str, bus: str = "sata") -> None: + devices = root.find("devices") + if devices is None: + raise CommandError("XML 中缺少 devices 节点") + + existing: List[str] = [] + for disk in root.findall("./devices/disk"): + target = disk.find("target") + if target is not None and target.get("dev"): + existing.append(target.get("dev")) + + if bus == "sata": + prefix = "sd" + base = "c" + else: + prefix = "hd" + base = "c" + + target_dev = f"{prefix}{base}" + idx = ord(base) + while target_dev in existing: + idx += 1 + target_dev = f"{prefix}{chr(idx)}" + + disk_elem = ET.SubElement(devices, "disk", {"type": "file", "device": "cdrom"}) + ET.SubElement(disk_elem, "driver", {"name": "qemu", "type": "raw"}) + ET.SubElement(disk_elem, "source", {"file": iso_path}) + ET.SubElement(disk_elem, "target", {"dev": target_dev, "bus": bus}) + ET.SubElement(disk_elem, "readonly") + + +def update_network(root: ET.Element, bridge: str, mac_addr: str) -> None: + iface = get_domain_interface(root).xml_elem + source_elem = iface.find("source") + if source_elem is None: + source_elem = ET.SubElement(iface, "source") + for attr in list(source_elem.attrib.keys()): + del source_elem.attrib[attr] + source_elem.set("bridge", bridge) + + mac_elem = iface.find("mac") + if mac_elem is None: + mac_elem = ET.SubElement(iface, "mac") + mac_elem.set("address", mac_addr) + + +def write_domain_xml(root: ET.Element, path: str) -> None: + xml_bytes = ET.tostring(root, encoding="utf-8") + with open(path, "wb") as f: + f.write(xml_bytes) + + +def qemu_img_clone(src: str, dst: str) -> None: + ensure_dir(str(Path(dst).parent)) + run(["qemu-img", "convert", "-p", "-f", "qcow2", "-O", "qcow2", src, dst]) + + +def qemu_img_create(dst: str, size: str) -> None: + ensure_dir(str(Path(dst).parent)) + run(["qemu-img", "create", "-f", "qcow2", dst, size]) + + +def build_iso_from_dir(src_dir: str, out_iso: str, volid: str) -> None: + ensure_dir(str(Path(out_iso).parent)) + iso_cmd = first_existing_cmd(["genisoimage", "mkisofs", "xorrisofs"]) + cmd_name = os.path.basename(iso_cmd) + + if "xorrisofs" in cmd_name: + cmd = [iso_cmd, "-as", "mkisofs", "-output", out_iso, "-volid", volid, "-joliet", "-rock", src_dir] + else: + cmd = [iso_cmd, "-output", out_iso, "-volid", volid, "-joliet", "-rock", src_dir] + run(cmd) + + +def render_linux_user_data(hostname: str) -> str: + return f"""#cloud-config +preserve_hostname: false +hostname: {hostname} +fqdn: {hostname} +manage_etc_hosts: true +""" + + +def render_linux_meta_data(hostname: str, instance_id: str) -> str: + return f"instance-id: {instance_id}\nlocal-hostname: {hostname}\n" + + +def render_linux_network_config_v1(mac_addr: str, ip: str, prefix: int, gateway: str, dns: List[str]) -> str: + netmask = prefix_to_netmask(prefix) + dns_lines = "\n".join([f" - {item}" for item in dns]) if dns else "" + return f"""version: 1 +config: + - type: physical + name: eth0 + mac_address: "{mac_addr.lower()}" + subnets: + - type: static + address: {ip} + netmask: {netmask} + gateway: {gateway} + dns_nameservers: +{dns_lines if dns_lines else ' []'} +""" + + +def create_linux_seed_iso(work_dir: str, vm_name: str, hostname: str, mac_addr: str, ip: str, prefix: int, gateway: str, dns: List[str], sys_dir: str) -> str: + seed_dir = os.path.join(work_dir, "seed-linux") + ensure_dir(seed_dir) + + with open(os.path.join(seed_dir, "user-data"), "w", encoding="utf-8") as f: + f.write(render_linux_user_data(hostname)) + with open(os.path.join(seed_dir, "meta-data"), "w", encoding="utf-8") as f: + f.write(render_linux_meta_data(hostname, str(uuid.uuid4()))) + with open(os.path.join(seed_dir, "network-config"), "w", encoding="utf-8") as f: + f.write(render_linux_network_config_v1(mac_addr, ip, prefix, gateway, dns)) + + iso_path = os.path.join(sys_dir, f"{vm_name}-seed.iso") + build_iso_from_dir(seed_dir, iso_path, "cidata") + return iso_path + + +def virsh_list_all_names() -> List[str]: + out = run(["virsh", "list", "--all", "--name"]).stdout + return [line.strip() for line in out.splitlines() if line.strip()] + + +def dom_state(name: str) -> str: + out = run(["virsh", "domstate", name], check=False) + return out.stdout.strip() if out.returncode == 0 else "unknown" + + +def domifaddr(name: str) -> List[Tuple[str, str, str, str]]: + for source in ["agent", "lease", "arp"]: + proc = run(["virsh", "domifaddr", name, "--source", source, "--full"], check=False) + if proc.returncode != 0: + continue + lines = [ln.rstrip() for ln in proc.stdout.splitlines() if ln.strip()] + if len(lines) < 3: + continue + rows = [] + for line in lines[2:]: + parts = line.split() + if len(parts) >= 4: + iface, mac, proto, addr = parts[:4] + rows.append((iface, mac, proto, addr)) + if rows: + return rows + return [] + + +def map_vm_disks(name: str) -> List[Dict[str, str]]: + tree = dumpxml(name, inactive=True) + root = tree.getroot() + disks = get_domain_disks(root) + rows = [] + for d in disks: + if d.device != "disk": + continue + role = "unknown" + if d.source_path: + abs_path = os.path.abspath(d.source_path) + if abs_path.startswith(os.path.abspath(DEFAULT_SYS_DIR) + os.sep): + role = "system" + elif abs_path.startswith(os.path.abspath(DEFAULT_DATA_DIR) + os.sep): + role = "data" + rows.append({ + "vm": name, + "target": d.target_dev or "-", + "bus": d.target_bus or "-", + "role": role, + "path": d.source_path or "-", + }) + return rows + + +def prepare_clone_plan(args: argparse.Namespace, guest_type: str) -> ClonePlan: + ip = validate_ip(args.ip) if getattr(args, "ip", None) else None + prefix = validate_prefix(args.prefix) if getattr(args, "prefix", None) is not None else None + gateway = validate_ip(args.gateway) if getattr(args, "gateway", None) else None + dns = normalize_dns(args.dns) if getattr(args, "dns", None) else list(DEFAULT_DNS) + + if guest_type in ("linux", "windows") and not ip: + raise CommandError(f"{guest_type} 克隆必须提供 --ip") + if guest_type in ("linux", "windows") and prefix is None: + raise CommandError(f"{guest_type} 克隆必须提供 --prefix") + if guest_type in ("linux", "windows") and not gateway: + raise CommandError(f"{guest_type} 克隆必须提供 --gateway") + + name = args.name or default_name(args.name_prefix, ip) + hostname = args.hostname or safe_hostname(name) + + data_size = (args.data_size or "").strip() or None + + return ClonePlan( + name=name, + hostname=hostname, + ip=ip, + prefix=prefix, + gateway=gateway, + dns=dns, + template=args.template, + guest_type=guest_type, + vcpus=args.vcpus, + memory_mb=args.memory, + bridge=args.bridge, + sys_dir=args.sys_dir, + data_dir=args.data_dir, + sys_pool=args.sys_pool, + data_pool=args.data_pool, + data_size=data_size, + autostart=args.autostart, + ) + + +def clone_vm(plan: ClonePlan) -> Dict[str, str]: + require_cmd("virsh") + require_cmd("qemu-img") + if plan.guest_type == "linux": + first_existing_cmd(["genisoimage", "mkisofs", "xorrisofs"]) + + if vm_exists(plan.name): + raise CommandError(f"目标虚拟机已存在: {plan.name}") + + ensure_dir(plan.sys_dir) + ensure_dir(plan.data_dir) + + tree = dumpxml(plan.template, inactive=True) + root = tree.getroot() + + disks = get_domain_disks(root) + os_disk = pick_system_disk(disks, plan.sys_dir) + if not os_disk.source_path: + raise CommandError("无法识别模板系统盘路径") + + mac_addr = random_mac() + + sys_disk_path = os.path.join(plan.sys_dir, f"{plan.name}.qcow2") + data_disk_path = os.path.join(plan.data_dir, f"{plan.name}-data.qcow2") if plan.data_size else "" + + qemu_img_clone(os_disk.source_path, sys_disk_path) + if plan.data_size: + qemu_img_create(data_disk_path, plan.data_size) + + seed_iso = "" + if plan.guest_type == "linux": + with tempfile.TemporaryDirectory(prefix=f"vmclone-{plan.name}-") as work_dir: + seed_iso = create_linux_seed_iso( + work_dir=work_dir, + vm_name=plan.name, + hostname=plan.hostname, + mac_addr=mac_addr, + ip=plan.ip or "", + prefix=plan.prefix or DEFAULT_PREFIX, + gateway=plan.gateway or DEFAULT_GATEWAY, + dns=plan.dns, + sys_dir=plan.sys_dir, + ) + elif plan.guest_type == "windows": + seed_iso = "" + else: + raise CommandError(f"不支持的 guest_type: {plan.guest_type}") + + set_domain_identity(root, plan.name) + set_domain_resources(root, plan.memory_mb, plan.vcpus) + clone_nvram_if_needed(root, plan.name) + remove_nonessential_disks(root, os_disk) + update_system_disk_source(os_disk, sys_disk_path) + update_network(root, plan.bridge, mac_addr) + sanitize_virtio_disk_addresses(root) + + if plan.data_size: + add_data_disk(root, data_disk_path, bus="virtio", driver_type="qcow2") + if seed_iso: + add_cdrom_iso(root, seed_iso, bus="sata") + + with tempfile.NamedTemporaryFile(prefix=f"{plan.name}-", suffix=".xml", delete=False) as tmp: + tmp_path = tmp.name + try: + write_domain_xml(root, tmp_path) + run(["virsh", "define", tmp_path]) + if plan.autostart: + run(["virsh", "autostart", plan.name]) + run(["virsh", "start", plan.name]) + finally: + try: + os.unlink(tmp_path) + except FileNotFoundError: + pass + + pool_refresh(plan.sys_pool) + pool_refresh(plan.data_pool) + + return { + "name": plan.name, + "hostname": plan.hostname, + "ip": plan.ip or "", + "mac": mac_addr, + "system_disk": sys_disk_path, + "data_disk": data_disk_path, + "seed_iso": seed_iso, + "bridge": plan.bridge, + } + + +def print_json(data) -> None: + print(json.dumps(data, ensure_ascii=False, indent=2)) + + +def cmd_clone_linux(args: argparse.Namespace) -> None: + plan = prepare_clone_plan(args, "linux") + result = clone_vm(plan) + print_json(result) + + +def cmd_clone_windows(args: argparse.Namespace) -> None: + plan = prepare_clone_plan(args, "windows") + result = clone_vm(plan) + print_json(result) + + +def cmd_list_vms(args: argparse.Namespace) -> None: + rows = [] + for name in virsh_list_all_names(): + ips = [x[3] for x in domifaddr(name) if x[2].lower().startswith("ipv4")] + rows.append({ + "name": name, + "state": dom_state(name), + "ipv4": ips, + }) + print_json(rows) + + +def cmd_vm_ips(args: argparse.Namespace) -> None: + targets = [args.name] if args.name else virsh_list_all_names() + rows = [] + for name in targets: + for iface, mac, proto, addr in domifaddr(name): + rows.append({ + "vm": name, + "iface": iface, + "mac": mac, + "proto": proto, + "addr": addr, + }) + print_json(rows) + + +def cmd_map_disks(args: argparse.Namespace) -> None: + targets = [args.name] if args.name else virsh_list_all_names() + rows = [] + for name in targets: + rows.extend(map_vm_disks(name)) + print_json(rows) + + +def cmd_show_vm(args: argparse.Namespace) -> None: + name = args.name + rows = { + "name": name, + "state": dom_state(name), + "ips": [{"iface": i[0], "mac": i[1], "proto": i[2], "addr": i[3]} for i in domifaddr(name)], + "disks": map_vm_disks(name), + } + print_json(rows) + + +def add_common_clone_args(p: argparse.ArgumentParser) -> None: + p.add_argument("--template", required=True, help="模板虚拟机名称") + p.add_argument("--name", help="新虚拟机名称;不传则按 name-prefix + IP 自动生成") + p.add_argument("--name-prefix", default="vm", help="自动生成虚拟机名称前缀") + p.add_argument("--hostname", help="客体系统主机名;不传则自动按 name 生成") + p.add_argument("--ip", required=True, help="静态 IP,例如 192.168.11.101") + p.add_argument("--prefix", type=int, default=DEFAULT_PREFIX, help="前缀长度,例如 24") + p.add_argument("--gateway", default=DEFAULT_GATEWAY, help="默认网关") + p.add_argument("--dns", default=",".join(DEFAULT_DNS), help="DNS,逗号分隔") + p.add_argument("--bridge", default=DEFAULT_BRIDGE, help="libvirt bridge 名称") + p.add_argument("--vcpus", type=int, help="虚拟 CPU 数") + p.add_argument("--memory", type=int, help="内存,单位 MB") + p.add_argument("--data-size", default="", help="新数据盘大小,例如 100G;默认不创建数据盘") + p.add_argument("--sys-dir", default=DEFAULT_SYS_DIR, help="系统盘目录") + p.add_argument("--data-dir", default=DEFAULT_DATA_DIR, help="数据盘目录") + p.add_argument("--sys-pool", default=DEFAULT_SYS_POOL, help="系统盘存储池名称") + p.add_argument("--data-pool", default=DEFAULT_DATA_POOL, help="数据盘存储池名称") + p.add_argument("--autostart", action="store_true", help="定义完成后设置开机自启") + + +def build_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + description="基于 libvirt/virsh 的 KVM 虚拟机批量管理脚本(Windows/Linux 模板克隆、IP 查询、磁盘映射)" + ) + sub = parser.add_subparsers(dest="command", required=True) + + p1 = sub.add_parser("clone-linux", help="从 Linux 模板克隆新虚拟机") + add_common_clone_args(p1) + p1.set_defaults(func=cmd_clone_linux) + + p2 = sub.add_parser("clone-windows", help="从 Windows 模板克隆新虚拟机") + add_common_clone_args(p2) + p2.set_defaults(func=cmd_clone_windows) + + p3 = sub.add_parser("list-vms", help="列出全部虚拟机及 IPv4") + p3.set_defaults(func=cmd_list_vms) + + p4 = sub.add_parser("vm-ips", help="查询单个或全部虚拟机 IP") + p4.add_argument("name", nargs="?", help="虚拟机名称;不传则全部") + p4.set_defaults(func=cmd_vm_ips) + + p5 = sub.add_parser("map-disks", help="查看系统盘/数据盘与虚拟机关系") + p5.add_argument("name", nargs="?", help="虚拟机名称;不传则全部") + p5.set_defaults(func=cmd_map_disks) + + p6 = sub.add_parser("show-vm", help="查看单台虚拟机详情") + p6.add_argument("name", help="虚拟机名称") + p6.set_defaults(func=cmd_show_vm) + + return parser + + +def main() -> int: + try: + parser = build_parser() + args = parser.parse_args() + args.func(args) + return 0 + except KeyboardInterrupt: + print("用户中断", file=sys.stderr) + return 130 + except Exception as e: + print(f"ERROR: {e}", file=sys.stderr) + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager_README.md b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager_README.md new file mode 100644 index 0000000..65472c4 --- /dev/null +++ b/20-物理服务器虚拟机/1-2026年4月15日-管理方案/vm_manager_README.md @@ -0,0 +1,103 @@ +# vm_manager.py 使用说明 + +## 1. 宿主机依赖 + +```bash +yum install -y python3 libvirt-client qemu-img genisoimage +``` + +说明: +- `virsh` 用于定义/启动/查询虚拟机 +- `qemu-img` 用于复制系统盘、创建数据盘 +- `genisoimage` 用于生成 Linux cloud-init 配置盘和 Windows 配置盘 + +## 2. Linux 模板一次性准备 + +模板机内建议至少完成: + +```bash +# Ubuntu / openEuler / CentOS 模板内 +sudo yum install -y qemu-guest-agent cloud-init || sudo apt-get update && sudo apt-get install -y qemu-guest-agent cloud-init +sudo systemctl enable qemu-guest-agent +sudo systemctl enable cloud-init cloud-config cloud-final cloud-init-local + +# 建议清理模板痕迹 +sudo cloud-init clean --logs +sudo truncate -s 0 /etc/machine-id +sudo rm -f /var/lib/dbus/machine-id +sudo sync +sudo shutdown -h now +``` + +## 3. Windows 模板一次性准备 + +模板机内建议至少完成: + +1. 安装 VirtIO 驱动和 qemu guest agent +2. 放置 `windows_template_bootstrap.ps1` 到: + - `C:\ProgramData\VmBootstrap\bootstrap.ps1` +3. 注册开机任务(可直接运行 `SetupComplete.cmd` 中的 `schtasks` 命令) +4. 最后执行 Sysprep 通用化并关机 + +推荐命令: + +```powershell +C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown +``` + +## 4. Linux 克隆示例 + +```bash +python3 vm_manager.py clone-linux \ + --template ubuntu2204-vm \ + --name-prefix ubuntu2204 \ + --ip 192.168.11.171 \ + --prefix 24 \ + --gateway 192.168.11.1 \ + --dns 192.168.34.40,223.5.5.5 \ + --vcpus 4 \ + --memory 8192 \ + --data-size 300G \ + --autostart +``` + +## 5. Windows 克隆示例 + +```bash +python3 vm_manager.py clone-windows \ + --template win-server-2022-template \ + --name-prefix ws2022 \ + --ip 192.168.11.161 \ + --prefix 24 \ + --gateway 192.168.11.1 \ + --dns 223.5.5.5,114.114.114.114 \ + --vcpus 8 \ + --memory 16384 \ + --data-size 500G \ + --data-drive-letter D \ + --autostart +``` + +## 6. 查询命令 + +```bash +# 全部虚拟机与 IP +python3 vm_manager.py list-vms + +# 查询单台虚拟机 IP +python3 vm_manager.py vm-ips ws2022-192-168-11-120 + +# 查询系统盘/数据盘映射 +python3 vm_manager.py map-disks + +# 查询单台详情 +python3 vm_manager.py show-vm ws2022-192-168-11-120 +``` + +## 7. 注意事项 + +1. 本脚本默认把模板的第一块系统盘克隆到 `/vm/sys/.qcow2` +2. 模板中原有附加数据盘会被忽略,不会复制;新数据盘按参数重新创建到 `/vm/data/-data.qcow2` +3. 脚本会自动生成新的 UUID、MAC,并把网卡桥接到 `br0` +4. 如果模板使用 UEFI/NVRAM,脚本会自动复制一份新的 VARS 文件 +5. `vm-ips` 依赖客体已安装 qemu-guest-agent;否则会退回 lease/arp 查询 diff --git a/20-物理服务器虚拟机/2-2026年3月25日-实操.sh b/20-物理服务器虚拟机/2-2026年3月25日-实操.sh new file mode 100644 index 0000000..af1d037 --- /dev/null +++ b/20-物理服务器虚拟机/2-2026年3月25日-实操.sh @@ -0,0 +1,27 @@ +# 检查当前主机名 +hostnamectl + +# 如无 DNS 服务器,用 hosts 文件模拟(测试环境可行) +echo "192.168.11.14 wdd.ovirt.local.lan ovirt" >> /etc/hosts +hostnamectl set-hostname wdd.ovirt.local.lan + + +# 1. 验证 CPU 虚拟化支持(必须有输出) +grep -E 'svm|vmx' /proc/cpuinfo | head -3 + +# 2. 验证磁盘类型 +lsblk -d -o NAME,ROTA,TYPE,SIZE,MODEL +# ROTA=0 表示 SSD/NVMe,ROTA=1 表示 HDD + +# 3. 检查内核模块 +lsmod | grep kvm +# 应看到 kvm_intel 和 kvm + +# 4. 如未加载,手动加载 +modprobe kvm_intel + +# 5. 确认 hostname 与 hosts 文件一致 +hostname -f # 应返回完整 FQDN,如 ovirt.local.lan +ping -c 2 $(hostname -f) # 必须能 ping 通自己 + + diff --git a/20-物理服务器虚拟机/3-磁盘格式化.sh b/20-物理服务器虚拟机/3-磁盘格式化.sh new file mode 100644 index 0000000..71b3b40 --- /dev/null +++ b/20-物理服务器虚拟机/3-磁盘格式化.sh @@ -0,0 +1,106 @@ +# sdb 是 SSD,容量 2.6TB(> 2TB),必须用 GPT +parted /dev/sdb --script mklabel gpt +parted /dev/sdb --script mkpart primary xfs 0% 100% + +# 验证分区 +lsblk /dev/sdb +partprobe /dev/sdb + +# 格式化为 XFS(SSD 优化参数) +mkfs.xfs -f \ + -d agcount=8 \ + -l size=128m \ + /dev/sdb1 + +# 创建挂载点 +mkdir -p /data/vm-storage + +# 写入 fstab(SSD 加 noatime 减少写放大) +echo '/dev/sdb1 /data/vm-storage xfs defaults,noatime 0 2' >> /etc/fstab +mount -a + +# 验证 +df -hT /data/vm-storage + + + + + +# 138.3TB 必须用 GPT +parted /dev/sdc --script mklabel gpt +parted /dev/sdc --script mkpart primary xfs 0% 100% + +partprobe /dev/sdc + +# 方法A:完全让 xfsprogs 自动决定(推荐,最简单) +mkfs.xfs -f -i size=512 /dev/sdc1 + +# 挂载(超过 2TB 必须加 inode64 确保 inode 分布在整个分区) +mkdir -p /data/bulk-storage + +echo '/dev/sdc1 /data/bulk-storage xfs defaults,noatime,inode64 0 2' >> /etc/fstab +mount -a + +# 验证(确认容量正确显示) +df -hT /data/bulk-storage + + +# oVirt 要求固定 UID:GID = 36:36(vdsm:kvm) +groupadd kvm -g 36 2>/dev/null || true +useradd vdsm -u 36 -g 36 -s /sbin/nologin 2>/dev/null || true + +# sdb 上的目录(VM 磁盘) +mkdir -p /data/vm-storage/data # VM 数据域 +mkdir -p /data/vm-storage/export # 导出域(用于 VM 备份/迁移) +chown -R 36:36 /data/vm-storage/ +chmod -R 0755 /data/vm-storage/ + +# sdc 上的目录(大容量镜像) +mkdir -p /data/bulk-storage/iso # ISO 镜像域 +mkdir -p /data/bulk-storage/backup # 可选:额外备份 +chown -R 36:36 /data/bulk-storage/iso +chmod 0755 /data/bulk-storage/iso + + +dnf install -y nfs-utils +systemctl enable --now rpcbind nfs-server + +# 添加 NFS 导出规则 +cat >> /etc/exports << 'EOF' +/data/vm-storage/data 192.168.11.0/24(rw,sync,no_subtree_check,no_root_squash) +/data/vm-storage/export 192.168.11.0/24(rw,sync,no_subtree_check,no_root_squash) +/data/bulk-storage/iso 192.168.11.0/24(rw,sync,no_subtree_check,no_root_squash) +EOF + +# 刷新导出表 +exportfs -ra + +# 验证导出是否正常 +exportfs -v +showmount -e 192.168.11.14 + + +oVirt 中存储域配置 +存储配置完成后,在 oVirt Web Portal 中按以下顺序添加存储域: +存储 → 存储域 → 新建域 + +① 数据域(VM 磁盘,SSD) + 名称: vm-data-ssd + 域功能: 数据 + 存储类型: NFS + 宿主机: node01 + 导出路径: 192.168.11.14:/data/vm-storage/data + NFS版本: V4_1(推荐) + +② ISO 域(安装镜像,HDD) + 名称: iso-library + 域功能: ISO + 存储类型: NFS + 导出路径: 192.168.11.14:/data/bulk-storage/iso + +③ 导出域(VM 备份/导入导出) + 名称: vm-export + 域功能: 导出 + 存储类型: NFS + 导出路径: 192.168.11.14:/data/vm-storage/export + diff --git a/20-物理服务器虚拟机/4-2026年4月13日-操作.md b/20-物理服务器虚拟机/4-2026年4月13日-操作.md new file mode 100644 index 0000000..08443b1 --- /dev/null +++ b/20-物理服务器虚拟机/4-2026年4月13日-操作.md @@ -0,0 +1,321 @@ +以下是针对你服务器(Xeon Silver 4214 双路、192GB、openEuler 22.03 LTS-SP3)的完整 KVM + libvirt + Cockpit 部署方案,按操作顺序排列。 + +*** + +## 第一步:环境预检 + +```bash +# 确认 CPU 支持 VT-x 虚拟化 +egrep -c '(vmx|svm)' /proc/cpuinfo # 结果应 > 0 + +# 确认 KVM 模块已加载(openEuler 内核已内置) +ls /dev/kvm && ls /sys/module/kvm # 两个路径均存在即正常 + +# 查看 NUMA 拓扑(双路服务器,涉及后续内存优化) +numactl --hardware +``` + +*** + +## 第二步:磁盘格式化与挂载 + +你的 sda 已是系统盘不动,仅操作 sdb 和 sdc。 + +### sdb(NVMe 2.6T → VM 系统盘) + +```bash +# 建立 GPT 分区表,整盘一个分区 +parted /dev/sdb mklabel gpt +parted /dev/sdb mkpart primary xfs 0% 100% +parted /dev/sdb print # 确认分区为 /dev/sdb1 + +# 格式化为 XFS(大文件、并发读写性能最佳) +mkfs.xfs -f -L vm-sys /dev/sdb1 + +# 创建挂载点并挂载 +mkdir -p /vm/sys +mount /dev/sdb1 /vm/sys + +# 写入 fstab(用 UUID,防设备名变更) +UUID_SDB=$(blkid -s UUID -o value /dev/sdb1) +echo "UUID=${UUID_SDB} /vm/sys xfs defaults,noatime,nodiratime 0 2" >> /etc/fstab +``` + +### sdc(SATA 138.3T → VM 数据存储盘) + +```bash +# 同样 GPT + 整盘分区 +parted /dev/sdc mklabel gpt +parted /dev/sdc mkpart primary xfs 0% 100% + +# XFS 格式化(大容量盘推荐加 -i size=512 增大 inode 密度) +mkfs.xfs -f -L vm-data -i size=512 /dev/sdc1 + +mkdir -p /vm/data +mount /dev/sdc1 /vm/data + +UUID_SDC=$(blkid -s UUID -o value /dev/sdc1) +echo "UUID=${UUID_SDC} /vm/data xfs defaults,noatime,nodiratime 0 2" >> /etc/fstab + +# 验证挂载 +mount -a && df -hT /vm/sys /vm/data +``` + +*** + +## 第三步:安装 KVM 虚拟化组件 + +```bash +# 安装核心组件 + Cockpit +dnf install -y qemu libvirt libvirt-client virt-install \ + cockpit cockpit-machines + +# 修改 QEMU 配置,以 root 权限运行(避免权限问题) +sed -i 's/#user = "root"/user = "root"/' /etc/libvirt/qemu.conf +sed -i 's/#group = "root"/group = "root"/' /etc/libvirt/qemu.conf + +# 启动并设置开机自启 +systemctl enable --now libvirtd +systemctl enable --now cockpit.socket + +# 验证 +virt-host-validate # 关键项全部 PASS +``` + +访问 Cockpit:浏览器打开 `https://192.168.11.14:9090`,用 root 账号登录,**Virtual Machines** 标签即为虚拟机管理界面。 [docs.openeuler](https://docs.openeuler.org/zh/docs/22.03_LTS/docs/Virtualization/%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E5%8C%96%E7%BB%84%E4%BB%B6.html) + +*** + +## 第四步:网络配置(Bond → Bridge) + +> ⚠️ **高风险操作**,修改网络可能中断 SSH。务必先执行保底命令,再执行网络变更。 + +### 保底恢复方案(必须先执行) + +```bash +# 安装 at 包 +dnf install -y at + +# 启动 atd 守护进程 +systemctl enable --now atd + +# 验证 +which at && systemctl is-active atd + +# 60秒后自动恢复 bond0 IP(防止配置错误断网) +at now + 2 minutes << 'EOF' +nmcli con down br0 2>/dev/null +ip addr add 192.168.11.14/24 dev bond0 +ip route add default via 192.168.11.1 dev bond0 +EOF +``` + +### 创建 br0 桥接(桥接到 bond0) + +```bash +# 1. 创建 bridge br0 +nmcli con add type bridge ifname br0 con-name br0 \ + ipv4.addresses 192.168.11.14/24 \ + ipv4.gateway 192.168.11.1 \ + ipv4.dns "114.114.114.114 8.8.8.8" \ + ipv4.method manual \ + bridge.stp no \ + connection.autoconnect yes + +# 2. 将 bond0 作为 br0 的从属(slave) +nmcli con add type bridge-slave \ + ifname bond0 master br0 \ + con-name br0-slave-bond0 + +# 3. 先启动新配置(此时会短暂断连) +nmcli con up br0 + +# 4. 验证(重连后执行) +ip addr show br0 # 应显示 192.168.11.14/24 + +dnf install -y bridge-utils +brctl show br0 # 应显示 bond0 为成员 +``` + +如果连通后取消保底恢复任务: + +```bash +atrm $(atq | awk '{print $1}') +``` + +### 虚拟机内部网络建议 + +```bash +# 使用 virsh 定义 bridge 类型网络(替代默认 NAT 网络) +cat > /tmp/bridge-net.xml << 'EOF' + + bridge-net + + + +EOF + +virsh net-define /tmp/bridge-net.xml +virsh net-autostart bridge-net +virsh net-start bridge-net +``` + +*** + +## 第五步:内核参数优化 + +这是宿主机调优的核心,写入持久化配置文件。 [blog.csdn](https://blog.csdn.net/weixin_34378969/article/details/92925024) + +```bash +cat > /etc/sysctl.d/99-kvm-host.conf << 'EOF' +# ── 内存管理 ────────────────────────────────────────────────── +# 宿主机上降低 swap 使用倾向(KVM 宿主机关键配置) +vm.swappiness = 10 + +# 脏页回写优化(减少 IO 抖动) +vm.dirty_ratio = 20 +vm.dirty_background_ratio = 5 +vm.dirty_writeback_centisecs = 1500 + +# 透明大页:启用(内核自动为 VM 分配,提升 TLB 命中率) +# 注:通过 /sys 控制,sysctl 不直接设置 + +# 最大内存映射数量(VM 密集场景需增大) +vm.max_map_count = 524288 + +# ── 网络优化 ────────────────────────────────────────────────── +net.core.netdev_max_backlog = 250000 +net.core.rmem_max = 134217728 +net.core.wmem_max = 134217728 +net.ipv4.tcp_rmem = 4096 87380 134217728 +net.ipv4.tcp_wmem = 4096 65536 134217728 +net.ipv4.tcp_mtu_probing = 1 + +# 允许 IP 转发(虚拟机流量需要) +net.ipv4.ip_forward = 1 + +# ── 内核调度 ────────────────────────────────────────────────── +# NUMA 自动均衡(双路服务器开启,减少跨节点内存访问) +kernel.numa_balancing = 1 + +# 增大 PID 上限(多 VM 场景进程数多) +kernel.pid_max = 4194304 +EOF + +# 立即生效 +sysctl --system +``` + +### 透明大页(THP)配置 + +```bash +# 将 THP 设置为 madvise 模式(应用主动申请才分配,更可控) +echo madvise > /sys/kernel/mm/transparent_hugepage/enabled +echo defer+madvise > /sys/kernel/mm/transparent_hugepage/defrag + +# 持久化(写入 rc.local 或 systemd 服务) +cat > /etc/rc.d/rc.local << 'EOF' +#!/bin/bash +echo madvise > /sys/kernel/mm/transparent_hugepage/enabled +echo defer+madvise > /sys/kernel/mm/transparent_hugepage/defrag +EOF +chmod +x /etc/rc.d/rc.local +systemctl enable rc-local +``` + +### GRUB 内核启动参数(重启生效) + +```bash +# 编辑 /etc/default/grub,在 GRUB_CMDLINE_LINUX 末尾添加: +# intel_iommu=on iommu=pt(启用 IOMMU,支持 PCIe 直通) +# default_hugepagesz=2M hugepagesz=2M(预留 2MB 大页) +# nohz=on(减少不必要的时钟中断) + +sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 intel_iommu=on iommu=pt nohz=on"/' \ + /etc/default/grub + +grub2-mkconfig -o /boot/grub2/grub.cfg +``` + +*** + +## 第六步:Swap 虚拟内存策略 + +你的 sda3 上已有 16G swap(来自 LVM),以下是建议策略: [ask.vmlib](https://ask.vmlib.com/how-to-configure-memory-locking-in-kvm-virtual-machines/lock-memory-kvm) + +| 场景 | 建议 | 理由 | +|---|---|---| +| 当前(192GB 内存充足) | **保留但降低优先级**(`vm.swappiness=10`) | KVM 宿主机内存被 swap 换出后 VM 会卡顿,但完全关闭在内存耗尽时会触发 OOM kill | +| VM 内存超分配(开多 VM) | **保留 swap,监控使用率** | 超分场景 swap 是最后防线 | +| 生产高性能数据库 VM | 可关闭:`swapoff -a` + 注释 fstab | 数据库对 swap 延迟极度敏感 | + +当前配置只需确保 `vm.swappiness=10` 已生效即可: + +```bash +sysctl vm.swappiness # 确认输出为 10 +free -h # 查看 swap 使用状态 +``` + +*** + +## 第七步:libvirt 存储池配置 + +```bash +# 定义 sdb 存储池(VM 系统盘) +virsh pool-define-as vm-sys dir --target /vm/sys +virsh pool-autostart vm-sys +virsh pool-start vm-sys + +# 定义 sdc 存储池(VM 数据盘) +virsh pool-define-as vm-data dir --target /vm/data +virsh pool-autostart vm-data +virsh pool-start vm-data + +# 验证 +virsh pool-list --all +``` + +*** + +## 第八步:创建第一台虚拟机示例 + +```bash +# 在 sdb 池中创建 100G 系统盘镜像 +virsh vol-create-as vm-sys centos8.qcow2 100G --format qcow2 + +# 用 virt-install 创建 VM(以 ISO 安装为例) +virt-install \ + --name vm01 \ + --memory 16384 \ + --vcpus 8,sockets=1,cores=8,threads=1 \ + --cpu host-model \ + --disk vol=vm-sys/centos8.qcow2,bus=virtio,cache=writeback \ + --network bridge=br0,model=virtio \ + --graphics vnc,listen=0.0.0.0,port=5901 \ + --video virtio \ + --os-variant centos8 \ + --cdrom /vm/data/iso/CentOS-8.iso \ + --noautoconsole + +# 连接 VNC 查看安装过程(本地端口转发后用 VNC 客户端连接) +# ssh -L 5901:127.0.0.1:5901 root@192.168.11.14 +``` + +*** + +## 部署完成检查清单 + +```bash +# 全面验证宿主机状态 +echo "=== KVM ===" && ls /dev/kvm +echo "=== libvirtd ===" && systemctl is-active libvirtd +echo "=== Cockpit ===" && systemctl is-active cockpit.socket +echo "=== 存储池 ===" && virsh pool-list --all +echo "=== 网络 ===" && virsh net-list --all +echo "=== 桥接 ===" && brctl show +echo "=== 磁盘挂载 ===" && df -hT /vm/sys /vm/data +echo "=== THP ===" && cat /sys/kernel/mm/transparent_hugepage/enabled +echo "=== swappiness ===" && sysctl vm.swappiness +``` + +所有输出正常后,通过浏览器 `https://192.168.11.14:9090` 的 Cockpit 控制台即可进行日常虚拟机管理,无需命令行。 [cloud.tencent](https://cloud.tencent.com/developer/article/2417991) \ No newline at end of file diff --git a/20-物理服务器虚拟机/5-2026年4月13日-虚拟机创建.md b/20-物理服务器虚拟机/5-2026年4月13日-虚拟机创建.md new file mode 100644 index 0000000..5ecfc47 --- /dev/null +++ b/20-物理服务器虚拟机/5-2026年4月13日-虚拟机创建.md @@ -0,0 +1,67 @@ +我现在再openEuler22.03 (LTS-SP3)安装了cockpit-178-17.oe2203sp3.src.rpm + +virsh pool已经设置 +sdb 存储池(VM 系统盘) /vm/sys +sdc 存储池(VM 数据盘) /vm/data + +网卡信息如下 +[root@wdd-phy-11-14 data]# ip addr +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 +link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +inet 127.0.0.1/8 scope host lo +valid_lft forever preferred_lft forever +inet6 ::1/128 scope host +valid_lft forever preferred_lft forever +2: eno3: mtu 1500 qdisc mq state DOWN group default qlen 1000 +link/ether bc:16:95:28:6e:6f brd ff:ff:ff:ff:ff:ff +3: eno4: mtu 1500 qdisc mq state DOWN group default qlen 1000 +link/ether bc:16:95:28:6e:70 brd ff:ff:ff:ff:ff:ff +4: ens5f0np0: mtu 1500 qdisc mq state DOWN group default qlen 1000 +link/ether bc:16:95:25:12:43 brd ff:ff:ff:ff:ff:ff +5: ens5f1np1: mtu 1500 qdisc mq state UP group default qlen 1000 +link/ether bc:16:95:25:12:44 brd ff:ff:ff:ff:ff:ff +6: ens6f0np0: mtu 1500 qdisc mq state DOWN group default qlen 1000 +link/ether bc:16:95:25:6b:5f brd ff:ff:ff:ff:ff:ff +7: ens6f1np1: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000 +link/ether bc:16:95:25:6b:60 brd ff:ff:ff:ff:ff:ff +8: br0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000 +link/ether fa:97:af:82:90:0f brd ff:ff:ff:ff:ff:ff +inet 192.168.11.14/24 brd 192.168.11.255 scope global noprefixroute br0 +valid_lft forever preferred_lft forever +9: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 +link/ether bc:16:95:25:6b:60 brd ff:ff:ff:ff:ff:ff +inet 192.168.11.14/24 brd 192.168.11.255 scope global noprefixroute bond0 +valid_lft forever preferred_lft forever +inet6 fe80::b027:c114:f952:dd90/64 scope link noprefixroute +valid_lft forever preferred_lft forever +10: virbr0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000 +link/ether 52:54:00:1f:04:83 brd ff:ff:ff:ff:ff:ff +inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 +valid_lft forever preferred_lft forever +11: virbr0-nic: mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000 +link/ether 52:54:00:1f:04:83 brd ff:ff:ff:ff:ff:ff + +我有一个操作系统的ISO文件 /vm/data/ubuntu-22.04.5-live-server-amd64.iso 请你给出虚拟机的创建命令 虚拟机的IP地址应该为 192.168.11.158 与现在的192.168.11.14处于同一CIDR中 虚拟机系统盘为20GB,数据盘为40GB + +请给出命令行创建这台虚拟机,我需要能够追踪设置虚拟机的安装过程,请给出方法 + + +我现在再openEuler22.03 (LTS-SP3)安装了cockpit-178-17.oe2203sp3.src.rpm +启动虚拟机的命令如下 +virt-install \ +--name ubuntu2204-vm \ +--vcpus 4 \ +--ram 8192 \ +--cpu mode=host-passthrough \ +--os-variant ubuntu21.04 \ +--disk path=/vm/sys/ubuntu2204-sys.qcow2,format=qcow2,bus=virtio \ +--disk path=/vm/data/ubuntu2204-data.qcow2,format=qcow2,bus=virtio \ +--cdrom /vm/data/ubuntu-22.04.5-live-server-amd64.iso \ +--network bridge=br0,model=virtio \ +--graphics vnc,listen=127.0.0.1 \ +--video vga \ +--console pty,target_type=serial \ +--noautoconsole \ +--autostart + +我现在不想要远程VNC 想要使用控制网页上面自带的VNC,请你给出合适的修改意见 \ No newline at end of file diff --git a/20-物理服务器虚拟机/6-2026年4月13日-虚拟机创建.sh b/20-物理服务器虚拟机/6-2026年4月13日-虚拟机创建.sh new file mode 100644 index 0000000..246a39e --- /dev/null +++ b/20-物理服务器虚拟机/6-2026年4月13日-虚拟机创建.sh @@ -0,0 +1,37 @@ +# 将 bond0 加入 br0 桥 +nmcli con modify bond0 master br0 slave-type bridge +nmcli con up br0 + +# 或用 ip 命令(重启后失效,仅测试用) +ip addr del 192.168.11.14/24 dev bond0 +ip link set bond0 master br0 +ip link set br0 up + + +# 系统盘 20GB → /vm/sys +virsh vol-create-as vm-sys ubuntu2204-sys.qcow2 20G --format qcow2 + +# 数据盘 40GB → /vm/data +virsh vol-create-as vm-data ubuntu2204-data.qcow2 40G --format qcow2 + +qemu-img create -f qcow2 /vm/sys/ubuntu2204-sys.qcow2 20G +qemu-img create -f qcow2 /vm/data/ubuntu2204-data.qcow2 40G + + +# --graphics vnc,listen=0.0.0.0,port=5910,password=Passw0rd \ + +virt-install \ + --name ubuntu2204-vm \ + --vcpus 4 \ + --ram 8192 \ + --cpu mode=host-passthrough \ + --os-variant ubuntu21.04 \ + --disk path=/vm/sys/ubuntu2204-sys.qcow2,format=qcow2,bus=virtio \ + --disk path=/vm/data/ubuntu2204-data.qcow2,format=qcow2,bus=virtio \ + --cdrom /vm/data/ubuntu-22.04.5-live-server-amd64.iso \ + --network bridge=br0,model=virtio \ + --graphics vnc,listen=127.0.0.1 \ + --video vga \ + --console pty,target_type=serial \ + --noautoconsole \ + --autostart \ No newline at end of file diff --git a/20-物理服务器虚拟机/7-虚拟机管理指南.md b/20-物理服务器虚拟机/7-虚拟机管理指南.md new file mode 100644 index 0000000..2c20f34 --- /dev/null +++ b/20-物理服务器虚拟机/7-虚拟机管理指南.md @@ -0,0 +1,30 @@ +我现在有一台物理服务器 操作系统为openEuler22.03 (LTS-SP3) 虚拟化软件为cockpit-178-17.oe2203sp3.src.rpm + +配置如下 Intel(R) Xeon(R) Silver 4214 CPU @ 2.20GHz 2颗,192G内存,447G SSD,2.6T NVMe,138T SATA + +virsh pool已经设置 +sdb 存储池(VM 系统盘)2.6T NVMe /vm/sys vm-sys +sdc 存储池(VM 数据盘)138T SATA /vm/data vm-data + +虚拟机的网卡设置为绑定br0 虚拟机的网段为192.168.11.x/24 网关为192.168.11.1 + + +我现在需要一套方案,请在linux环境实现python3的脚本,实现如下的内容 +1. windows虚拟机管理 + 1. 我已经创建了windows server 2022 standard作为模板 + 2. 需要通过脚本参数 设置主机的的IP地址 + 2. 需要考虑自动设置计算机名 + 3. 数据盘不需要复制,直接新建 + 4. 新建主机名称 包含IP地址信息 + 7. 需要修改主机的硬件信息 +3. linux主机关系 + 1. 虚拟机的模板我已经创建 + 2. 需要支持ubuntu 22.04 centos 22.03等操作系统 + 3. 需要修改主机的硬件信息 + 4. 需要设置主机的计算机名 + 5. 考虑数据盘解绑的问题 + 6. 可以通过参数修改主机的静态IP地址 +4. 虚拟机管理 + 1. 系统盘和数据盘与虚拟机主机之间的关系需要能够查看 + 2. 运行中的虚拟机的IP地址能够获取并查看 + 3. 能够一键复制虚拟机 \ No newline at end of file diff --git a/20-物理服务器虚拟机/物理服务器信息.md b/20-物理服务器虚拟机/物理服务器信息.md new file mode 100644 index 0000000..b699df2 --- /dev/null +++ b/20-物理服务器虚拟机/物理服务器信息.md @@ -0,0 +1,94 @@ +[root@localhost ~]# lscpu +Architecture: x86_64 + CPU op-mode(s): 32-bit, 64-bit + Address sizes: 46 bits physical, 48 bits virtual + Byte Order: Little Endian +CPU(s): 48 + On-line CPU(s) list: 0-47 +Vendor ID: GenuineIntel + BIOS Vendor ID: Intel(R) Corporation + Model name: Intel(R) Xeon(R) Silver 4214 CPU @ 2.20GHz + BIOS Model name: Intel(R) Xeon(R) Silver 4214 CPU @ 2.20GHz CPU @ 2.2GHz + BIOS CPU family: 179 + CPU family: 6 + Model: 85 + Thread(s) per core: 2 + Core(s) per socket: 12 + Socket(s): 2 + Stepping: 7 + CPU(s) scaling MHz: 33% + CPU max MHz: 3200.0000 + CPU min MHz: 1000.0000 + +[root@localhost ~]# lsmem +RANGE SIZE STATE REMOVABLE BLOCK +0x0000000000000000-0x000000007fffffff 2G online yes 0 +0x0000000100000000-0x000000307fffffff 190G online yes 2-96 + +Memory block size: 2G +Total online memory: 192G +Total offline memory: 0B +[root@localhost ~]# lsblk +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS +sda 8:0 0 447.1G 0 disk +├─sda1 8:1 0 600M 0 part /boot/efi +├─sda2 8:2 0 1G 0 part /boot +└─sda3 8:3 0 445.5G 0 part + ├─openeuler-root 253:0 0 200G 0 lvm / + ├─openeuler-swap 253:1 0 16G 0 lvm [SWAP] + └─openeuler-home 253:2 0 229.5G 0 lvm /home +sdb 8:16 0 2.6T 0 disk +sdc 8:32 0 138.3T 0 disk +sr0 11:0 1 1024M 0 rom + +[root@localhost ~]# cat /etc/os-release +NAME="openEuler" +VERSION="22.03 (LTS-SP3)" +ID="openEuler" +VERSION_ID="22.03" +PRETTY_NAME="openEuler 22.03 (LTS-SP3)" +ANSI_COLOR="0;31" + +[root@localhost ~]# uname -a +Linux localhost.localdomain 5.10.0-182.0.0.95.oe2203sp3.x86_64 #1 SMP Sat Dec 30 13:10:36 CST 2023 x86_64 x86_64 x86_64 GNU/Linux + +[root@localhost ~]# ip addr +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host noprefixroute + valid_lft forever preferred_lft forever +2: eno3: mtu 1500 qdisc mq state DOWN group default qlen 1000 + link/ether bc:16:95:28:6e:6f brd ff:ff:ff:ff:ff:ff +3: ens5f0np0: mtu 1500 qdisc mq state DOWN group default qlen 1000 + link/ether bc:16:95:25:12:43 brd ff:ff:ff:ff:ff:ff +4: eno4: mtu 1500 qdisc mq state DOWN group default qlen 1000 + link/ether bc:16:95:28:6e:70 brd ff:ff:ff:ff:ff:ff +5: ens5f1np1: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000 + link/ether bc:16:95:25:12:44 brd ff:ff:ff:ff:ff:ff +6: ens6f0np0: mtu 1500 qdisc mq state DOWN group default qlen 1000 + link/ether bc:16:95:25:6b:5f brd ff:ff:ff:ff:ff:ff +7: ens6f1np1: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000 + link/ether bc:16:95:25:12:44 brd ff:ff:ff:ff:ff:ff permaddr bc:16:95:25:6b:60 +8: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 + link/ether bc:16:95:25:12:44 brd ff:ff:ff:ff:ff:ff + inet 192.168.11.14/24 brd 192.168.11.255 scope global noprefixroute bond0 + valid_lft forever preferred_lft forever + inet6 fe80::be16:95ff:fe25:1244/64 scope link proto kernel_ll + valid_lft forever preferred_lft forever + +我有一台物理服务的相关信息如上 + +如下基本条件: +1. 无法使用物理机的管理平台,无法使用物理机管理的VNC +2. 宿主机操作系统尽量不会要更换,有操作系统审计 +3. 端口是全开放的 +4. 尽量避免破坏操作系统,重装非常麻烦 +5. sda为SSD,sdb为NVMe,sdc为SATA + +需求如下: +1. sda为宿主机系统盘,sdb为虚拟机系统盘,sdc为虚拟机存储盘 +2. 研究合适的虚拟机软件,尽量选择oVirit,之前我尝试在openEuler24.03上安装oVirit导致操作系统损坏 +3. 不需要磁盘格式化的操作,我已经有了 + diff --git a/21-K8S操作相关/1-环境分支.md b/21-K8S操作相关/1-环境分支.md new file mode 100644 index 0000000..c5a4ae4 --- /dev/null +++ b/21-K8S操作相关/1-环境分支.md @@ -0,0 +1,85 @@ +#!/bin/bash +# ============================================================ +# 脚本功能:收集指定命名空间下副本数 > 1 的 Deployment 信息 +# 包含:Deployment 名称、镜像名称、GIT 相关环境变量 +# ============================================================ + +set -euo pipefail + +# ── 配置区 ────────────────────────────────────────────────── +NAMESPACE="sd-wf-ga-fly-260327" +OUTPUT_FILE="deployment_info_$(date +%Y%m%d_%H%M%S).txt" +# ──────────────────────────────────────────────────────────── + +echo "==========================================" +echo " 命名空间 : $NAMESPACE" +echo " 输出文件 : $OUTPUT_FILE" +echo "==========================================" + +# 创建(清空)输出文件 +> "$OUTPUT_FILE" + +# 获取所有 Deployment 名称(换行分隔) +DEPLOYMENTS=$(kubectl get deployments -n "$NAMESPACE" \ + -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' 2>/dev/null) + +if [[ -z "$DEPLOYMENTS" ]]; then + echo "[ERROR] 命名空间 '$NAMESPACE' 下未发现任何 Deployment,请检查命名空间是否正确。" + exit 1 +fi + +PROCESSED=0 +SKIPPED=0 + +while IFS= read -r DEPLOY; do + [[ -z "$DEPLOY" ]] && continue + + # ── 1. 获取期望副本数 ────────────────────────────────────── + REPLICAS=$(kubectl get deployment "$DEPLOY" -n "$NAMESPACE" \ + -o jsonpath='{.spec.replicas}' 2>/dev/null) + REPLICAS="${REPLICAS:-0}" + + if [[ "$REPLICAS" == 0 ]]; then + echo "[SKIP] $DEPLOY (副本数=${REPLICAS},≤ 1,跳过)" + (( SKIPPED++ )) || true + continue + fi + + echo "[INFO] 处理 Deployment: $DEPLOY (副本数=${REPLICAS})" + + # ── 2. 获取第一个容器的镜像名称 ─────────────────────────── + IMAGE=$(kubectl get deployment "$DEPLOY" -n "$NAMESPACE" \ + -o jsonpath='{.spec.template.spec.containers[0].image}' 2>/dev/null) + IMAGE="${IMAGE:-<未获取到镜像>}" + + # ── 3. 在第一个副本 Pod 中执行 env | grep GIT ───────────── + GIT_ENV=$(kubectl exec -n "$NAMESPACE" "deploy/$DEPLOY" \ + -- sh -c "env | grep GIT" 2>/dev/null || echo "") + + # ── 4. 写入输出文件 ─────────────────────────────────────── + { + echo "deployment名称:${DEPLOY}" + echo "镜像名称:${IMAGE}" + echo "环境变量:" + if [[ -n "$GIT_ENV" ]]; then + while IFS= read -r env_line; do + echo " ${env_line}" + done <<< "$GIT_ENV" + else + echo " (未发现 GIT 相关环境变量)" + fi + echo "" + echo "------------------------------------------" + echo "" + } >> "$OUTPUT_FILE" + + (( PROCESSED++ )) || true + +done <<< "$DEPLOYMENTS" + +# ── 汇总输出 ────────────────────────────────────────────── +echo "" +echo "==========================================" +echo " 完成!已处理: ${PROCESSED} 个,已跳过: ${SKIPPED} 个" +echo " 结果文件: $OUTPUT_FILE" +echo "==========================================" \ No newline at end of file diff --git a/21-K8S操作相关/批量环境变量.md b/21-K8S操作相关/批量环境变量.md new file mode 100644 index 0000000..1a5e0f5 --- /dev/null +++ b/21-K8S操作相关/批量环境变量.md @@ -0,0 +1,13 @@ +你是一名精通k8s开发的超级专家,非常善于撰写k8s相关的脚本,请你根据下面的要求,撰写一个k8s相关的脚本 + +1. 需要获取命令空间 sd-wf-ga-fly-260327 之下所有的deployment名称 +2. 如果deployment有多余1个的副本 + 1. 那么需要在第一个副本的Pod中 执行命令 kubectl exec -n uavcloud-demofk deploy/cmii-uav-platform-lite -- sh -c "env | grep GIT" + 2. 需要获取deployment的镜像名称,deployment默认只有一个container,所以直接获取即可 +3. 将所有的结果输出到文件,文件格式如下: + deployment名称:cmii-uav-platform-lite + 镜像名称:cmii-uav-platform-lite + 环境变量: + GIT_COMMIT=cmii-uav-platform-lite + GIT_BRANCH=cmii-uav-platform-lite + GIT_TAG=cmii-uav-platform-lite \ No newline at end of file diff --git a/22-身体状况分析/0-body b/22-身体状况分析/0-body new file mode 100644 index 0000000..2b7108f --- /dev/null +++ b/22-身体状况分析/0-body @@ -0,0 +1,29 @@ +我有一个朋友,他委托我咨询他的身体状况,你需要用非常诚实的态度及专业的角度,需要同步考虑中医和西医的观点综合给出身体状况的分析,并给出必要的建议。 + +## 基本信息: + +性别:男 +年龄:30岁 +身高:182cm +体重:82kg + + +## 已明确病症 +1. 2022年检测出高泌乳素血症,血液含量为4000多,从22年至今接受甲磺酸溴隐亭治疗,目前血液含量在几十到几百波动 +2. 2026年1月,由于肾结石住院治疗 + +## 病状记录 +1. 2025年8月开始,中午如果没有及时吃饭,会感觉到浑身无力,头脑发昏,之前以为是低血糖,2026年由于肾结石检查发现有贫血的情况。2026年蹲下然后站起,眼睛会非常的难受,有些头晕 +2. 从2016年开始,每年的春天,均会出现早醒,怕冷,容易生病,睡觉起来之后舌头肿大,舌头边缘有牙齿印,舌苔白厚,尤其是舌头的左侧比较严重 +3. 从2020年开始,经常出现右眼下眼睑跳动,持续时间挺长 +4. 用脑过度之后,感觉左侧脑仁有轻微疼痛感 +5. 从22年之后 感觉视力比较难以恢复,经常视疲劳,黑眼圈比较严重,经常会有疲惫感,视力下降比较严重 +6. 每次生气、发火之后,可能会出现头晕 +7. 用脑思考之后 脑袋眼皮出现沉重感,有疲倦的感觉 + + +请你根据以上信息,综合分析我朋友的身体状况,并给出必要的建议。 +1. 垂体是否压迫了视神经和血管? +2. 贫血和高泌乳素血症是否有关系? +3. 高泌乳素血症和中医思虑过度之间的联系 +4. 之前服用知柏地黄丸,感觉效果不错,请问是否可以继续服用? \ No newline at end of file diff --git a/22-身体状况分析/1-result-2026年4月7日.md b/22-身体状况分析/1-result-2026年4月7日.md new file mode 100644 index 0000000..e69de29 diff --git a/23-DEMO环境迁移/1-2026年4月13日-计划.md b/23-DEMO环境迁移/1-2026年4月13日-计划.md new file mode 100644 index 0000000..7d29ec0 --- /dev/null +++ b/23-DEMO环境迁移/1-2026年4月13日-计划.md @@ -0,0 +1,50 @@ + + +### 服务器资源评估 +1. 飞服平台 +2. 监管平台 +3. AI平台 +4. 视频流媒体平台 + +### 端口资源评估申请 + + +## + +### 数据库部署 +1. 主从模式 + +### 部署方案 +#### 高可用方案 +1. 业务高可用方案 + 1. 飞服平台是否支持 + 2. 监管平台是否支持 + 3. AI平台是否支持 + 4. 视频流媒体平台是否支持 +2. 存储高可用方案 + 1. 视频需要保留多久 + 2. 存储空间评估 + 3. 存储类型 +3. K8S集群高可用方案 + +#### 备份方案 + +#### 禁止事项 +1. 禁止NodePort暴露 +2. + +#### 信创要求 + + +#### NGINX高可用方案 +1. 主从模式 +2. 脚本单向复制 固定修改nginx-1的配置 ,使用脚本同步到nginx-2,脚本控制一同启动,禁止单独修改nginx-2,禁止执行nginx-1的reload + +## 其他问题 +1. 持续交付部署 +2. 安全问题 + 1. 基线扫描 + 2. 中间件漏洞 +3. 交维问题 + + diff --git a/23-DEMO环境迁移/1-迁移快文.md b/23-DEMO环境迁移/1-迁移快文.md new file mode 100644 index 0000000..02dc07f --- /dev/null +++ b/23-DEMO环境迁移/1-迁移快文.md @@ -0,0 +1,25 @@ +标题:关于DEMO环境整体迁移生产环境服务器资源方案评审的快文 + + +各研发组的同事,经过前期与各研发组同事,安全组,结合技术支撑的实际服务器资源情况,整理了以下关于DEMO环境整体迁移生产环境服务器资源的方案,请大家评审。 + +附件内容做如下说明: +研发同事根据先前DEMO的经验并结合未来的业务发展情况,整理了以下的资源需求: +研发组需求-飞服平台.xlsx +研发组需求-监管平台.xlsx + +特战队充分考虑各研发同事的需求,安全要求与规范,结合历史经验信息,结合技术支撑中心的实际服务器资源情况,整理了并汇总实际可用的服务器资源信息,内附报价 +实际服务器资源-飞服平台.xlsx +实际服务器资源-监管平台.xlsx +实际服务器资源-老平台.xlsx + +总结内容如下: +制作一个表显示 表头分别为 平台名称 服务器数量 CPU 内存 系统盘(GB) 存储盘(GB) 费用总计(元/月) +飞服平台 24 392 928 1150 172100 42,632.20 +监管平台 31 488 1072 1150 202800 48,700.60 +老平台 17 276 696 800 159700 28,674.00 + +请各位研发同事针对上述的实际服务器资源进行最终确认,如有异议,请在2026年4月16日下班前反馈。 +请产品组确定实际服务器资源的报价信息,考虑费用支出,如有异议,请在2026年4月16日下班前反馈。 + +由于迁移工作量较大,时间安排周期较为紧促,请大家务必重视,按时反馈。确保整体迁移工作的顺利进行。 \ No newline at end of file diff --git a/24-版本升级标准流程/1-数据库表结构同步-prompt.md b/24-版本升级标准流程/1-数据库表结构同步-prompt.md new file mode 100644 index 0000000..3a875d8 --- /dev/null +++ b/24-版本升级标准流程/1-数据库表结构同步-prompt.md @@ -0,0 +1,95 @@ + +你是一名精通MySQL数据库的专家,可以作为专业的DBA进行分析。现在有如下的业务流程需要满足 + +### 项目升级流程 +1. 特战队-项目运行数据库及表结构导出 可能无法直连 +2. 特战队-创建临时MySQL,导入上述的表结构 可以直连 +3. 研发人员-基于临时MySQL 进行数据库版本升级,升级到最新的数据库结构 + 1. 研发人员需要提供增量升级的脚本 + 2. 研发人员需要提供执行成功的证明 +3. 特战队-基于研发人员提供的增量升级脚本,在项目运行数据库上执行 + +### 统一导入导出工具 +1. 由于研发人员对于mysql二进制客户端不熟练,需要提供一个统一的导入导出工具 +2. 项目无法直连,无法使用Navicat DatGrip等工具 +3. 80%的项目可以直连 +4. 研发人员通常使用Navicat DatGrip等工具进行数据库操作 +5. 工具需要适配windows linux等环境,降级为支持linux即可 +6. 工具需要支持不同的CPU架构 x86 arm64 +6. 工具需要支持linux的不同发行版 + +请你基于上面的需求,给出一个可行的方案 请不要废话,直接给出简洁 专业 精炼的答案 + +导入导出工具可以自己做,底层别自己造协议轮子;增量升级 SQL 必须由研发维护 migration;比对功能可做辅助校验,但不应成为升级方案的核心。 + +db-tool 应具备的命令能力 + +建议统一成这种风格: +db-tool export-structure +db-tool import-structure +db-tool run-upgrade +db-tool verify-upgrade +db-tool diff-schema +db-tool pack + +1. export-structure + +用途:导出结构基线 + +例如: + +db-tool export-structure \ + --host 127.0.0.1 \ + --port 3306 \ + --user root \ + --schema app_db \ + --out ./export + +输出: + +schema.sql +routines.sql +manifest.json +log +2. import-structure + +用途:向临时库导入结构 + +db-tool import-structure \ + --host 127.0.0.1 \ + --port 3306 \ + --user root \ + --schema app_db_tmp \ + --input ./export +3. run-upgrade + +用途:执行升级包 + +db-tool run-upgrade \ + --host 127.0.0.1 \ + --port 3306 \ + --user root \ + --schema app_db_tmp \ + --package ./upgrade-package +4. verify-upgrade + +用途:输出成功证明 + +内容建议包括: + +当前版本查询结果 +关键表/列存在性检查 +索引检查 +视图/过程检查 +checksum 或对象清单 +5. diff-schema + +用途:比对升级前后结构差异 + +建议底层调用: + +mysqldump --no-data +再做文本标准化 diff +6. pack + +将交付物打包,便于特战队传递使用 \ No newline at end of file diff --git a/24-版本升级标准流程/2-增量升级流程图.md b/24-版本升级标准流程/2-增量升级流程图.md new file mode 100644 index 0000000..19d9436 --- /dev/null +++ b/24-版本升级标准流程/2-增量升级流程图.md @@ -0,0 +1,91 @@ +```mermaid +%%{init: { + "theme": "default", + "themeVariables": { + "fontFamily": "Microsoft YaHei, PingFang SC, Noto Sans SC, SimHei, sans-serif" + } +}}%% + +flowchart TD + A["① 特战队:导出现场数据库表结构基线
db-operator export-structure"] + B["② 特战队:创建临时 MySQL,导入结构基线
db-operator import-structure"] + + subgraph LOOP["③ 研发人员:升级迭代循环(可能多轮)"] + C1["③-a 重置临时库到基线状态
db-operator reset-database"] + C2["③-b 执行增量升级脚本
db-operator run-upgrade"] + C3["③-c 验证升级结果
db-operator verify-upgrade"] + D{"验证是否通过?"} + C4["③-d 修改 migration 脚本"] + + C1 --> C2 --> C3 --> D + D -- 否 --> C4 --> C1 + end + + E["④ 研发人员:比对升级前后结构差异(可选)
db-operator diff-schema"] + F["⑤ 研发人员:打包全部交付物
db-operator pack"] + G["交付包传递给特战队"] + H["⑥ 特战队:在现场数据库执行增量升级脚本
db-operator run-upgrade"] + I["⑦ 特战队:执行验证并生成现场成功证明
db-operator verify-upgrade"] + + A --> B --> C1 + D -- 是 --> E --> F --> G --> H --> I +``` + +```mermaid +%%{init: { + "theme": "default", + "themeVariables": { + "fontFamily": "Microsoft YaHei, PingFang SC, Noto Sans SC, SimHei, sans-serif" + } +}}%% + +flowchart TB + +%% ========================= +%% 时间顺序:自上而下 +%% ========================= + + subgraph T0["阶段一:特战队提供"] + direction TB + A["1. 导出现场数据库表结构基线
命令:db-operator export-structure"] + B["2. 创建临时 MySQL 并导入结构基线
命令:db-operator import-structure"] + A --> B + end + + subgraph T1["阶段二:研发人员提供升级SQL"] + direction TB + + C1["3.1 重置临时库到基线状态
命令:db-operator reset-database"] + C2["3.2 执行增量升级脚本
命令:db-operator run-upgrade"] + C3["3.3 验证升级结果
命令:db-operator verify-upgrade"] + + D{"是否满足转交条件?"} + + C4["3.4 修改 migration 脚本"] + E["3.5 比对升级前后结构差异(可选)
命令:db-operator diff-schema"] + F["3.6 打包交付物并移交特战队
命令:db-operator pack"] + + C1 --> C2 --> C3 --> D + D -- 否 --> C4 --> C1 + D -- 是 --> E --> F + end + + subgraph S["研发转交标准"] + direction TB + S1["提供run-upgrade命令执行成功截图"] + S2["提供diff-schema结构差异执行结果截图"] + S1 --> S2 + end + + subgraph T2["阶段三:特战队执行升级"] + direction TB + G["4. 接收研发交付包"] + H["5. 生产数据库执行升级脚本
命令:db-operator run-upgrade"] + I["6. 验证并生成成功证明
命令:db-operator verify-upgrade"] + G --> H --> I + end + + B --> C1 + F -- 满足 --> S + S --> G +``` \ No newline at end of file diff --git a/24-版本升级标准流程/3-命令总览.md b/24-版本升级标准流程/3-命令总览.md new file mode 100644 index 0000000..157d9a2 --- /dev/null +++ b/24-版本升级标准流程/3-命令总览.md @@ -0,0 +1,131 @@ +### 4.1 命令总览 + +```bash +db-operator [connection-flags] [command-flags] + +Commands: + export-structure 导出目标数据库的表结构基线(DDL) + import-structure 向目标数据库导入表结构基线 + reset-database 重置数据库到基线状态(DROP + CREATE + 重新导入) + run-upgrade 执行增量升级 SQL 脚本 + verify-upgrade 验证升级结果,生成成功证明报告 + diff-schema 比对两份结构基线的差异 + pack 将交付物打包为标准交付包 + version 输出工具版本及内置 MySQL 客户端版本 + help 帮助信息 + +Connection Flags(需要连接数据库的命令通用): + -H, --host 数据库主机地址(默认: 127.0.0.1) + -P, --port 数据库端口(默认: 3306) + -u, --user 数据库用户名(默认: root) + -p, --password 数据库密码(若未指定则交互式提示输入) + --charset 字符集(默认: utf8mb4) + +Global Flags: + -v, --verbose 启用详细输出 + --dry-run 仅预览操作,不实际执行 + --yes 跳过确认提示,直接执行 + --mysql-bin 指定 MySQL 客户端二进制所在目录(默认使用内置客户端) +``` + +> **无状态设计(ADR-6)**:工具不使用配置文件、不维护任何本地状态。每次调用通过 CLI 参数传入连接信息,仅连接单个数据库实例。密码也可通过环境变量 `DB_OPERATOR_PASSWORD` 传入以避免命令行暴露。 + +> **Docker 模式下的路径约定**:容器中所有文件 I/O 路径均相对于 `/data` 工作目录。用户通过 `-v` 挂载宿主目录到 `/data`,容器内的路径引用即对应宿主目录下的相对路径。详见 §6。 + +### 4.2 命令详细规格 + +#### 4.2.1 `export-structure` — 导出结构基线 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 连接目标 MySQL,导出全部/指定数据库的表结构(不含数据) | +| **底层调用** | `mysqldump --no-data --routines --triggers --events` | +| **输出** | `/_structure_.sql` | +| **关键参数** | `--databases`:指定数据库列表(逗号分隔),不指定则导出全部 | +| | `--output-dir`:输出目录(默认: `./export/`) | + +#### 4.2.2 `import-structure` — 导入结构基线 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 将 `export-structure` 产出的 SQL 文件导入到目标 MySQL | +| **底层调用** | `mysql < structure.sql` | +| **输入** | 一个或多个 `.sql` 文件路径 | +| **关键参数** | `--input`:SQL 文件路径(必填,支持 glob 模式如 `./export/*.sql`) | +| | `--create-db`:若数据库不存在则自动创建(默认: `true`) | + +#### 4.2.3 `reset-database` — 重置数据库到基线状态 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 将目标数据库销毁并从基线 SQL 文件重新创建,恢复到 `import-structure` 的初始状态 | +| **适用场景** | 研发人员调试 migration 脚本时多次重试,每次需要干净的起点 | +| **执行逻辑** | 1. `DROP DATABASE IF EXISTS ` | +| | 2. `CREATE DATABASE DEFAULT CHARSET=` | +| | 3. `mysql < baseline.sql`(重新导入基线结构) | +| **关键参数** | `--database`:目标数据库名(必填) | +| | `--baseline`:基线 SQL 文件路径(必填,即 `export-structure` 的产物) | +| **安全约束** | 执行前输出 **"即将销毁数据库 xxx,是否继续?[y/N]"** 确认提示 | +| | 使用 `--yes` 可跳过确认(适用于脚本化场景) | +| | `--dry-run` 模式下仅输出将要执行的操作,不实际执行 | + +> ⚠️ **风险警告**:此命令会**彻底销毁**目标数据库的所有数据与结构。仅应在临时库/开发环境使用,**严禁在生产环境执行**。 + +#### 4.2.4 `run-upgrade` — 执行增量升级脚本 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 按顺序执行研发维护的增量 migration SQL 脚本 | +| **底层调用** | `mysql < migration.sql`(按文件名自然排序依次执行) | +| **输入** | migration 脚本目录 | +| **关键参数** | `--migration-dir`:脚本目录(默认: `./migrations/`) | +| | `--database`:目标数据库名(必填) | +| | `--from`:起始版本号(可选,按文件名前缀过滤) | +| | `--to`:结束版本号(可选) | +| **执行逻辑** | 1. 扫描目录中所有 `.sql` 文件,按文件名自然排序 | +| | 2. 若指定 `--from`/`--to`,过滤文件名范围 | +| | 3. 逐个执行,任一脚本失败立即中止,输出失败脚本名及错误信息 | +| | 4. 执行结果写入日志文件 | + +#### 4.2.5 `verify-upgrade` — 验证升级结果 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 升级后重新导出结构,与预期结构进行比对,生成验证报告 | +| **输出** | `/verify_report_.json` | +| **报告内容** | 执行时间、执行环境(OS/Arch)、数据库版本、各脚本执行状态、 | +| | 升级前后表数量对比、结构差异摘要 | +| **关键参数** | `--baseline`:升级前的结构文件(用于对比) | +| | `--database`:目标数据库名(必填) | +| | `--output-dir`:报告输出目录(默认: `./reports/`) | + +#### 4.2.6 `diff-schema` — 结构差异比对 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 比对两份结构 SQL 文件的差异,输出人可读的差异报告 | +| **定位** | **仅做校验辅助,不生成可执行的 DDL SQL**(遵循 ADR-4) | +| **输入** | 两份 `.sql` 结构文件 | +| **输出** | 终端输出差异摘要 + 可选写入文件 | +| **关键参数** | `--source`:源结构文件(升级前) | +| | `--target`:目标结构文件(升级后) | +| | `--output`:差异报告输出文件(可选) | +| **比对维度** | 表级别:新增表、删除表、表名变更 | +| | 列级别:新增列、删除列、类型变更、默认值变更 | +| | 索引级别:新增索引、删除索引、索引列变更 | +| | 约束级别:外键、唯一约束变更 | + +> **注意**:`diff-schema` 是纯文件比对,**不需要连接数据库**,因此不需要 Connection Flags。 + +#### 4.2.7 `pack` — 打包交付物 + +| 属性 | 说明 | +|--------------|----------------------------------------------------------------------| +| **用途** | 将升级脚本、结构快照、验证报告等交付物打包为标准交付包 | +| **输出** | `/db-upgrade-pack___.tar.gz` | +| **关键参数** | `--project`:项目名称(必填) | +| | `--version`:本次升级版本号(必填) | +| | `--include-dirs`:需要打包的目录列表(默认包含 export/、migrations/、reports/) | +| | `--output-dir`:输出目录(默认: `./dist/`) | + +> **注意**:`pack` 是纯文件操作,**不需要连接数据库**,因此不需要 Connection Flags。 \ No newline at end of file diff --git a/24-版本升级标准流程/4-执行流程.md b/24-版本升级标准流程/4-执行流程.md new file mode 100644 index 0000000..579999f --- /dev/null +++ b/24-版本升级标准流程/4-执行流程.md @@ -0,0 +1,79 @@ +以下示例展示 Docker 运行方式下各命令的完整用法。假设宿主机当前工作目录为升级项目目录。 + +```bash +# ------------------------------------------------------- +# 定义镜像别名(可选,减少输入量) +# ------------------------------------------------------- +alias db-operator='docker run --rm -it \ + --network host \ + --user $(id -u):$(id -g) \ + -v $(pwd):/data \ + -e DB_OPERATOR_PASSWORD \ + harbor.wdd.io:8033/rmdc/db-operator:v1.2.0' + +# 执行数据库密码输入 +export DB_OPERATOR_PASSWORD=XXXXXX + +# ------------------------------------------------------- +# ① 导出现场数据库结构基线(多个库按顺序分别导出) +# ------------------------------------------------------- +db-operator export-structure \ + -H 192.168.1.100 -P 3306 -u root \ + --databases mydb_core,mydb_order \ + --output-dir ./export/ + +# 导出结果示例(文件名带 001/002 序号前缀,与 --databases 顺序一致): +# ./export/001_mydb_core_structure_.sql +# ./export/002_mydb_order_structure_.sql + +# ------------------------------------------------------- +# ② 导入结构基线到临时 MySQL(目录模式) +# ------------------------------------------------------- +db-operator import-structure \ + -H 127.0.0.1 -P 3306 -u root \ + --input ./export/ + +# 目录模式会按文件名自然序执行(001 -> 002 -> ...) + +# ------------------------------------------------------- +# ②-补充:单文件导入(仍保留) +# ------------------------------------------------------- +db-operator import-structure \ + -H 127.0.0.1 -P 3306 -u root \ + --input ./export/001_mydb_core_structure_.sql + +# ------------------------------------------------------- +# ③-a 重置数据库(--database 必须与 baseline SQL 内数据库名一致) +# ------------------------------------------------------- +db-operator reset-database \ + -H 127.0.0.1 -P 3306 -u root -d mydb_core \ + --baseline ./export/001_mydb_core_structure_.sql \ + --yes + +# ------------------------------------------------------- +# ③-b 执行增量升级 +# ------------------------------------------------------- +db-operator run-upgrade \ + -H 127.0.0.1 -P 3306 -u root -d mydb_core \ + --migration-dir ./migrations/ + +# ------------------------------------------------------- +# ③-c 验证升级 +# ------------------------------------------------------- +db-operator verify-upgrade \ + -H 127.0.0.1 -P 3306 -u root -d mydb_core \ + --baseline ./export/001_mydb_core_structure_.sql + +# ------------------------------------------------------- +# ④ 比对差异(纯文件操作,无需 --network host) +# ------------------------------------------------------- +db-operator diff-schema \ + --source ./export/001_mydb_core_structure_before.sql \ + --target ./export/001_mydb_core_structure_after.sql + +# ------------------------------------------------------- +# ⑤ 打包交付物 +# ------------------------------------------------------- +db-operator pack \ + --project myproject --version 2.3.1 +``` \ No newline at end of file diff --git a/25-统一网关rmdc-gateway/0-可研性说明.md b/25-统一网关rmdc-gateway/0-可研性说明.md new file mode 100644 index 0000000..e6890f0 --- /dev/null +++ b/25-统一网关rmdc-gateway/0-可研性说明.md @@ -0,0 +1,19 @@ + +## 背景 +1. 现在飞服没有自己的网关,向外暴露微服务通过NodePort 安全风险 +2. IngressNginx生命周期即将结束,无维护 安全风险 +3. 视频流媒体部分需要在NGINX进行配置 +4. 统一收纳不同地方的配置方式,现在分散在SpringGateway nodePort IngressNginx 外层Nginx等地方 + +## 基本要求 +1. 作为微服务网关 统一前端后端的暴露URI接口 /lite /api/convege/ +2. 替代IngressNginx 七层代理 +3. 替代NodePort实现对外暴露中心 四层代理 +4. 作为安全防火墙中心 白名单限制 + + +请你基于上面的要求,考虑下面的其他要求 +1. 需要兼容RKE RKE2创建的k8s集群 +2. 开源协议友好,成熟度高 + +按照符合上述背景和要求的项目进行排序,需要综合考虑符合要求的、成熟的、功能强大的、易用的项目 \ No newline at end of file diff --git a/26-统一日志中心rmdc-log-center/0-可研性说明.md b/26-统一日志中心rmdc-log-center/0-可研性说明.md new file mode 100644 index 0000000..e69de29 diff --git a/27-统一监控中心rmdc-monitor-center/0-可研性说明.md b/27-统一监控中心rmdc-monitor-center/0-可研性说明.md new file mode 100644 index 0000000..e69de29 diff --git a/28-登记保护-容器资源/0-prompt.md b/28-登记保护-容器资源/0-prompt.md new file mode 100644 index 0000000..d038540 --- /dev/null +++ b/28-登记保护-容器资源/0-prompt.md @@ -0,0 +1,11 @@ +你是一名精通kubernetes和docker容器技术的专家,同事是安全登记保护领域的专家 + +系统的相关信息如下 +我们的系统使用的是RKE部署的标准kubernetes1.30.14集群 +Ingress使用的是Ingress-Nginx +Docker使用的是1.24.11版本 +业务的暴露方式为Nginx-IngressNginx-Service +kuberntes的管理方式为kuberntes-dashboard和kubectl +监控采用mertirc-server的方式采集 + +请你参照 参考测评记录.docx的填写示例,使用简练、专业的语言,帮我完成Sheet1.CSV表格的填写,需要补充每一行中的 检测结果列 \ No newline at end of file diff --git a/30-特战队周报/1-背景介绍.md b/30-特战队周报/1-背景介绍.md new file mode 100644 index 0000000..3f072a3 --- /dev/null +++ b/30-特战队周报/1-背景介绍.md @@ -0,0 +1,33 @@ + +# 背景介绍 + +## 角色说明 +1. 1个多月前,你主动向部门领导主动申请成立了基础架构&交付部署特战队 +2. 你现在是特战队的代理组长,现在有两名组员。领导安排后续有额外的2名成员编制 + +## 主要职责 +1. 对内作为基础架构与运行环境维护团队 +2. 对外作为交付部署与项目生命周期维护团队 + + +## 小组工作职能矩阵 +| 考核指标 | 权重 | 考核主体 | 考核子类 | 考核内容说明 | 考核细项占比 | +| :--- | :--- | :--- | :--- | :--- | :--- | +| **项目交付部署** | 30% | 行业组 | 交付部署时效 | 1. 依据《技术交付时效承诺表》,统计季度内所有交付工单的按时完成率并计算得分。交付工单需由项目经理及区域军团负责人签字认定。按时完成率得分 = 按时完成交付项目数 / 交付项目数。
注:项目版本升级与项目部署一同参与排期,考核为执行时效。 | 40% | +| 项目交付部署 | 30% | 行业组 | 交付部署质量 | 部署完成后应该遵照最简冒烟测试的标准进行部署项目的功能验证工作,确保交付部署完成质量。 | 40% | +| 项目交付部署 | 30% | 行业组 | 交付部署完成度 | 根据填写的《交付部署配置信息表》,为行业组及研发同事提供项目部署的详细信息清单。 | 20% | +| **项目生命周期维护** | 30% | 行业组 | 项目故障排查 | 按照《故障等级响应准则》为故障评级,在规定时间内响应故障,排查定位问题。解决与基础架构相关的问题,协助给出其他问题责任人。 | 10% | +| 项目生命周期维护 | 30% | 行业组 | 持续交付部署 | 研发人员完成交付物构建及安全审查后,在规定时间内完成持续交付部署升级。 | 40% | +| 项目生命周期维护 | 30% | 行业组 | 项目维护工作 | 配合完成项目生命周期中的与基础架构相关的维护变更需求,包括 SSL 证书、域名变更,端口暴露等。 | 30% | +| 项目生命周期维护 | 30% | 行业组 | 项目版本升级 | 在规定时间内完成项目版本的升级工作。
注:项目版本升级与项目部署一同参与排期,考核为执行时效。 | 20% | +| **重点项目维保** | 10% | 产品组 | 重点项目 SRE | 针对重点项目(重大演示汇报、重要演示、重要验收等)环境保障期间运行稳定性进行考核打分。 | 40% | +| 重点项目维保 | 10% | 产品组 | 信创国产标准化 | 配合产品组完成中移凌云信创及国产标准化,负责基础架构(k8s, 中间件)的信创部署条件,协调提供信创的测试环境,协同研发组共同完成信创环境改造。 | 30% | +| 重点项目维保 | 10% | 产品组 | 交付部署标准化 | 持续完成交付部署的标准化工作,向产品组提供《中移凌云部署说明书》。 | 30% | +| **研发环境优化** | 10% | 研发组 | 研发环境维保 | 研发环境的重大故障修复,保障研发工作的顺利推进。 | 20% | +| 研发环境优化 | 10% | 研发组 | 项目验收环境 | 提供重要研发项目验收环境,包括计算、存储、网络资源申请、环境部署、公网端口暴露等,提供项目验收生命周期内的环境运行稳定性维护工作,持续交付部署工作,故障修复工作。 | 80% | +| **院内资源维护** | 10% | PMO 组 | 研发工具链维护 | 配合院内完成研发工具链的迁移、整改工作,保障研发工具链的使用。 | 50% | +| 院内资源维护 | 10% | PMO 组 | 院内服务器整改 | 配合院内要求完成所有服务器的信创迁移改造。 | 50% | +| **项目安全维护** | 5% | 安全组 | 部署安全合规 | 配合安全组输出针对交付部署的安全合规性要求的相关要求。 | 50% | +| 项目安全维护 | 5% | 安全组 | 项目安全合规 | 配合安全组完成基础组件(k8s, 中间件)漏洞修复工作。 | 50% | +| **其他工作** | 5% | PMO 组 | 其他工作 | 完成部门临时性、突发性任务(如协助撰写技术材料、临时资源调配等)。 | 100% | + diff --git a/30-特战队周报/2-报告要求说明.md b/30-特战队周报/2-报告要求说明.md new file mode 100644 index 0000000..953efa0 --- /dev/null +++ b/30-特战队周报/2-报告要求说明.md @@ -0,0 +1,30 @@ +# 报告要求说明 + +## 角色定位 +你是一位非常善于总结来自小组不同成员的工作内容,然后汇总为结构清晰,重点突出的工作周报或者是阶段性的总结报告,用词简洁、干练且专业,可以稍加口语化,语气不要过于机械化,不会创造不存在的工作内容,用于领导查阅。 + +## 初始数据 +1. 请严格按照我提供的初始工作内容简报进行总结 +2. 不要添加额外内容,不要创造不存在的工作内容 + +## 数据来源说明 +1. 不要读取历史的周报内容 +2. 每周或者阶段性总结的内容采用单独的目录进行保存 +3. + +## 报告内容模板 +1. 请按照小组工作职能矩阵的模块进行拆分 +2. 我提供给你的初始工作内容简报也会按照职能矩阵进行切分 +3. 需要明确包括 下一步工作计划 存在的问题模块 +4. 如果我提供了不在矩阵中的新的模块 需要在报告中展示这个模块 + + +## 格式要求 +1. 按照当前系统时间输出到特定的文件路径中 +2. 输出采用markdown格式 +3. 图文并茂,请给出图片占位符 +4. 如果涉及需要图片,请给出图片内容的中文描述后给出图片占位符即可,不要生成图片 + +## 约定 +1. 请不要读取图片内容,我会保证图片名称即为图片的含义,只需要读取图片名称即可 +2. 不要生成图片 \ No newline at end of file diff --git a/8-CMII-RMDC/1-rmdc-system/1-rmdc-PRD.md b/8-CMII-RMDC/1-rmdc-system/1-rmdc-PRD.md index 7efc510..c0aec79 100644 --- a/8-CMII-RMDC/1-rmdc-system/1-rmdc-PRD.md +++ b/8-CMII-RMDC/1-rmdc-system/1-rmdc-PRD.md @@ -1,224 +1,76 @@ -# RMDC 产品需求文档 (PRD) +` +` + +# RMDC (Runtime Management & DevOps Center) 产品需求文档 (PRD) **产品名称**: RMDC (Runtime Management & DevOps Center) -**版本**: v1.0 -**编制日期**: 2026-01-06 +**版本**: v2.0 +**编制日期**: 2026-03-28 +**编制人**: 王子文 +**修改原因**: 重新规划RMDC系统的总体设计方案 --- -## 1. 产品背景 +# 一、RMDC重大修改点 +1. RMDC系统面向的人员技术水平较低,不适合采用全部自建的页面,登录就是极大的困难 +2. RMDC系统现在缺少开发人员,借用现有的成熟的平台,可以快速的实现功能 +3. RMDC应该解决的是在能力范围内解决团队核心的问题,而不是纯粹的技术炫耀 -### 1.1 业务背景 +## 1.1 新增的关键模块 +1. rmdc-feishu-operator + 1. 借助飞书SDK,实现飞书和RMDC之间的交互 + 2. 借助飞书的角色和权限系统 + 3. 借用飞书的项目管理和进度追踪功能 + 4. 借助飞书的机器人功能,实现通知能力 + 5. 借助飞书的审批功能,实现工单能力 +2. rmdc-delivery-material + 1. 解决交付物标准化的问题 + 2. 解决交付物落地的问题 + 3. 解决交付物管理的问题 -在复杂的混合云/边缘计算环境中,运维团队面临以下挑战: -- **网络隔离**: 多个项目部署在不同网络环境(内网、边缘、公网) -- **权限分散**: Jenkins、K8S、主机等资源权限管理分散 -- **状态不可见**: 无法统一查看各项目的运行状态 -- **操作复杂**: 跨网络的操作需要繁琐的VPN/跳板机流程 +## 1.2 移除的模块 +1. rmdc-work-procedure + 1. 移除工单系统,实现极为复杂繁琐 + 2. 借助飞书的能力实现工单能力 +2. rmdc-notice-center + 1. 移除通知中心,实现极为复杂繁琐 + 2. 借助飞书的能力实现通知能力 -### 1.2 痛点总结 +## 1.3 优化的模块 +1. rmdc-continuous-integration + 1. 将原本的rmdc-jenkins-dac模块重命名 + 2. 模块的定义不变,解决的是研发人员从代码到交付物的标准化问题 +2. rmdc-user-auth + 1. 去除行业组、产品组、安全组等非技术人员的登录管理 + 2. 简化权限管理,只保留技术人员的权限管理 +3. rmdc-project-management + 1. 简化项目管理模块的实现逻辑 +4. rmdc-continuous-delivery + 1. 简化持续交付部署模块的实现逻辑 +5. 前端内容 + 1. 去除工单系统相关的前端页面 + 2. 去除项目管理相关的前端页面 + 3. 去除用户管理、通信录相关的前端页面 -| 痛点 | 当前方案 | 问题 | -|------|----------|------| -| 跨网络访问 | VPN + 跳板机 | 效率低,依赖人工 | -| 分支权限管理 | Jenkins原生 | 粒度粗,无法精细控制 | -| 项目状态监控 | 分散的监控系统 | 无统一视图 | -| 自动化部署 | 手动脚本 | 可靠性差,无审计 | +# 二、RMDC系统架构及功能层级 ---- +1. 借助飞书实现面向非技术人员的RMDC系统的前端页面,借助飞书平台的项目管理、工单、通知等能力简化RMDC系统的设计,借助飞书SDK实现RMDC和飞书之间的交互(rmdc-feishu-operator). +2. RMDC系统面向整个研发交付部署流程,以项目管理(rmdc-project-management)为核心锚点.主要解决的是研发人员从代码到交付物的标准化(rmdc-continuous-integration),从交付物到部署落地的标准化(rmdc-delivery-material),交付部署的标准化(rmdc-watchdog-node),持续交付部署的标准化(rmdc-continuous-delivery),覆盖整个生命周期. +3. 借助章鱼Octopus的设计理念,RMDC系统是一个中心平台+边缘项目节点的设计理念,中心平台包括项目管理(rmdc-project-management),云边协同消息中心(rmdc-exchange-hub),边缘项目节点由边缘控制中心(rmdc-wathchdog),边缘微服务代理(rmdc-watchdog-agent),边缘主机代理(rmdc-watchdog-node)共同组成.配合边缘监控中心(rmdc-monitor-center),实现对边缘节点运行状态的监控和管理. -## 2. 产品定位 +## 2.1 核心架构 -RMDC是**以项目(K8s Namespace)为核心维度**的统一运维与交付平台,通过"边缘代理 + 消息总线"架构打通网络边界,提供: +### 飞书协同架构 +1. 广义上说,飞书是整个项目的入口,RMDC系统的暴露面即为飞书 +2. rmdc-feishu-operator是连接飞书和RMDC之间的桥梁,实现飞书和RMDC之间的交互,飞书作为整个项目面向非技术人员的入口,提供项目管理,工单,通知等能力 +3. 用户提交信息,经过飞书的审批流程,审批通过后,rmdc-feishu-operator将信息传递给RMDC系统,RMDC系统将信息传递给项目管理模块,项目管理模块将信息传递给持续交付部署模块,持续交付部署模块将信息传递给边缘控制中心,边缘控制中心将信息传递给边缘微服务代理,边缘微服务代理将信息传递给边缘主机代理,边缘主机代理将信息传递给边缘监控中心,从而实现用户从飞书提交信息到边缘节点运行状态的监控和管理的全流程 -- **统一入口**: 一个平台管理所有项目 -- **精细权限**: 分支级别的构建权限控制 -- **实时可见**: 项目状态、构建进度、监控数据统一展示 -- **全程审计**: 所有操作可追溯 +### 云边协同架构 +1. rmdc-projetc-mangement作为核心的平台 +2. rmdc-exchange-hub作为云边协同消息中心,承担着命令下发和消息上传的通路,是云边协同架构的核心 +3. rmdc-wathchdog作为边缘控制中心 +4. rmdc-watchdog-agent作为边缘微服务代理 +5. rmdc-watchdog-node作为边缘主机代理 +6. rmdc-monitor-center作为边缘监控中心 +7. rmdc-continuous-delivery作为持续交付部署组件,借助上面的项目管理,借助命令下发和消息上传的通路(rmdc-exchange-hub),借助rmdc-watchdog模块的Operator能力,实现持续交付部署的标准化可观测化 ---- - -## 3. 目标用户 - -| 用户角色 | 关键诉求 | -|----------|----------| -| **超级管理员(SuperAdmin)** | 管理所有项目、用户、权限 | -| **管理员(Admin)** | 管理负责的项目,分配权限给普通用户 | -| **普通人员(Normal)** | 查看项目信息,触发被授权的构建 | -| **第三方人员(Third)** | 有限度地查看被授权的内容 | - ---- - -## 4. 功能范围 - -### 4.1 核心功能模块 - -```mermaid -mindmap - root((RMDC)) - Jenkins模块 - 组织/仓库/分支管理 - 分支级权限控制(DAC) - 构建触发与追踪 - 镜像打包(DCU) - 项目管理模块 - 项目信息CRUD - 部署信息管理 - 授权管理(一级) - 消息网关模块 - MQTT消息中继 - 指令生命周期 - 同步/异步指令 - 边缘代理模块 - K8S操作代理 - 主机操作代理 - 二级授权管理 - 监控日志模块 - 实时日志查看 - 监控数据采集 - 告警通知 - 用户权限模块 - 用户管理 - 角色管理 - 权限分配 - 审计模块 - 操作审计 - 日志查询 - 导出功能 -``` - -### 4.2 第一期功能(MVP) - -| 模块 | 功能 | 优先级 | -|------|------|--------| -| Jenkins | 组织/仓库/分支查询 | P0 | -| Jenkins | 构建触发与状态追踪 | P0 | -| Jenkins | 分支级权限控制 | P0 | -| 项目管理 | 项目信息CRUD | P0 | -| 项目管理 | 授权密钥生成 | P0 | -| 用户权限 | RBAC权限管理 | P0 | -| 审计 | 基础操作审计 | P1 | -| DCU | 镜像下载压缩上传 | P1 | - -### 4.3 第二期功能 - -| 模块 | 功能 | 优先级 | -|------|------|--------| -| 消息网关 | MQTT消息中继 | P0 | -| 消息网关 | 指令生命周期管理 | P0 | -| 边缘代理 | K8S操作代理 | P0 | -| 边缘代理 | 主机操作代理 | P1 | -| 监控日志 | 实时日志查看 | P1 | -| 监控日志 | 监控数据展示 | P2 | - ---- - -## 5. 用户故事 - -### 5.1 Jenkins构建 - -**作为** 开发人员 -**我需要** 在RMDC平台触发指定分支的构建 -**以便于** 快速验证代码变更,无需登录Jenkins - -**验收标准**: -- [ ] 能够查看被授权的分支列表 -- [ ] 能够触发分支构建 -- [ ] 能够查看构建进度和结果 -- [ ] 能够查看构建日志 - -### 5.2 权限管理 - -**作为** 管理员 -**我需要** 为团队成员分配分支级构建权限 -**以便于** 确保只有授权人员能够构建特定分支 - -**验收标准**: -- [ ] 能够按组织/仓库/分支粒度分配权限 -- [ ] 权限支持继承(组织→仓库→分支) -- [ ] 能够一键复制其他用户的权限 - -### 5.3 项目管理 - -**作为** 超级管理员 -**我需要** 创建和管理项目信息 -**以便于** 统一维护各项目的基本信息和授权配置 - -**验收标准**: -- [ ] 能够创建项目并录入基本信息 -- [ ] 能够管理项目的部署信息和中间件配置 -- [ ] 能够生成项目授权密钥 -- [ ] 能够导出项目信息 - ---- - -## 6. 非功能性需求 - -### 6.1 性能要求 - -| 指标 | 要求 | -|------|------| -| API响应时间 | P90 < 300ms | -| 构建状态同步延迟 | < 15s | -| MQTT消息传输延迟 | < 5s | -| 系统可用性 | 99.9% | - -### 6.2 安全要求 - -| 类别 | 要求 | -|------|------| -| 认证 | JWT Token,有效期可配置 | -| 授权 | RBAC + 资源级ACL | -| 传输 | HTTPS/TLS加密 | -| 存储 | 敏感字段AES-256加密 | -| 审计 | 所有写操作记录审计日志 | - -### 6.3 兼容性 - -- **前端**: Chrome 80+, Edge 80+, Firefox 75+ -- **后端**: Go 1.21+ -- **数据库**: PostgreSQL 13+ - ---- - -## 7. 系统边界 - -### 7.1 与外部系统的关系 - -| 外部系统 | 交互方式 | 说明 | -|----------|----------|------| -| Jenkins | REST API | 构建管理、状态同步 | -| MinIO | S3 API | 镜像包存储 | -| MQTT Broker | MQTT协议 | 消息中继 | -| K8S | K8S API | 容器编排 | - -### 7.2 不在范围内 - -- 源代码管理(由GitLab/GitHub负责) -- CI/CD编排逻辑(由Jenkins Pipeline负责) -- 容器镜像仓库(由Harbor负责) -- 基础设施管理(由IaaS平台负责) - ---- - -## 8. 约束和假设 - -### 8.1 约束 - -1. 必须兼容现有Jenkins配置,不修改Jenkinsfile -2. 边缘项目通过公网MQTT通信,需考虑弱网环境 -3. 授权密钥离线部署,不通过网络传输 - -### 8.2 假设 - -1. 所有边缘项目均部署在K8S环境 -2. 各项目有独立的K8S Namespace -3. MQTT Broker可从公网访问 - ---- - -## 9. 版本历史 - -| 版本 | 日期 | 修改内容 | -|------|------|----------| -| v1.0 | 2026-01-06 | 初始版本 | diff --git a/8-CMII-RMDC/1-rmdc-system/1.1-rmdc-架构图.md b/8-CMII-RMDC/1-rmdc-system/1.1-rmdc-架构图.md new file mode 100644 index 0000000..e700686 --- /dev/null +++ b/8-CMII-RMDC/1-rmdc-system/1.1-rmdc-架构图.md @@ -0,0 +1,73 @@ +```mermaid +graph TD +%% 样式定义 + classDef feishu fill:#e6f2ff,stroke:#007bff,stroke-width:2px; + classDef cloud fill:#f9f9f9,stroke:#333,stroke-width:2px; + classDef edge fill:#fff3e6,stroke:#ff9900,stroke-width:2px; + classDef storage fill:#e6ffe6,stroke:#28a745,stroke-width:2px; + + subgraph UserLayer ["交互与入口层 (依赖飞书生态)"] + FS_App["飞书工作台 / 小程序"] + FS_Approval["飞书审批流 / 工单"] + FS_Bot["飞书机器人通知"] + end + class FS_App,FS_Approval,FS_Bot feishu; + + subgraph Source ["外部依赖源"] + GitRepos["代码仓库 GitLab/GitHub"] + end + + subgraph CloudLayer ["中心控制面 (RMDC Cloud)"] + FeishuOp["rmdc-feishu-operator
飞书交互桥梁"] + UserAuth["rmdc-user-auth
技术人员鉴权"] + + PM["rmdc-project-management
项目管理核心"] + + CI["rmdc-continuous-integration
标准化构建"] + Material["rmdc-delivery-material
交付物管理"] + CD["rmdc-continuous-delivery
持续交付部署"] + + Hub(("rmdc-exchange-hub
云边协同消息中心")) + + DB[("核心数据库
元数据/状态")] + Registry[("制品库
镜像/包/配置")] + end + class FeishuOp,UserAuth,PM,CI,Material,CD,Hub cloud; + class DB,Registry storage; + + subgraph EdgeLayer ["边缘执行面 (RMDC Edge)"] + Watchdog["rmdc-watchdog
边缘控制中心"] + Agent["rmdc-watchdog-agent
微服务代理"] + Node["rmdc-watchdog-node
主机代理"] + Monitor["rmdc-monitor-center
边缘监控中心"] + end + class Watchdog,Agent,Node,Monitor edge; + +%% 交互链路定义 + FS_Approval -- "审批结果/指令" --> FeishuOp + FeishuOp -- "推送通知/状态回传" --> FS_Bot + FeishuOp <-->|"信息交换"| PM + UserAuth -.->|"技术人员底层权限管理"| PM + + GitRepos -- "Webhook 触发构建" --> CI + PM -->|"调度集成"| CI + CI -->|"生成标准化产物"| Material + Material -->|"存储制品"| Registry + + PM -->|"调度部署"| CD + CD -->|"获取产物信息"| Material + CD -->|"下发部署/管控指令"| Hub + + PM <-.-> DB + CD <-.-> DB + + Hub ===|"下发管控命令"| Watchdog + Watchdog ===|"上报边缘状态/心跳"| Hub + Hub -.->|"回传状态以供通知"| FeishuOp + + Watchdog -->|"管控微服务"| Agent + Watchdog -->|"管控主机"| Node + Agent -.->|"微服务运行指标"| Monitor + Node -.->|"主机基础指标"| Monitor + Monitor -.->|"汇聚监控告警数据"| Watchdog +``` \ No newline at end of file diff --git a/8-CMII-RMDC/1-rmdc-system/old/1-rmdc-PRD.md b/8-CMII-RMDC/1-rmdc-system/old/1-rmdc-PRD.md new file mode 100644 index 0000000..7efc510 --- /dev/null +++ b/8-CMII-RMDC/1-rmdc-system/old/1-rmdc-PRD.md @@ -0,0 +1,224 @@ +# RMDC 产品需求文档 (PRD) + +**产品名称**: RMDC (Runtime Management & DevOps Center) +**版本**: v1.0 +**编制日期**: 2026-01-06 + +--- + +## 1. 产品背景 + +### 1.1 业务背景 + +在复杂的混合云/边缘计算环境中,运维团队面临以下挑战: +- **网络隔离**: 多个项目部署在不同网络环境(内网、边缘、公网) +- **权限分散**: Jenkins、K8S、主机等资源权限管理分散 +- **状态不可见**: 无法统一查看各项目的运行状态 +- **操作复杂**: 跨网络的操作需要繁琐的VPN/跳板机流程 + +### 1.2 痛点总结 + +| 痛点 | 当前方案 | 问题 | +|------|----------|------| +| 跨网络访问 | VPN + 跳板机 | 效率低,依赖人工 | +| 分支权限管理 | Jenkins原生 | 粒度粗,无法精细控制 | +| 项目状态监控 | 分散的监控系统 | 无统一视图 | +| 自动化部署 | 手动脚本 | 可靠性差,无审计 | + +--- + +## 2. 产品定位 + +RMDC是**以项目(K8s Namespace)为核心维度**的统一运维与交付平台,通过"边缘代理 + 消息总线"架构打通网络边界,提供: + +- **统一入口**: 一个平台管理所有项目 +- **精细权限**: 分支级别的构建权限控制 +- **实时可见**: 项目状态、构建进度、监控数据统一展示 +- **全程审计**: 所有操作可追溯 + +--- + +## 3. 目标用户 + +| 用户角色 | 关键诉求 | +|----------|----------| +| **超级管理员(SuperAdmin)** | 管理所有项目、用户、权限 | +| **管理员(Admin)** | 管理负责的项目,分配权限给普通用户 | +| **普通人员(Normal)** | 查看项目信息,触发被授权的构建 | +| **第三方人员(Third)** | 有限度地查看被授权的内容 | + +--- + +## 4. 功能范围 + +### 4.1 核心功能模块 + +```mermaid +mindmap + root((RMDC)) + Jenkins模块 + 组织/仓库/分支管理 + 分支级权限控制(DAC) + 构建触发与追踪 + 镜像打包(DCU) + 项目管理模块 + 项目信息CRUD + 部署信息管理 + 授权管理(一级) + 消息网关模块 + MQTT消息中继 + 指令生命周期 + 同步/异步指令 + 边缘代理模块 + K8S操作代理 + 主机操作代理 + 二级授权管理 + 监控日志模块 + 实时日志查看 + 监控数据采集 + 告警通知 + 用户权限模块 + 用户管理 + 角色管理 + 权限分配 + 审计模块 + 操作审计 + 日志查询 + 导出功能 +``` + +### 4.2 第一期功能(MVP) + +| 模块 | 功能 | 优先级 | +|------|------|--------| +| Jenkins | 组织/仓库/分支查询 | P0 | +| Jenkins | 构建触发与状态追踪 | P0 | +| Jenkins | 分支级权限控制 | P0 | +| 项目管理 | 项目信息CRUD | P0 | +| 项目管理 | 授权密钥生成 | P0 | +| 用户权限 | RBAC权限管理 | P0 | +| 审计 | 基础操作审计 | P1 | +| DCU | 镜像下载压缩上传 | P1 | + +### 4.3 第二期功能 + +| 模块 | 功能 | 优先级 | +|------|------|--------| +| 消息网关 | MQTT消息中继 | P0 | +| 消息网关 | 指令生命周期管理 | P0 | +| 边缘代理 | K8S操作代理 | P0 | +| 边缘代理 | 主机操作代理 | P1 | +| 监控日志 | 实时日志查看 | P1 | +| 监控日志 | 监控数据展示 | P2 | + +--- + +## 5. 用户故事 + +### 5.1 Jenkins构建 + +**作为** 开发人员 +**我需要** 在RMDC平台触发指定分支的构建 +**以便于** 快速验证代码变更,无需登录Jenkins + +**验收标准**: +- [ ] 能够查看被授权的分支列表 +- [ ] 能够触发分支构建 +- [ ] 能够查看构建进度和结果 +- [ ] 能够查看构建日志 + +### 5.2 权限管理 + +**作为** 管理员 +**我需要** 为团队成员分配分支级构建权限 +**以便于** 确保只有授权人员能够构建特定分支 + +**验收标准**: +- [ ] 能够按组织/仓库/分支粒度分配权限 +- [ ] 权限支持继承(组织→仓库→分支) +- [ ] 能够一键复制其他用户的权限 + +### 5.3 项目管理 + +**作为** 超级管理员 +**我需要** 创建和管理项目信息 +**以便于** 统一维护各项目的基本信息和授权配置 + +**验收标准**: +- [ ] 能够创建项目并录入基本信息 +- [ ] 能够管理项目的部署信息和中间件配置 +- [ ] 能够生成项目授权密钥 +- [ ] 能够导出项目信息 + +--- + +## 6. 非功能性需求 + +### 6.1 性能要求 + +| 指标 | 要求 | +|------|------| +| API响应时间 | P90 < 300ms | +| 构建状态同步延迟 | < 15s | +| MQTT消息传输延迟 | < 5s | +| 系统可用性 | 99.9% | + +### 6.2 安全要求 + +| 类别 | 要求 | +|------|------| +| 认证 | JWT Token,有效期可配置 | +| 授权 | RBAC + 资源级ACL | +| 传输 | HTTPS/TLS加密 | +| 存储 | 敏感字段AES-256加密 | +| 审计 | 所有写操作记录审计日志 | + +### 6.3 兼容性 + +- **前端**: Chrome 80+, Edge 80+, Firefox 75+ +- **后端**: Go 1.21+ +- **数据库**: PostgreSQL 13+ + +--- + +## 7. 系统边界 + +### 7.1 与外部系统的关系 + +| 外部系统 | 交互方式 | 说明 | +|----------|----------|------| +| Jenkins | REST API | 构建管理、状态同步 | +| MinIO | S3 API | 镜像包存储 | +| MQTT Broker | MQTT协议 | 消息中继 | +| K8S | K8S API | 容器编排 | + +### 7.2 不在范围内 + +- 源代码管理(由GitLab/GitHub负责) +- CI/CD编排逻辑(由Jenkins Pipeline负责) +- 容器镜像仓库(由Harbor负责) +- 基础设施管理(由IaaS平台负责) + +--- + +## 8. 约束和假设 + +### 8.1 约束 + +1. 必须兼容现有Jenkins配置,不修改Jenkinsfile +2. 边缘项目通过公网MQTT通信,需考虑弱网环境 +3. 授权密钥离线部署,不通过网络传输 + +### 8.2 假设 + +1. 所有边缘项目均部署在K8S环境 +2. 各项目有独立的K8S Namespace +3. MQTT Broker可从公网访问 + +--- + +## 9. 版本历史 + +| 版本 | 日期 | 修改内容 | +|------|------|----------| +| v1.0 | 2026-01-06 | 初始版本 | diff --git a/8-CMII-RMDC/1-rmdc-system/1-system-overview-prompt.md b/8-CMII-RMDC/1-rmdc-system/old/1-system-overview-prompt.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/1-system-overview-prompt.md rename to 8-CMII-RMDC/1-rmdc-system/old/1-system-overview-prompt.md diff --git a/8-CMII-RMDC/1-rmdc-system/2-module-interaction-prompt.md b/8-CMII-RMDC/1-rmdc-system/old/2-module-interaction-prompt.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/2-module-interaction-prompt.md rename to 8-CMII-RMDC/1-rmdc-system/old/2-module-interaction-prompt.md diff --git a/8-CMII-RMDC/1-rmdc-system/2-rmdc-DDS.md b/8-CMII-RMDC/1-rmdc-system/old/2-rmdc-DDS.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/2-rmdc-DDS.md rename to 8-CMII-RMDC/1-rmdc-system/old/2-rmdc-DDS.md diff --git a/8-CMII-RMDC/1-rmdc-system/3-rmdc-系统设计图.md b/8-CMII-RMDC/1-rmdc-system/old/3-rmdc-系统设计图.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/3-rmdc-系统设计图.md rename to 8-CMII-RMDC/1-rmdc-system/old/3-rmdc-系统设计图.md diff --git a/8-CMII-RMDC/1-rmdc-system/4-审计日志架构设计.md b/8-CMII-RMDC/1-rmdc-system/old/4-审计日志架构设计.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/4-审计日志架构设计.md rename to 8-CMII-RMDC/1-rmdc-system/old/4-审计日志架构设计.md diff --git a/8-CMII-RMDC/1-rmdc-system/login-api-specification.md b/8-CMII-RMDC/1-rmdc-system/old/login-api-specification.md similarity index 100% rename from 8-CMII-RMDC/1-rmdc-system/login-api-specification.md rename to 8-CMII-RMDC/1-rmdc-system/old/login-api-specification.md diff --git a/98-AgentSkills/1-AgentSkills综述.md b/98-AgentSkills指南/1-AgentSkills综述.md similarity index 100% rename from 98-AgentSkills/1-AgentSkills综述.md rename to 98-AgentSkills指南/1-AgentSkills综述.md diff --git a/98-AgentSkills/2-prompt-for-prompt.md b/98-AgentSkills指南/2-prompt-for-prompt.md similarity index 100% rename from 98-AgentSkills/2-prompt-for-prompt.md rename to 98-AgentSkills指南/2-prompt-for-prompt.md diff --git a/98-AgentSkills指南/2026年3月31日-开发工具对比.md b/98-AgentSkills指南/2026年3月31日-开发工具对比.md new file mode 100644 index 0000000..094fa49 --- /dev/null +++ b/98-AgentSkills指南/2026年3月31日-开发工具对比.md @@ -0,0 +1,175 @@ +# 主流AI编程工具对比 + +综合对比目前(2026 年 3 月左右)主流 20 美元档工具:**从“能持续帮你写代码/跑 Agent 的总时长”和体感流畅度看,性价比大致是:Cursor Pro > ChatGPT Plus(Codex)≈ Claude Pro(看重质量时偏向 Claude)> Google AI Pro(Gemini Apps + Code Assist)> AWS Kiro Pro。** + +下面按你关心的点拆开说,重点放在 Codex vs Claude Code 的用量水平,并解释为什么你会觉得 Google 的用量已经“不能正常 Agent 编程”。 + +*** + +## 一句话概览各家 20 美元套餐 + +- **Cursor Pro(20 美元/月)**: + 无限补全 + 无限 Auto 模式,外加每月约等价 20 美元的前沿模型 Credit;只要主力是补全 + 轻中度 Agent,性价比非常高,重度长时间 Agent 会较快耗尽 Credit。 +- **ChatGPT Plus(含 Codex,20 美元/月)**: + 通用 GPT‑4/5 模型 + Codex Agent/CLI/IDE;5 小时滚动窗口内 Codex 本地消息大约 30–150 条级别,重度使用时单个窗口能支撑 1.5–2 小时高强度 Agent 编程;可以额外买 Credits 扩容。 +- **Claude Pro + Claude Code(20 美元/月)**: + 5 小时滚动窗口 + 周配额;大致 45 条 Sonnet 消息/5 小时,对应 10–40 次 Claude Code 提示/5 小时;单次深度理解/重构体验很好,但连续跑 Agent 很容易顶配额,需要 Max 5×/20× 才适合全天候 Agent。 +- **Google AI Pro(Gemini Advanced + Gemini Code Assist,约 20 美元/月)**: + Gemini Apps 侧大致 300(Thinking)+100(Pro)条 prompt/天;Code Assist 侧 1M token 上下文 + 1500 请求/天,但一次 Agent 任务会拆成多次请求,重度 Agent 的体感“扣得很快”,所以你会觉得用量明显不够用。 +- **AWS Kiro Pro(约 20 美元/月)**: + 新版定价只有 225 vibe + 125 spec 请求/月,且额外 spec 要 0.20 美元/次;对个人重度编码者来说远远不够,整体成本会飙到远高于 20 美元档,基本不适合作为主力工具。 + +*** + +## 重点一:Codex(基于 ChatGPT Plus)的用量水平 + +**计费模型**: +Codex 现在是 ChatGPT 付费计划里的一个“软件工程 Agent 套件”,不需要单独买 Codex 订阅:Plus/Pro/Business/Enterprise 都内含 Codex Web、CLI 和 IDE 扩展。 + +**限制大致有三层**: + +1. **5 小时滚动窗口** + - 官方 Codex FAQ 给的区间:Plus 用户在 5 小时时段内,大概可以发 **33–168 条 Codex 本地消息**,具体取决于模型、速度和任务复杂度。 + - 另一篇定价解析给出的量级类似:**30–150 条本地消息或 5–40 个云端 Codex 任务/5 小时**(云任务就是你在 Web 上丢给 Codex 跑 1–30 分钟的一整段 Agent 工作)。 +2. **周配额** + - OpenAI 没公开精确数字,但实践中不少人冲刺几天后会出现“多天冷却期”提示,需要等周配额刷新或额外买 Credits。 +3. **模型/速度权重** + - 用越贵的模型(例如更高版本 GPT‑5 Codex)或开更高速度,单消息消耗的 Credit 越大,同样 5 小时窗口可用的“条数”就越少。 + +**体感可以坚持多久?** + +根据 CLI 订阅解析和用户反馈: + +- 如果你持续、高频地让 Codex 重构、跑测试、多文件修改,**一个 5 小时窗口里大概能有 1.5–2 小时的“全程高强度 Codex 时间”**,之后就会被限流到下个时间窗。 +- 合理拆分成上午/下午/晚上几个高强度时段,一天里 Codex 能“认真帮你干活”的时间大致 3–5 小时;如果天天这么干,周配额有机会被打满。 +- 对“中度使用”(大量补全 + 少量重型 Agent),Plus 的 Codex 容量通常够用,同时还能拿 ChatGPT 做文档、解释、调试分析等通用任务,这一块性价比相对 Claude Pro 略占优。 + +*** + +## 重点二:Claude Code(基于 Claude Pro)的用量水平 + +**统一用量桶**: +Claude Pro 20 美元/月,年付折算约 17 美元;Claude Web 与 Claude Code 共用同一个 Pro 用量桶(5 小时滚动窗口 + 周配额)。 + +**总体消息容量**: + +- 官方 usage 文章:若对话不太长、文件也不是特别大,**Pro 用户 5 小时里大概能发 45 条 Sonnet 消息**,比免费版大约多 5 倍。 +- 按照 5 小时滚动窗口换算,一天分散使用可以达到 **200–216 条短消息**,前提是你不是一直扔巨型 PDF 和长对话。 +- Pro 的总量大约是 Free 的 5 倍;再往上是 Max 5×(100 美元)和 Max 20×(200 美元),分别在容量上乘 5 和乘 20,用于重度工程/Agent 场景。 + +**Claude Code 专用的经验配额**: + +- Anthropic 的说明和 issues 里都强调,**Claude Code 的提示数量比纯聊天少得多**:Pro 级别在 5 小时里大致 **10–40 次 Claude Code 提示**,仓库越大、终端和自动接受用得越多,能用的提示越少。 +- 社区制作的 usage 计数器和经验贴普遍说法是:**中大型项目里连续“认真干活”1.5–2 小时,就会摸到 5 小时上限**,尤其你让 Claude Code 不断自动应用补丁、多次遍历仓库时。 + +**短促促销不改变长期结构**: +2026 年 3 月确实有一个“非高峰时段翻倍用量”的促销活动(Free/Pro/Max 都翻倍),但只持续到 3 月下旬,对“长期 20 美元性价比”不能当作常态指标。 + +*** + +## Codex vs Claude Code:谁更值 20 美元? + +站在你这种“Agent 编程 + 整仓重构”的开发者视角,可以用三个维度看:**纯容量、体验质量、扩容路径。** + +### 1. 纯容量与可持续时长 + +并列比较(都是 20 美元级): + +- **Codex / ChatGPT Plus** + - 5 小时里约 30–150 条 Codex 本地消息(具体看复杂度)。 + - 高强度 Agent 使用约 1.5–2 小时就会触顶一个窗口,但一天拆成几段可以拿到 3–5 小时高强度协作时间。 +- **Claude Code / Claude Pro** + - 5 小时里约 10–40 次 Claude Code 提示,外加大约 45 条普通 Sonnet 消息。 + - 中重度 Agent 使用下,同样 1.5–2 小时左右就会被卡住,但因为 Code 提示本身更“贵”,你会更快体感到紧张。 + +换算下来: +**在相同 20 美元价位上,Codex 整体可用的“提示数”和高强度可持续时长,略优于 Claude Code**——尤其当你并不是把全部额度都拿来跑重型 Agent,而是混合 Chat、解释、文档生成时,这个差距会更明显。 + +### 2. 交互/推理体验质量 + +- **Claude Code** 在理解长代码、给重构建议、自然语言解释设计决策等方面口碑非常好,很多人拿它做“虚拟架构师”。 +- **Codex** 依托 GPT‑5.x/4.x,在实现能力和联想能力上也不弱,但整体偏“执行很猛”,尤其适合具体实现和迭代,而不是系统性长文档讨论(当然它也能做,只是风格不同)。 + +如果你经常让模型帮你“想设计 + 给路线 + 再自己实现”,Claude Code 会让你感觉“单次价值高”; +如果你更希望模型**多跑几次、不断试错/迭代**,Codex 的容量会显得更友好。 + +### 3. 扩容路径与成本 + +- **Codex**:可以在 Plus 基础上单独购买额外 ChatGPT/Codex Credits,或者升级到 Pro 200 美元/月;也可以在 IDE 里切到 API Key,直接按 token 计费,这样不吃 Plus 配额。 +- **Claude Code**:当前主要是升级到 Max 5×/20× 或转到 Claude API;等级跃迁是 20→100→200 美元,缺少中间小步扩容,对个人开发者会比较痛。 + +**结论**: + +- 如果你核心诉求是“**尽可能多地跑 Agent/多迭代几轮**”,在 20 美元档里,**Codex(ChatGPT Plus)比 Claude Code 更抗造一点**。 +- 如果你更在意“**每次对话质量、解释深度、架构建议质量**”,可以接受每天只用 Claude Code 解决 1–2 个关键问题,那么 Claude Pro 仍然非常有价值。 + +*** + +## Google:为什么你体感“已经没法 Agent 编程” + +Google 这边要分两套看:**Gemini Apps(网页/移动)** 与 **Gemini Code Assist(IDE/CLI)**。 + +### Gemini Apps / AI Pro + +- 早期官方写法:AI Pro 订阅每天约 **100 条 Pro 模型 prompts**,免费用户每天只有 5 条 Pro prompt,Context 32K vs 1M。 +- 2026 年 1 月起,Google 调整 Gemini 3 的限额为**分模型计数**: + - AI Pro:**300 条 Thinking prompts/天 + 100 条 Pro prompts/天**。 + - Ultra:1500 + 500 条/天。 + +对**普通聊天/问答**来说,这个量已经不算少; +但对**Agent 编程**来说,一次复杂任务常常要十几二十轮交互,而且你还会顺手拿它查文档、改提示、生成说明书……于是**很容易在一天中段就冲到 300+100 的上限**,体感自然是“完全不够用”。 + +### Gemini Code Assist / Code Agent + +Code Assist 官方配额: + +- **上下文窗口**:本地代码感知最长可达 **1,000,000 token**,这一点确实在“整仓理解”上很强。 +- **日请求数**: + - 通过 Google AI Pro 使用 Code Assist:**1500 次请求/用户/天**。 + - 免费个人版:1000 次/天;Enterprise:2000 次/天。 + +问题在于: +官方文档明确说,**Agent 模式 或 Gemini CLI 下,一个高级任务会被拆成多次底层请求**——比如你只点了一次“修这个包”,后台可能发出几十到上百次接口调用;**所以 1500 次请求对重度 Agent 来说,远没有纸面上看起来那么宽裕。** + +结合你的感受,可以合理推断: + +- 你如果主要用 **Apps(网页端)+ Pro 模型** 跑 Agent,日常经常撞 100 或 300+100 上限,自然觉得“不能用来做严肃代码”。 +- 即便切到 Code Assist,**1500 请求/天** 在复杂 Agent 链路下也会被快速吃光,尤其你连续多天冲刺时,所以整体体验明显不如当初刚出 Gemini 2.x 时宽松。 + +*** + +## Cursor 与 Kiro:两端极端的例子 + +### Cursor Pro:20 美元档相对最划算的“写码主场” + +- 无限补全 + 无限 Auto 模式,不吃 Credit,是 Cursor 性价比的核心。 +- 每月 20 美元的高级模型 Credit,哪怕被几次大型 Agent 用完,你的**基础补全和轻量 Chat 仍然是无限可用**,不会像 Claude/Google 一样整套功能被硬性卡住。 +- 只要你把真正极重的任务分摊到 Codex/Claude/Gemini,而让 Cursor 主打补全 + 中小型重构,它在 20 美元档的“日常可用时间”几乎是最好的。 + + +### AWS Kiro Pro:价格结构基本劝退个人 + +- 新版定价:Pro 20 美元/月只给 **225 vibe + 125 spec 请求**,多一条 spec 要 0.20 美元;对照一些开发者的测算,哪怕只是“轻度编码”,每月也要 3000 spec 左右,成本一下子涨到 500 多美元/月,全职编码甚至预估近 2000 美元/月。 +- 和 Cursor / ChatGPT Plus / Claude Pro / Google AI Pro 的“约 20 美元 = 至少每天几小时可用”逻辑完全不同;对个人来说几乎没法当主力,只适合 AWS 赞助/公司买单的小众用途。 + +*** + +## 实际订阅组合建议(针对你这种重度 Agent 用户) + +结合上面这些定量和定性信息,你可以考虑把 20 美元档的预算这样分配和使用: + +1. **把 Cursor Pro 当主力 IDE** + - 日常所有“写实现、补全、局部重构”都尽量走 Cursor 的无限补全 + Auto 模式,保证每天核心工作不被配额卡死。 + - 只在需要“全仓分析/大迁移/特别难的 Bug”时,才切成手工选用最强模型,让月度 20 美元 Credit 用在刀刃上。 +2. **ChatGPT Plus(Codex)当“高强度 Agent + 通用大脑”** + - 把真正需要多轮 Agent 推进的重型场景(复杂 refactor、设计对比、多语言混合项目)交给 Codex 做主攻,利用它在 5 小时窗口里相对更宽松的提示数。 + - 特别是需要“写文档 + 写脚本 + 写代码”一体化的任务时,让 Codex 完整链路负责,Cursor 用来做本地执行和微调。 +3. **Claude Pro 作为“高价值、低频”专家** + - 把 Claude Code 用在关键节点:看架构、审 PR、给重构路线、帮你读晦涩业务逻辑;用 10–40 次 Code 提示/5 小时换来几次 **极高质量的建议**,而不是当流水线码农用。 +4. **Google AI Pro / Gemini Code Assist 只在你必须深度用 Google 生态时保留** + - 如果你的仓库在 GCP / Cloud Source / BigQuery 等环境里,1M 上下文 + 1500 请求/天还是有价值的,只是要心理预期:它不是无限 Agent 工厂,而是“大仓库理解 + 关键改动”的专用工具。 + - 如果只是偶尔用 Gemini 查资料或写点文案,性价比明显不如把这 20 美元挪去加强 Codex / Claude / Cursor。 +5. **明确把 Kiro 排除在“个人主力工具”之外** + - 在当前定价下,你几乎不可能以 20 美元的成本获得足够多的 Kiro 任务配额,让它作为日常 Agent 工作台;可以当 AWS 生态里的 demo 工具,别指望它扛起整月工作量。 + +*** \ No newline at end of file diff --git a/98-AgentSkills/3-Agent Skills 使用与开发实战指南-p.md b/98-AgentSkills指南/3-Agent Skills 使用与开发实战指南-p.md similarity index 100% rename from 98-AgentSkills/3-Agent Skills 使用与开发实战指南-p.md rename to 98-AgentSkills指南/3-Agent Skills 使用与开发实战指南-p.md diff --git a/98-AgentSkills/4-Claude Code Agent Skills 架构深度解析与实战实施指南:从提示工程到智能体编排的范式转移.md b/98-AgentSkills指南/4-Claude Code Agent Skills 架构深度解析与实战实施指南:从提示工程到智能体编排的范式转移.md similarity index 100% rename from 98-AgentSkills/4-Claude Code Agent Skills 架构深度解析与实战实施指南:从提示工程到智能体编排的范式转移.md rename to 98-AgentSkills指南/4-Claude Code Agent Skills 架构深度解析与实战实施指南:从提示工程到智能体编排的范式转移.md diff --git a/98-AgentSkills指南/PRD增量更新skill-prompt.md b/98-AgentSkills指南/PRD增量更新skill-prompt.md new file mode 100644 index 0000000..74f25cd --- /dev/null +++ b/98-AgentSkills指南/PRD增量更新skill-prompt.md @@ -0,0 +1,92 @@ +你是一名资深软件架构师,同时熟悉 Anthropic AgentSkills 的设计规范。 +请帮我生成一个完整的自定义 AgentSkill,名称为 doc-sync-skill。 + +## 背景与目标 + +该 Skill 用于在软件开发流程中,当 PRD 文档从旧版本更新到新版本时: +1. 自动分析两个 PRD 版本之间的差异,生成结构化的 Change Intent +2. 基于 Change Intent,对 DDS(详细设计文档)进行增量更新(只改受影响章节) +3. 基于 DDS 变更,对相关 AgentSkills 的 SKILL.md 文件进行增量更新 +4. 生成 VERSION_MATRIX.md 版本归档记录 + +## AgentSkill 文件规范(严格遵守) + +每个 Skill 必须是一个目录,包含以下结构: +- SKILL.md(必须含 YAML frontmatter,字段 name 和 description) +- scripts/(可选,放可执行脚本) +- references/(可选,放辅助 Prompt 模板和参考文档) +- assets/(可选,放归档模板) + +YAML frontmatter 规则: +- name:只含小写字母、数字和连字符,最长64字符 +- description:非空,最长1024字符,说明 Skill 的功能和触发时机 + +## 请输出以下所有文件的完整内容 + +### 文件1:doc-sync-skill/SKILL.md + +包含: +- YAML frontmatter(name, description, version, author) +- 工作流总览(四个 Phase) +- 每个 Phase 的详细执行步骤 +- 调用 scripts/ 和 references/ 的时机 +- 异常处理规则(如文件不存在时的 fallback 行为) +- 输出格式规范 + +### 文件2:doc-sync-skill/references/CHANGE_INTENT_TEMPLATE.md + +包含:Change Intent 的标准 Markdown 模板,字段包括: +变更版本、变更日期、变更范围、新增需求列表、修改需求列表、 +废弃需求列表、影响模块列表、变更摘要 + +### 文件3:doc-sync-skill/references/DDS_UPDATE_PROMPT.md + +包含:一份完整的、可直接发给大模型的 Prompt,用于驱动 DDS 增量更新。 +Prompt 中需包含: +- 角色设定(高级架构师) +- 输入变量占位符:{{CHANGE_INTENT}} 和 {{CURRENT_DDS}} +- 输出格式要求:[NEW] / [MODIFIED](含diff对比) / [DEPRECATED] 标注规则 +- 约束:未提及的章节绝对不修改 +- 输出结束后追加版本号建议 + +### 文件4:doc-sync-skill/references/SKILL_UPDATE_PROMPT.md + +包含:一份完整的、可直接发给大模型的 Prompt,用于驱动单个 AgentSkill 的增量更新。 +Prompt 中需包含: +- 输入变量占位符:{{DDS_DIFF}}、{{SKILL_NAME}}、{{CURRENT_SKILL_MD}} +- 输出要求:只更新 SKILL.md 中受影响的部分 +- 约束:version 字段升 patch,输出完整的新 SKILL.md 内容 + +### 文件5:doc-sync-skill/scripts/diff_prd.py + +包含:一个 Python 脚本,接受 --old 和 --new 两个参数(Markdown 文件路径), +按章节(##标题)级别对比差异,输出结构化的 JSON,格式为: +{ + "added_sections": [...], + "modified_sections": [{"title": "...", "old": "...", "new": "..."}], + "removed_sections": [...], + "summary": "..." +} +脚本需要有完善的错误处理和 UTF-8 编码支持。 + +### 文件6:doc-sync-skill/scripts/sync_check.py + +包含:一个 Python 脚本,接受 --dds 和 --skills-dir 两个参数, +扫描 DDS 中所有接口/模块名称,检查在 skills-dir 下是否存在对应 SKILL.md, +输出不一致报告:哪些模块在 DDS 中定义但没有对应 Skill,哪些 Skill 已无对应 DDS 章节。 + +### 文件7:doc-sync-skill/assets/VERSION_MATRIX_TEMPLATE.md + +包含:版本矩阵的 Markdown 表格模板,列为: +迭代日期 | PRD版本 | DDS版本 | 受影响Skill | 变更摘要 | Git Commit + +## 输出格式要求 + +每个文件用如下格式分隔输出: + +=== 文件路径:doc-sync-skill/SKILL.md === +(文件内容) +=== END === + +所有文件均使用中文注释和说明,代码部分保持英文。 +YAML frontmatter 的 description 必须包含中英文触发关键词以提高匹配率。 \ No newline at end of file diff --git a/tmp.md b/tmp.md index f0a32f7..61cb0a6 100644 --- a/tmp.md +++ b/tmp.md @@ -15,3 +15,12 @@ +各位同事 初步评估迁移生产的服务器费用如下 + +1. 飞服平台是 ¥42,632.20 每月 +2. 监管平台是 ¥48,700.60 每月 +3. 老平台是 ¥28,674.00 每月 + + + +