mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
fix(whiteboard): register +media-upload shortcut and add whiteboard parent type
- Register DocMediaUpload in doc/shortcuts.go (was defined but never registered, so lark-cli docs +media-upload was unavailable) - Rename MediaUpload to DocMediaUpload for consistency with DocMediaInsert/DocMediaPreview/DocMediaDownload - Add whiteboard to --parent-type flag description - Update --parent-node description to mention board_token for whiteboard Drive +upload (parent_type=explorer) produces file tokens that the whiteboard API does not recognize (500 error). The correct approach is docs +media-upload with parent_type=whiteboard.
This commit is contained in:
@@ -118,7 +118,7 @@ func TestDocMediaUploadDryRunUsesMultipartForLargeFile(t *testing.T) {
|
||||
t.Fatalf("set --parent-node: %v", err)
|
||||
}
|
||||
|
||||
dry := decodeDocDryRun(t, MediaUpload.DryRun(context.Background(), common.TestNewRuntimeContext(cmd, nil)))
|
||||
dry := decodeDocDryRun(t, DocMediaUpload.DryRun(context.Background(), common.TestNewRuntimeContext(cmd, nil)))
|
||||
if dry.Description != "chunked media upload (files > 20MB)" {
|
||||
t.Fatalf("dry-run description = %q", dry.Description)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/larksuite/cli/shortcuts/common"
|
||||
)
|
||||
|
||||
var MediaUpload = common.Shortcut{
|
||||
var DocMediaUpload = common.Shortcut{
|
||||
Service: "docs",
|
||||
Command: "+media-upload",
|
||||
Description: "Upload media file (image/attachment) to a document block",
|
||||
@@ -22,8 +22,8 @@ var MediaUpload = common.Shortcut{
|
||||
AuthTypes: []string{"user", "bot"},
|
||||
Flags: []common.Flag{
|
||||
{Name: "file", Desc: "local file path (files > 20MB use multipart upload automatically)", Required: true},
|
||||
{Name: "parent-type", Desc: "parent type: docx_image | docx_file", Required: true},
|
||||
{Name: "parent-node", Desc: "parent node ID (block_id)", Required: true},
|
||||
{Name: "parent-type", Desc: "parent type: docx_image | docx_file | whiteboard", Required: true},
|
||||
{Name: "parent-node", Desc: "parent node ID (block_id for docx, board_token for whiteboard)", Required: true},
|
||||
{Name: "doc-id", Desc: "document ID (for drive_route_token)"},
|
||||
},
|
||||
DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI {
|
||||
|
||||
@@ -13,6 +13,7 @@ func Shortcuts() []common.Shortcut {
|
||||
DocsFetch,
|
||||
DocsUpdate,
|
||||
DocMediaInsert,
|
||||
DocMediaUpload,
|
||||
DocMediaPreview,
|
||||
DocMediaDownload,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user