MCPcopy Create free account
hub / github.com/openclaw/gogcli / queueDocsBatchRequests

Function queueDocsBatchRequests

internal/cmd/batch.go:429–486  ·  view source on GitHub ↗
(ctx context.Context, flags *RootFlags, batchID, documentID, command, revisionID string, requests []*docs.Request, requireEmpty bool)

Source from the content-addressed store, hash-verified

427}
428
429func queueDocsBatchRequests(ctx context.Context, flags *RootFlags, batchID, documentID, command, revisionID string, requests []*docs.Request, requireEmpty bool) (bool, error) {
430 batchID = strings.TrimSpace(batchID)
431 if batchID == "" {
432 return false, nil
433 }
434 if err := validateDocsBatchIDArg(batchID); err != nil {
435 return true, err
436 }
437 if len(requests) == 0 {
438 return true, errors.New("no Docs requests to append")
439 }
440 account, err := requireAccount(flags)
441 if err != nil {
442 return true, err
443 }
444 client, err := resolveClientForEmail(ctx, account, flags)
445 if err != nil {
446 return true, err
447 }
448 store, err := newDocsBatchStore(ctx)
449 if err != nil {
450 return true, err
451 }
452 rawRequests, err := marshalDocsBatchRequests(requests)
453 if err != nil {
454 return true, err
455 }
456 total, err := store.Append(docsbatch.AppendOptions{
457 BatchID: batchID,
458 Command: command,
459 Identity: docsbatch.Identity{
460 Service: docsbatch.ServiceDocs,
461 DocumentID: documentID,
462 Account: account,
463 Client: client,
464 },
465 RevisionID: revisionID,
466 Requests: rawRequests,
467 RequireEmpty: requireEmpty,
468 })
469 if err != nil {
470 return true, err
471 }
472 if outfmt.IsJSON(ctx) {
473 err = outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{
474 "batch_id": batchID,
475 "queued": len(requests),
476 "requests": total,
477 })
478 } else {
479 out := ui.FromContext(ctx).Out()
480 out.Linef("batch_id\t%s", batchID)
481 out.Linef("queued\t%d", len(requests))
482 out.Linef("requests\t%d", total)
483 }
484
485 return true, err
486}

Callers 10

RunMethod · 0.85
runDocsBodyMutationFunction · 0.85
runDocsSingleInsertFunction · 0.85
writePlainTextMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85

Calls 12

IsJSONFunction · 0.92
WriteJSONFunction · 0.92
FromContextFunction · 0.92
validateDocsBatchIDArgFunction · 0.85
requireAccountFunction · 0.85
resolveClientForEmailFunction · 0.85
newDocsBatchStoreFunction · 0.85
marshalDocsBatchRequestsFunction · 0.85
stdoutWriterFunction · 0.85
AppendMethod · 0.80
OutMethod · 0.80
LinefMethod · 0.80

Tested by

no test coverage detected