mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
* fix: validate base shortcut JSON object inputs * fix: reject null in base JSON object parser --------- Co-authored-by: kongenpei <kongenpei@users.noreply.github.com>
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package base
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/larksuite/cli/shortcuts/common"
|
|
)
|
|
|
|
var BaseRecordBatchCreate = common.Shortcut{
|
|
Service: "base",
|
|
Command: "+record-batch-create",
|
|
Description: "Batch create records",
|
|
Risk: "write",
|
|
Scopes: []string{"base:record:create"},
|
|
AuthTypes: authTypes(),
|
|
Flags: []common.Flag{
|
|
baseTokenFlag(true),
|
|
tableRefFlag(true),
|
|
{Name: "json", Desc: "batch create JSON object", Required: true},
|
|
},
|
|
Tips: []string{
|
|
`Example: --json '{"fields":["Title","Status"],"rows":[["Task A","Open"],["Task B","Done"]]}'`,
|
|
"Agent hint: use the lark-base skill's record-batch-create guide for usage and limits.",
|
|
},
|
|
Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
|
return validateRecordJSON(runtime)
|
|
},
|
|
DryRun: dryRunRecordBatchCreate,
|
|
Execute: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
|
return executeRecordBatchCreate(runtime)
|
|
},
|
|
}
|