feat(cli): record 写入 --typecast/--order/--field-key-type + 附件字段 URL 导入 skill 文档 (0.2.0)
This commit is contained in:
@@ -251,6 +251,25 @@ inkreach-teable record create --table-id tblXXX --fields '{"Assignee":{"id":"usr
|
||||
inkreach-teable record create --table-id tblXXX --fields '{"Assignee":"Alice"}' --typecast
|
||||
```
|
||||
|
||||
**Attachment URL import** (2026-10): attachment fields accept http(s) URLs — the
|
||||
backend downloads the file (SSRF-guarded, size-capped) and stores it as a real
|
||||
attachment with thumbnail. Two forms:
|
||||
|
||||
```bash
|
||||
# Object form — works without --typecast; name is optional (derived from the URL)
|
||||
inkreach-teable record create --table-id tblXXX \
|
||||
--fields '{"Files":[{"url":"https://example.com/f.png","name":"report.png"}]}'
|
||||
|
||||
# String form — needs --typecast; comma-separates URLs and existing actXXX ids
|
||||
inkreach-teable record create --table-id tblXXX --typecast \
|
||||
--fields '{"Files":"https://example.com/a.png,https://example.com/b.png"}'
|
||||
```
|
||||
|
||||
Notes: only `http:`/`https:` URLs; URLs containing commas cannot be expressed in
|
||||
the string form (use the object form); a failed download rejects the whole
|
||||
request with 400 (nothing is silently dropped); V1 (legacy) bases require
|
||||
`--typecast` for the string form, V2 bases accept both forms directly.
|
||||
|
||||
**`--records` format** (batch): `{"header":["Field1","Field2"],"records":[["val1","val2"],["val3","val4"]]}`
|
||||
|
||||
### Update
|
||||
@@ -261,7 +280,7 @@ inkreach-teable record update --table-id <tid> --records '<json>'
|
||||
|
||||
**`--records` format**: `[{"id":"recXXX","fields":{"FieldName":"newValue"}}]` — array of `{id, fields}` objects. Batch up to 2000.
|
||||
|
||||
**Record reordering**: pass `--order` with `viewId`, `anchorId`, `position`:
|
||||
**Record reordering**: pass `--order` with `viewId`, `anchorId`, `position` (works on both `record create` — insert at position — and `record update` — move existing records; only meaningful in a view without an explicit sort):
|
||||
|
||||
```bash
|
||||
inkreach-teable record update --table-id tblXXX \
|
||||
@@ -269,6 +288,13 @@ inkreach-teable record update --table-id tblXXX \
|
||||
--order '{"viewId":"viwXXX","anchorId":"recYYY","position":"before"}'
|
||||
```
|
||||
|
||||
**`--field-key-type <name|id|dbFieldName>`** (default `name`): read `--fields`/`--records` keys as field ids instead of names — useful when field names contain characters that are awkward in JSON keys, or when you already have `fldXXX` ids from `field list --json`:
|
||||
|
||||
```bash
|
||||
inkreach-teable record create --table-id tblXXX --field-key-type id \
|
||||
--fields '{"fldXXXX":"hello"}'
|
||||
```
|
||||
|
||||
### Delete
|
||||
|
||||
```bash
|
||||
@@ -378,7 +404,7 @@ inkreach-teable preset delete <presetId> --table-id tblXxx
|
||||
| `singleSelect` | `"Option Name"` | (string) |
|
||||
| `multipleSelect` | `["Tag A","Tag B"]` | (array of strings) |
|
||||
| `rating` | `3` | Integer 1..max |
|
||||
| `attachment` | `[{"name":"f.png","token":"xxx"}]` | Always array of objects; update **replaces all** |
|
||||
| `attachment` | `[{"name":"f.png","token":"xxx"}]` | Always array of objects; update **replaces all**. Also accepts `[{"url":"https://…","name":"f.png"}]` (server downloads the file) and, with `--typecast`, a plain URL string — see attachment URL import below |
|
||||
| `user` | `{"id":"usrXXX","title":"Alice"}` | With `--typecast`: just `"Alice"` or `"alice@example.com"` |
|
||||
| `link` | `[{"id":"recXXX"}]` | With `--typecast`: just `"Linked Record Name"` |
|
||||
| `formula` / `rollup` / `lookup` | Read-only | Cannot be set via record create/update |
|
||||
@@ -404,4 +430,5 @@ inkreach-teable preset delete <presetId> --table-id tblXxx
|
||||
| View data in kanban board | `view create --type kanban` then `view update --group` | Creating special columns |
|
||||
| Set datetime in a date field | `"2025-06-15T14:30:00.000Z"` | `"2025-06-15 14:30"` (non-ISO; may be rejected) |
|
||||
| Update attachments | Always pass the full array (replaces all) | Trying to add/remove individual attachments |
|
||||
| Attach a file by URL | `record create --fields '{"Files":[{"url":"https://…/f.png"}]}'` (object form, no typecast needed) or `--typecast --fields '{"Files":"https://…/f.png"}'` | Uploading via the attachments signature/notify endpoints first (only needed for local files) |
|
||||
| Batch insert 500 records | One `record create --records` call | 500 separate `record create` calls |
|
||||
|
||||
Reference in New Issue
Block a user