mirror of
https://github.com/WecomTeam/wecom-unified.git
synced 2026-09-17 14:16:46 +08:00
feat(wecom-doc): 智能表格支持本地图片/文件写入接口
主要变更: - 新增 +smartsheet_add_records_auto_file 接口说明:支持通过本地路径(image_path/file_path)写入图片与文件,后台自动转存为 image_url - 新增 +smartsheet_update_records_auto_file 接口说明:支持更新带图片/文件字段的记录 - wecom-doc-smartsheet-cell-value-formats.md:IMAGE 字段示例由 image_url 调整为本地 image_path;新增 文件(FILE) 字段格式说明 - wecom-doc-smartsheet-field-types.md:补充 FIELD_TYPE_ATTACHMENT(文件/附件) 字段类型 - chore: SKILL.md 中 wecom-cli 安装版本由 0.1.6 升级锁定为 0.1.7 - chore: 新增 .gitignore 忽略 .DS_Store
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
@@ -19,7 +19,7 @@ wecom-cli --version
|
||||
如果命令不存在或报错,执行安装:
|
||||
|
||||
```bash
|
||||
npm install -g @wecom/cli@0.1.6
|
||||
npm install -g @wecom/cli@0.1.7
|
||||
```
|
||||
|
||||
### Step 2: 检查凭证是否配置
|
||||
|
||||
@@ -122,10 +122,10 @@ wecom-cli contact get_userlist '{}'
|
||||
|
||||
### 9. 图片 (IMAGE)
|
||||
|
||||
数组格式:
|
||||
数组格式,支持传入本地路径:
|
||||
|
||||
```json
|
||||
"封面": [{"image_url": "https://example.com/img.png"}]
|
||||
"封面": [{"image_path": "/path/to/img.png"}]
|
||||
```
|
||||
|
||||
### 10. 地理位置 (LOCATION)
|
||||
@@ -136,6 +136,15 @@ wecom-cli contact get_userlist '{}'
|
||||
"地点": [{"source_type": 1, "id": "地点ID", "latitude": "39.9", "longitude": "116.3", "title": "北京"}]
|
||||
```
|
||||
|
||||
### 11. 文件
|
||||
|
||||
数组格式:
|
||||
|
||||
```json
|
||||
"文件": [{"file_path": "/path/to/img.png"}]
|
||||
```
|
||||
|
||||
|
||||
## 完整添加记录示例
|
||||
|
||||
```json
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
| `FIELD_TYPE_CURRENCY` | 货币 | 货币金额 |
|
||||
| `FIELD_TYPE_PERCENTAGE` | 百分比 | 比率类数值(完成率、转化率) |
|
||||
| `FIELD_TYPE_BARCODE` | 条码 | 条形码/二维码 |
|
||||
| `FIELD_TYPE_ATTACHMENT` | 文件 | 文件/附件 |
|
||||
|
||||
## 添加字段示例
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ wecom-cli doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsh
|
||||
|
||||
参见 [API 详情](wecom-doc-smartsheet-get-records.md)。
|
||||
|
||||
### smartsheet_add_records
|
||||
### smartsheet_add_records 添加一行或多行记录(不带图片或文件)
|
||||
|
||||
添加一行或多行记录,单次建议 500 行内。
|
||||
|
||||
@@ -263,7 +263,15 @@ wecom-cli doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID",
|
||||
|
||||
> ⚠️ 若返回 `errcode: 851003` 或 `errmsg` 包含 `no authority`(通常是企业可见范围 > 10 人的规模限制),切换到 Webhook 兜底方案,详见 [wecom-doc-smartsheet-webhook.md](wecom-doc-smartsheet-webhook.md)。
|
||||
|
||||
### smartsheet_update_records
|
||||
## +smartsheet_add_records_auto_file 添加一行或多行记录(带图片或文件)
|
||||
|
||||
添加一行或多行记录,单次建议 500 行内。与 `smartsheet_add_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要添加带图片或文件的记录,请使用此接口。传入后台后,后台将自动存储并转换为image_url。
|
||||
|
||||
```bash
|
||||
wecom-cli doc +smartsheet_add_records_auto_file '{"docid":"DOCID","sheet_id":"SHEETID","records":[{"values":{"图片":[{"image_path":"/path/to/image.jpg"}],"文件":[{"file_path":"/path/to/file.txt"}]}}]}'
|
||||
```
|
||||
|
||||
### smartsheet_update_records 更新记录(不带图片或文件)
|
||||
|
||||
更新一行或多行记录,单次建议在 500 行内。需提供 record_id(通过 `smartsheet_get_records` 获取)。支持通过 `key_type` 指定 values 的 key 使用字段标题或字段 ID:
|
||||
|
||||
@@ -278,6 +286,13 @@ wecom-cli doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID
|
||||
|
||||
> ⚠️ 若返回 `errcode: 851003` 或 `errmsg` 包含 `no authority`(通常是企业可见范围 > 10 人的规模限制),切换到 Webhook 兜底方案,详见 [wecom-doc-smartsheet-webhook.md](wecom-doc-smartsheet-webhook.md)。注意 Webhook 只能更新通过 Webhook 写入的记录,人工创建的记录无法更新。
|
||||
|
||||
### +smartsheet_update_records_auto_file 更新记录(更新图片或文件字段)
|
||||
更新一行或多行记录,单次建议在 500 行内。与 `smartsheet_update_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要更新记录中的图片或文件,请使用此接口。传入后台后,后台将自动存储并转换为image_url。
|
||||
|
||||
```bash
|
||||
wecom-cli doc +smartsheet_update_records_auto_file '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE", "records": [{"record_id": "RECORDID", "values": {"values":{"图片":[{"image_path":"/path/to/image.jpg"}],"文件":[{"file_path":"/path/to/file.txt"}]}}}]}'
|
||||
```
|
||||
|
||||
### smartsheet_delete_records
|
||||
|
||||
删除一行或多行记录,单次必须在 500 行内。**操作不可逆**。record_id 通过 `smartsheet_get_records` 获取。
|
||||
|
||||
Reference in New Issue
Block a user