From d382b5922478206d7b26c06be7c780d388c5950b Mon Sep 17 00:00:00 2001 From: ysyneu Date: Sun, 11 Oct 2026 02:15:51 -0700 Subject: [PATCH 1/3] fix(cli): state how complete every list output is List commands printed a row count labelled "Total: N" when the response had no total, and said nothing at all in structured mode or for bare-array responses, so a capped page read as the whole set. One helper (listPage.statement) now decides the statement from what the API actually returned, in order: a known total ("showing N of T", plus a next-page hint while rows remain); else has_next_page / a next cursor; else a full page equal to the limit ("more may exist"); else the plain count. A count is never printed as a total. Table mode prints the statement as a stdout footer; json/toon/jsonl print a `note:` line on stderr only when rows may be missing, so stdout is unchanged for jq/toon pipelines. - generated commands: printGenericResult takes the request body (cligen now passes it) to learn the page and limit the request carried, and applies the helper to row arrays and list envelopes - alert events: gains --page/--limit and shows the real total - incident feed, alert timeline: surface has_next_page - incident alerts: gains --page and shows the total in every mode - incident similar, insight top-alerts: full top-N list notes more may exist - session list: notes when the fetch was capped by --limit - PrintTotal is removed; its callers use PrintList / PrintPage --- internal/cli/alert.go | 24 +- internal/cli/automation.go | 14 +- internal/cli/channel.go | 6 +- internal/cli/command.go | 143 +++++++-- internal/cli/command_test.go | 8 +- internal/cli/field.go | 2 +- internal/cli/gen_support.go | 86 +++++- internal/cli/gen_support_test.go | 4 +- internal/cli/generic_table.go | 92 ++++-- internal/cli/generic_table_test.go | 31 +- internal/cli/incident.go | 21 +- internal/cli/insight.go | 2 +- internal/cli/list_completeness_test.go | 277 ++++++++++++++++++ internal/cli/monit_prometheus_label_values.go | 2 +- internal/cli/monit_query.go | 2 +- internal/cli/oncall.go | 4 +- internal/cli/session.go | 21 +- internal/cli/session_test.go | 5 +- internal/cli/team.go | 2 +- internal/cli/zz_generated_a2a_agents.go | 14 +- internal/cli/zz_generated_account.go | 2 +- internal/cli/zz_generated_alert_enrichment.go | 26 +- internal/cli/zz_generated_alert_rules.go | 20 +- internal/cli/zz_generated_alerts.go | 16 +- internal/cli/zz_generated_analytics.go | 12 +- internal/cli/zz_generated_applications.go | 20 +- internal/cli/zz_generated_artifacts.go | 20 +- internal/cli/zz_generated_audit_logs.go | 4 +- internal/cli/zz_generated_automations.go | 16 +- internal/cli/zz_generated_calendars.go | 10 +- internal/cli/zz_generated_changes.go | 2 +- internal/cli/zz_generated_channels.go | 32 +- internal/cli/zz_generated_dashboards.go | 34 +-- internal/cli/zz_generated_data_query.go | 2 +- internal/cli/zz_generated_data_sources.go | 14 +- internal/cli/zz_generated_diagnostics.go | 4 +- .../cli/zz_generated_error_ingestion_rules.go | 6 +- internal/cli/zz_generated_facets.go | 4 +- internal/cli/zz_generated_im_integrations.go | 2 +- internal/cli/zz_generated_incidents.go | 62 ++-- internal/cli/zz_generated_integrations.go | 18 +- ...z_generated_issue_preset_severity_rules.go | 6 +- internal/cli/zz_generated_issues.go | 4 +- internal/cli/zz_generated_knowledge.go | 18 +- internal/cli/zz_generated_licenses.go | 2 +- internal/cli/zz_generated_mcp_servers.go | 14 +- internal/cli/zz_generated_members.go | 10 +- .../zz_generated_notification_templates.go | 8 +- internal/cli/zz_generated_resources.go | 2 +- .../cli/zz_generated_roles_permissions.go | 10 +- internal/cli/zz_generated_rule_folders.go | 2 +- internal/cli/zz_generated_schedules.go | 14 +- internal/cli/zz_generated_session_replay.go | 4 +- internal/cli/zz_generated_sessions.go | 6 +- internal/cli/zz_generated_skills.go | 12 +- internal/cli/zz_generated_sourcemaps.go | 4 +- internal/cli/zz_generated_status_pages.go | 34 +-- internal/cli/zz_generated_teams.go | 8 +- internal/cmd/cligen/main.go | 2 +- skills/flashduty/reference/alert.md | 2 + skills/flashduty/reference/incident.md | 1 + 61 files changed, 896 insertions(+), 353 deletions(-) create mode 100644 internal/cli/list_completeness_test.go diff --git a/internal/cli/alert.go b/internal/cli/alert.go index 5bac32f..3d00980 100644 --- a/internal/cli/alert.go +++ b/internal/cli/alert.go @@ -201,16 +201,19 @@ func printAlertDetail(w io.Writer, a *flashduty.AlertItem) { } func newAlertEventsCmd() *cobra.Command { - return &cobra.Command{ + var limit, page int + + cmd := &cobra.Command{ Use: "events ", Short: "List alert events", Long: curatedLong("List the individual events that compose a given alert.", "Alerts", "ReadEventList"), Args: requireArgs("alert_id"), RunE: func(cmd *cobra.Command, args []string) error { return runCommand(cmd, args, func(ctx *RunContext) error { - result, _, err := ctx.Client.Alerts.ReadEventList(cmdContext(ctx.Cmd), &flashduty.AlertEventListRequest{ - AlertID: ctx.Args[0], - }) + req := &flashduty.AlertEventListRequest{AlertID: ctx.Args[0]} + req.Limit = limit + req.Page = page + result, _, err := ctx.Client.Alerts.ReadEventList(cmdContext(ctx.Cmd), req) if err != nil { return err } @@ -228,10 +231,17 @@ func newAlertEventsCmd() *cobra.Command { {Header: "TITLE", MaxWidth: 50, Field: func(v any) string { return v.(flashduty.AlertEventItem).Title }}, } - return ctx.PrintTotal(result.Items, cols, len(result.Items)) + return ctx.PrintPage(result.Items, cols, listPage{ + Count: len(result.Items), Page: page, Limit: limit, Total: int(result.Total), More: moreOf(result.HasNextPage), + }) }) }, } + + cmd.Flags().IntVar(&limit, "limit", 20, "Max events (max 100)") + cmd.Flags().IntVar(&page, "page", 1, "Page number") + + return cmd } func newAlertTimelineCmd() *cobra.Command { @@ -287,7 +297,9 @@ func newAlertTimelineCmd() *cobra.Command { }}, } - return ctx.Printer.Print(result.Items, cols) + return ctx.PrintPage(result.Items, cols, listPage{ + Count: len(result.Items), Page: page, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), + }) }) }, } diff --git a/internal/cli/automation.go b/internal/cli/automation.go index beba97a..2d76d87 100644 --- a/internal/cli/automation.go +++ b/internal/cli/automation.go @@ -111,7 +111,7 @@ the rule under that team. The scope is immutable after creation. if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -167,7 +167,7 @@ func newAutomationListCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -194,7 +194,7 @@ func newAutomationGetCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -327,7 +327,7 @@ func newAutomationUpdateCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -423,7 +423,7 @@ func newAutomationRunsCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -452,7 +452,7 @@ func newAutomationTemplatesCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } @@ -490,7 +490,7 @@ The trigger authenticates with its one-time token, not the account app key. Pass if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } diff --git a/internal/cli/channel.go b/internal/cli/channel.go index 7223b8e..e6abaa1 100644 --- a/internal/cli/channel.go +++ b/internal/cli/channel.go @@ -96,7 +96,7 @@ func newChannelListCmd() *cobra.Command { {Header: "CREATOR", Field: func(v any) string { return v.(channelRow).CreatorName }}, } - return ctx.PrintTotal(rows, cols, int(result.Total)) + return ctx.PrintList(rows, cols, len(rows), page, limit, int(result.Total)) }) }, } @@ -225,7 +225,7 @@ func newChannelEscalateRuleListCmd() *cobra.Command { } proj = bounded.([]map[string]any) noteProjectionBound(cmd, bound) - return ctx.PrintTotal(proj, nil, len(proj)) + return ctx.PrintPage(proj, nil, listPage{Count: len(proj), Total: -1}) } cols := []output.Column{ @@ -235,7 +235,7 @@ func newChannelEscalateRuleListCmd() *cobra.Command { {Header: "PRIORITY", Field: func(v any) string { return strconv.FormatInt(v.(flashduty.EscalateRuleItem).Priority, 10) }}, {Header: "UPDATED", Field: func(v any) string { return output.FormatTime(v.(flashduty.EscalateRuleItem).UpdatedAt) }}, } - return ctx.PrintTotal(out.Items, cols, len(out.Items)) + return ctx.PrintPage(out.Items, cols, listPage{Count: len(out.Items), Total: -1}) }) }, } diff --git a/internal/cli/command.go b/internal/cli/command.go index 238e3b0..b83019f 100644 --- a/internal/cli/command.go +++ b/internal/cli/command.go @@ -46,38 +46,139 @@ func runCommand(cmd *cobra.Command, args []string, fn func(ctx *RunContext) erro return fn(ctx) } -// PrintList prints items as a table and appends a "Showing N results (page P, total T)." footer. -// In structured mode the footer is suppressed to keep stdout byte-pure for -// jq/toon pipelines, so a page with more rows beyond it is announced on -// stderr instead — without it a consumer sees a partial page -// (e.g. the default --limit 20 of a far larger total) as the whole set. The -// judgment accounts for the page offset: on the last page -// ((page-1)*limit+count reaches total) there is no rest, so no note. -func (ctx *RunContext) PrintList(items any, cols []output.Column, count, page, limit, total int) error { - if err := ctx.Printer.Print(items, cols); err != nil { - return err +// moreState is what a list response says about whether rows exist beyond the +// ones returned. +type moreState int8 + +const ( + moreUnknown moreState = iota // the API gave no signal + moreNo // has_next_page=false / empty next cursor + moreYes // has_next_page=true / non-empty next cursor +) + +// moreOf maps a response's has_next_page flag to a moreState. +func moreOf(hasNext bool) moreState { + if hasNext { + return moreYes } - if ctx.Structured() { - if (page-1)*limit+count < total { - _, _ = fmt.Fprintf(ctx.Cmd.ErrOrStderr(), "note: showing %d of %d total results (page %d); raise --limit or use --page for the rest\n", count, total, page) + return moreNo +} + +// listPage is everything a list response tells us about its own completeness. +// It is the single input to the completeness statement every list output makes, +// so a partial page is never mistaken for the whole set. +type listPage struct { + Count int // rows shown + Page int // 1-based page; 0 when the command has no page notion + Limit int // page size requested or the known default; 0 when unknown + Total int // total matching rows; negative when the API returned none + More moreState // has_next_page / next cursor, when the API returned one +} + +// totalKnown reports whether Total is a usable server total. A total below the +// shown count is an absent field decoded as zero, not a real total. +func (p listPage) totalKnown() bool { return p.Total >= 0 && p.Total >= p.Count } + +// statement applies the completeness rules in order and returns the table +// footer and the structured-mode stderr note ("" when no warning applies): +// +// a. total known: "showing N of T", plus a next-page hint when rows remain; +// b. else has_next_page/cursor known: true warns, false is complete; +// c. else a full page (N == limit) cannot tell: warn that more may exist; +// d. else only the plain count. +// +// A count is never labelled a total. +func (p listPage) statement(cmd *cobra.Command) (footer, note string) { + pageSuffix := "" + if p.Page > 0 { + pageSuffix = fmt.Sprintf(" (page %d)", p.Page) + } + hint := moreHint(cmd, p.Page) + warn := func(body string) (string, string) { + if hint != "" { + body += "; " + hint } - return nil + return "S" + body[1:] + ".", "note: " + body } - _, _ = fmt.Fprintf(ctx.Writer, "Showing %d results (page %d, total %d).\n", count, page, total) - return nil + switch { + case p.totalKnown(): + if p.Page > 0 { + footer = fmt.Sprintf("Showing %d results (page %d, total %d).", p.Count, p.Page, p.Total) + } else { + footer = fmt.Sprintf("Showing %d results (total %d).", p.Count, p.Total) + } + offset := (max(p.Page, 1) - 1) * p.Limit + if p.Limit == 0 { + offset = (max(p.Page, 1) - 1) * p.Count + } + if offset+p.Count < p.Total { + _, note = warn(fmt.Sprintf("showing %d of %d total results%s", p.Count, p.Total, pageSuffix)) + } + return footer, note + case p.More == moreYes: + return warn(fmt.Sprintf("showing %d results%s; more results exist", p.Count, pageSuffix)) + case p.More == moreNo: + return fmt.Sprintf("Showing %d results%s.", p.Count, pageSuffix), "" + case p.Limit > 0 && p.Count == p.Limit: + return warn(fmt.Sprintf("showing %d results%s (= limit %d); more may exist", p.Count, pageSuffix, p.Limit)) + } + return fmt.Sprintf("Showing %d results%s.", p.Count, pageSuffix), "" +} + +// moreHint names the flags this command actually has for reaching further rows. +// page is the page just shown; 0 means the command has no page notion, so --page +// is not offered. +func moreHint(cmd *cobra.Command, page int) string { + has := func(name string) bool { return cmd.Flags().Lookup(name) != nil } + switch { + case page > 0 && has("page") && has("limit"): + return fmt.Sprintf("raise --limit or use --page %d", page+1) + case page > 0 && has("page"): + return fmt.Sprintf("use --page %d", page+1) + case has("search-after-ctx"): + return "pass the response's search_after_ctx as --search-after-ctx" + case has("cursor"): + return "pass the response's next_cursor as --cursor" + case has("limit"): + return "raise --limit" + } + return "" +} + +// announce states how complete the list just printed is: a footer on stdout in +// table mode, a stderr note (only when rows may be missing) in structured mode +// so stdout stays byte-pure for jq/toon pipelines. +func (ctx *RunContext) announce(pg listPage) { + if ctx.Structured() { + ctx.noteIncomplete(pg) + return + } + footer, _ := pg.statement(ctx.Cmd) + _, _ = fmt.Fprintln(ctx.Writer, footer) } -// PrintTotal prints items as a table and appends a "Total: N" footer. -func (ctx *RunContext) PrintTotal(items any, cols []output.Column, total int) error { +// noteIncomplete writes the stderr note when rows may be missing. Commands that +// own their output format (session list) call it directly. +func (ctx *RunContext) noteIncomplete(pg listPage) { + if _, note := pg.statement(ctx.Cmd); note != "" { + _, _ = fmt.Fprintln(ctx.Cmd.ErrOrStderr(), note) + } +} + +// PrintPage prints items and then states how complete they are (see listPage). +func (ctx *RunContext) PrintPage(items any, cols []output.Column, pg listPage) error { if err := ctx.Printer.Print(items, cols); err != nil { return err } - if !ctx.Structured() { - _, _ = fmt.Fprintf(ctx.Writer, "Total: %d\n", total) - } + ctx.announce(pg) return nil } +// PrintList is PrintPage for a response that carried a total. +func (ctx *RunContext) PrintList(items any, cols []output.Column, count, page, limit, total int) error { + return ctx.PrintPage(items, cols, listPage{Count: count, Page: page, Limit: limit, Total: total}) +} + // WriteResult prints a success message as plain text or JSON. func (ctx *RunContext) WriteResult(message string) { writeResult(ctx.Writer, message) diff --git a/internal/cli/command_test.go b/internal/cli/command_test.go index 184016c..d7e20a2 100644 --- a/internal/cli/command_test.go +++ b/internal/cli/command_test.go @@ -321,8 +321,8 @@ func TestCommandMemberListPersonInfos(t *testing.T) { } } - if !strings.Contains(out, "Total: 2") { - t.Errorf("[#321] expected 'Total: 2' in output, got:\n%s", out) + if !strings.Contains(out, "total 2)") { + t.Errorf("[#321] expected a total-2 footer in output, got:\n%s", out) } } @@ -1403,7 +1403,7 @@ func TestCommandIncidentWarRoomDefaultObservers(t *testing.T) { if stub.lastBody["incident_id"] != "inc-1" { t.Fatalf("[incident-war-room-default-observers] expected incident inc-1, got %#v", stub.lastBody) } - if !strings.Contains(out, "Alice") || !strings.Contains(out, "alice@example.com") || !strings.Contains(out, "Total: 1") { + if !strings.Contains(out, "Alice") || !strings.Contains(out, "alice@example.com") || !strings.Contains(out, "Showing 1 results.") { t.Fatalf("[incident-war-room-default-observers] unexpected output:\n%s", out) } } @@ -1427,7 +1427,7 @@ func TestCommandIncidentWarRoomList(t *testing.T) { if stub.lastBody["incident_id"] != "inc-1" || stub.lastBody["integration_id"] != float64(42) { t.Fatalf("[incident-war-room-list] unexpected input: %#v", stub.lastBody) } - if !strings.Contains(out, "chat-1") || !strings.Contains(out, "Total: 1") { + if !strings.Contains(out, "chat-1") || !strings.Contains(out, "Showing 1 results.") { t.Fatalf("[incident-war-room-list] unexpected output:\n%s", out) } } diff --git a/internal/cli/field.go b/internal/cli/field.go index 9f2e408..90da037 100644 --- a/internal/cli/field.go +++ b/internal/cli/field.go @@ -60,7 +60,7 @@ func newFieldListCmd() *cobra.Command { }}, } - return ctx.PrintTotal(items, cols, len(items)) + return ctx.PrintPage(items, cols, listPage{Count: len(items), Total: -1}) }) }, } diff --git a/internal/cli/gen_support.go b/internal/cli/gen_support.go index 834e9f9..7540439 100644 --- a/internal/cli/gen_support.go +++ b/internal/cli/gen_support.go @@ -343,13 +343,24 @@ func bindURLTagged(body map[string]any, rv reflect.Value) { // untouched. In human (table) mode it derives an aligned table by reflection // (renderGenericTable), since generated commands carry no hand-written column // set; anything that isn't a list or object falls back to indented JSON. -func printGenericResult(ctx *RunContext, data any) error { +// +// body is the request body the command sent (nil when it has none); it supplies +// the page and page size the list-completeness statement is judged against. +// A list-shaped response also states how complete it is: a footer in table mode, +// a stderr note in structured mode (see listPage). +func printGenericResult(ctx *RunContext, data any, body map[string]any) error { var err error data, err = datasourceToolOutput(data, currentOutputFormat()) if err != nil { return err } + win := requestWindow(ctx.Cmd, body) if ctx.Structured() { + var pg listPage + isList := false + if v, ok := derefValue(data); ok { + _, pg, isList = genericListPage(v, win) + } // Size the payload as it will print: project first, then bound and // print through the unprojecting printer so --fields runs once. if fields := requestedFields(); len(fields) > 0 { @@ -366,9 +377,78 @@ func printGenericResult(ctx *RunContext, data any) error { ctx = &projected } } - return printBoundedGenericResult(ctx, data) + if err := printBoundedGenericResult(ctx, data); err != nil { + return err + } + if isList { + ctx.announce(pg) + } + return nil + } + return renderGenericTable(ctx, data, win) +} + +// requestWindow reads the page and page size a command's request carried: the +// body's "p"/"page" and "limit" keys (which cover --data and typed flags alike), +// else the command's own --page/--limit flags (curated commands with defaults). +// A command with a --page flag and no explicit page is on page 1. +func requestWindow(cmd *cobra.Command, body map[string]any) listWindow { + var win listWindow + for _, key := range []string{"p", "page"} { + if n := bodyInt(body[key]); n > 0 { + win.page = n + } + } + win.limit = bodyInt(body["limit"]) + if cmd == nil { + return win + } + flagInt := func(name string) int { + if f := cmd.Flags().Lookup(name); f != nil { + n, _ := strconv.Atoi(f.Value.String()) + return n + } + return 0 + } + if win.page == 0 { + win.page = flagInt("page") + if win.page == 0 && cmd.Flags().Lookup("page") != nil { + win.page = 1 + } + } + if win.limit == 0 { + win.limit = flagInt("limit") + } + return win +} + +// bodyInt converts a request-body value (a flag-typed int64, or the json.Number +// a --data payload decodes to) to an int; 0 for anything else. +func bodyInt(v any) int { + switch n := v.(type) { + case int: + return n + case int64: + return int(n) + case float64: + return int(n) + case json.Number: + i, _ := n.Int64() + return int(i) + } + return 0 +} + +// derefValue unwraps pointers around data; ok is false for a nil pointer. +func derefValue(data any) (reflect.Value, bool) { + v := reflect.ValueOf(data) + for v.Kind() == reflect.Pointer { + if v.IsNil() { + return reflect.Value{}, false + } + v = v.Elem() } - return renderGenericTable(ctx, data) + return v, v.IsValid() } // printBoundedGenericResult is printGenericResult's structured-mode half. The diff --git a/internal/cli/gen_support_test.go b/internal/cli/gen_support_test.go index 8757b2a..f607697 100644 --- a/internal/cli/gen_support_test.go +++ b/internal/cli/gen_support_test.go @@ -222,7 +222,7 @@ func TestPrintGenericResultDetailNeverBounded(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil); err != nil { t.Fatalf("%v oversized detail errored: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(detail, nil); err != nil { @@ -303,7 +303,7 @@ func TestPrintGenericResultNestedDetailNotReduced(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil); err != nil { t.Fatalf("%v nested detail errored: %v", f, err) } if len(got.Bytes()) < compactListOutputLimit || !strings.Contains(got.String(), strings.Repeat("report line ", 5000)) { diff --git a/internal/cli/generic_table.go b/internal/cli/generic_table.go index 187b8ba..d86dace 100644 --- a/internal/cli/generic_table.go +++ b/internal/cli/generic_table.go @@ -52,7 +52,7 @@ type genKV struct { // carries, nested ones included; // - anything we can't model falls back to indented JSON, so output is never // empty. -func renderGenericTable(ctx *RunContext, data any) error { +func renderGenericTable(ctx *RunContext, data any, win listWindow) error { v := reflect.ValueOf(data) for v.Kind() == reflect.Pointer { if v.IsNil() { @@ -61,15 +61,10 @@ func renderGenericTable(ctx *RunContext, data any) error { v = v.Elem() } - switch v.Kind() { - case reflect.Slice: - if isRowSlice(v.Type()) { - return renderRowTable(ctx, v, v.Len()) - } - case reflect.Struct: - if rows, total, ok := listEnvelope(v); ok { - return renderRowTable(ctx, rows, total) - } + if rows, pg, ok := genericListPage(v, win); ok { + return renderRowTable(ctx, rows, pg) + } + if v.Kind() == reflect.Struct { if err := renderVertical(ctx, v); err != nil { return err } @@ -78,13 +73,46 @@ func renderGenericTable(ctx *RunContext, data any) error { return jsonFallback(ctx, data) } +// listWindow is the page and page size the request carried (0 = not stated). +type listWindow struct{ page, limit int } + +// genericListPage reports whether v (a dereferenced typed response) is +// list-shaped — a row array, or a paginated envelope — and, when it is, +// returns the rows with what the response says about its own completeness. +func genericListPage(v reflect.Value, win listWindow) (rows reflect.Value, pg listPage, ok bool) { + pg = listPage{Page: win.page, Limit: win.limit, Total: -1} + switch v.Kind() { + case reflect.Slice: + if !isRowSlice(v.Type()) { + return reflect.Value{}, pg, false + } + rows = v + case reflect.Struct: + var meta listMeta + if rows, meta, ok = listEnvelope(v); !ok { + return reflect.Value{}, pg, false + } + pg.Total, pg.More = meta.total, meta.more + default: + return reflect.Value{}, pg, false + } + pg.Count = rows.Len() + return rows, pg, true +} + +// listMeta is the pagination metadata a list envelope carries. +type listMeta struct { + total int // negative when the envelope has no Total field + more moreState // from HasNextPage or NextCursor +} + // listEnvelope reports whether struct v is a paginated list envelope: exactly // one exported field that is a slice of structs (the rows), with any remaining -// fields limited to pagination metadata. It returns the rows value and the total -// (the int field named "Total" when present, else the row count). -func listEnvelope(v reflect.Value) (rows reflect.Value, total int, ok bool) { +// fields limited to pagination metadata. It returns the rows value and that +// metadata (Total; HasNextPage or NextCursor as the has-more signal). +func listEnvelope(v reflect.Value) (rows reflect.Value, meta listMeta, ok bool) { t := v.Type() - total = -1 + meta.total = -1 found := false for i := 0; i < t.NumField(); i++ { f := t.Field(i) @@ -94,25 +122,35 @@ func listEnvelope(v reflect.Value) (rows reflect.Value, total int, ok bool) { fv := v.Field(i) if isRowSlice(fv.Type()) { if found { - return reflect.Value{}, 0, false // ambiguous: more than one row slice + return reflect.Value{}, meta, false // ambiguous: more than one row slice } rows, found = fv, true continue } - if total < 0 && f.Name == "Total" && fv.CanInt() { - total = int(fv.Int()) - } if !isListMetadataField(f, fv) { - return reflect.Value{}, 0, false + return reflect.Value{}, meta, false + } + switch f.Name { + case "Total": + if meta.total < 0 { + meta.total = int(fv.Int()) + } + case "HasNextPage": + meta.more = moreNo + if fv.Bool() { + meta.more = moreYes + } + case "NextCursor": + meta.more = moreNo + if fv.String() != "" { + meta.more = moreYes + } } } if !found { - return reflect.Value{}, 0, false - } - if total < 0 { - total = rows.Len() + return reflect.Value{}, meta, false } - return rows, total, true + return rows, meta, true } func isListMetadataField(f reflect.StructField, fv reflect.Value) bool { @@ -144,7 +182,7 @@ func isRowSlice(t reflect.Type) bool { return elem.Kind() == reflect.Struct } -func renderRowTable(ctx *RunContext, rows reflect.Value, total int) error { +func renderRowTable(ctx *RunContext, rows reflect.Value, pg listPage) error { if rows.Len() == 0 { _, _ = fmt.Fprintln(ctx.Writer, "No results.") return nil @@ -161,8 +199,8 @@ func renderRowTable(ctx *RunContext, rows reflect.Value, total int) error { return err } // Reached only from the table (human) path — printGenericResult handles - // structured output before calling the renderer — so the footer always prints. - _, _ = fmt.Fprintf(ctx.Writer, "Total: %d\n", total) + // structured output before calling the renderer — so the footer prints. + ctx.announce(pg) return nil } diff --git a/internal/cli/generic_table_test.go b/internal/cli/generic_table_test.go index e693cfc..6013c3a 100644 --- a/internal/cli/generic_table_test.go +++ b/internal/cli/generic_table_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/flashcatcloud/go-flashduty" + "github.com/spf13/cobra" "github.com/flashcatcloud/flashduty-cli/internal/output" ) @@ -16,6 +17,7 @@ import ( // tableCtx builds a RunContext that renders a human table into buf. func tableCtx(buf *bytes.Buffer) *RunContext { return &RunContext{ + Cmd: &cobra.Command{}, Writer: buf, Printer: output.NewPrinter(output.FormatTable, false, buf), Format: output.FormatTable, @@ -24,6 +26,7 @@ func tableCtx(buf *bytes.Buffer) *RunContext { func structuredCtx(buf *bytes.Buffer, f output.Format) *RunContext { return &RunContext{ + Cmd: &cobra.Command{}, Writer: buf, Printer: output.NewPrinter(f, false, buf), Format: f, @@ -53,11 +56,11 @@ func TestRenderGenericTable_DisplayColumns(t *testing.T) { }, Total: 1, } - if err := renderGenericTable(tableCtx(&buf), resp); err != nil { + if err := renderGenericTable(tableCtx(&buf), resp, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() - for _, want := range []string{"ID", "TITLE", "SEVERITY", "PROGRESS", "CHANNEL", "CREATED", "abc123", "db down", "Critical", "Triage", "prod-db", "Total: 1"} { + for _, want := range []string{"ID", "TITLE", "SEVERITY", "PROGRESS", "CHANNEL", "CREATED", "abc123", "db down", "Critical", "Triage", "prod-db", "(total 1)."} { if !strings.Contains(got, want) { t.Errorf("output missing %q\n---\n%s", want, got) } @@ -76,7 +79,7 @@ func TestRenderGenericTable_FormattedColumns(t *testing.T) { rows := []flashduty.DimensionInsightItem{ {TeamName: "sre", TotalIncidentCnt: 4, AcknowledgementPct: 0.85, MeanSecondsToAck: 150}, } - if err := renderGenericTable(tableCtx(&buf), rows); err != nil { + if err := renderGenericTable(tableCtx(&buf), rows, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() @@ -94,11 +97,11 @@ func TestRenderGenericTable_FormattedColumns(t *testing.T) { func TestRenderGenericTable_Heuristic(t *testing.T) { var buf bytes.Buffer resp := &fakeListResp{Items: []heuristicRow{{Name: "alpha", Count: 7}}, Total: 1} - if err := renderGenericTable(tableCtx(&buf), resp); err != nil { + if err := renderGenericTable(tableCtx(&buf), resp, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() - for _, want := range []string{"NAME", "COUNT", "alpha", "7", "Total: 1"} { + for _, want := range []string{"NAME", "COUNT", "alpha", "7", "(total 1)."} { if !strings.Contains(got, want) { t.Errorf("output missing %q\n---\n%s", want, got) } @@ -111,11 +114,11 @@ func TestRenderGenericTable_Heuristic(t *testing.T) { func TestRenderGenericTable_TopLevelArray(t *testing.T) { var buf bytes.Buffer rows := []heuristicRow{{Name: "x", Count: 1}, {Name: "y", Count: 2}} - if err := renderGenericTable(tableCtx(&buf), rows); err != nil { + if err := renderGenericTable(tableCtx(&buf), rows, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() - for _, want := range []string{"NAME", "COUNT", "x", "y", "Total: 2"} { + for _, want := range []string{"NAME", "COUNT", "x", "y", "Showing 2 results."} { if !strings.Contains(got, want) { t.Errorf("output missing %q\n---\n%s", want, got) } @@ -124,7 +127,7 @@ func TestRenderGenericTable_TopLevelArray(t *testing.T) { func TestRenderGenericTable_Empty(t *testing.T) { var buf bytes.Buffer - if err := renderGenericTable(tableCtx(&buf), &fakeListResp{}); err != nil { + if err := renderGenericTable(tableCtx(&buf), &fakeListResp{}, listWindow{}); err != nil { t.Fatalf("render: %v", err) } if got := strings.TrimSpace(buf.String()); got != "No results." { @@ -135,7 +138,7 @@ func TestRenderGenericTable_Empty(t *testing.T) { func TestRenderGenericTable_DetailVertical(t *testing.T) { var buf bytes.Buffer row := heuristicRow{Name: "solo", Count: 42} - if err := renderGenericTable(tableCtx(&buf), &row); err != nil { + if err := renderGenericTable(tableCtx(&buf), &row, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() @@ -191,7 +194,7 @@ func TestRenderGenericTable_DetailShowsNestedFields(t *testing.T) { Result: json.RawMessage(`{ "rows": [1, 2] }`), Digest: []byte("hi"), } - if err := renderGenericTable(tableCtx(&buf), resp); err != nil { + if err := renderGenericTable(tableCtx(&buf), resp, listWindow{}); err != nil { t.Fatalf("render: %v", err) } @@ -227,7 +230,7 @@ func TestRenderGenericTable_DetailShowsNestedFields(t *testing.T) { // (e.g. a list of names) is printed, not treated as a row table it cannot be. func TestRenderGenericTable_TopLevelScalarArray(t *testing.T) { var buf bytes.Buffer - if err := renderGenericTable(tableCtx(&buf), flashduty.SLSLogstoresResponse{"app-log", "audit-log"}); err != nil { + if err := renderGenericTable(tableCtx(&buf), flashduty.SLSLogstoresResponse{"app-log", "audit-log"}, listWindow{}); err != nil { t.Fatalf("render: %v", err) } for _, want := range []string{"app-log", "audit-log"} { @@ -248,7 +251,7 @@ func TestRenderGenericTable_McpServerItemRendersDetail(t *testing.T) { Transport: "streamable-http", URL: "https://mcp.example.com/github", } - if err := renderGenericTable(tableCtx(&buf), item); err != nil { + if err := renderGenericTable(tableCtx(&buf), item, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() @@ -273,7 +276,7 @@ func TestRenderGenericTable_McpServerPerUserOAuthNotice(t *testing.T) { Transport: "streamable-http", URL: "https://mcp.example.com/github", } - if err := renderGenericTable(tableCtx(&buf), item); err != nil { + if err := renderGenericTable(tableCtx(&buf), item, listWindow{}); err != nil { t.Fatalf("render: %v", err) } got := buf.String() @@ -294,7 +297,7 @@ func TestPrintGenericResult_StructuredUnchanged(t *testing.T) { // output to the direct printer (the agent path is untouched by the renderer). for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), resp); err != nil { + if err := printGenericResult(structuredCtx(&got, f), resp, nil); err != nil { t.Fatalf("%v render: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(resp, nil); err != nil { diff --git a/internal/cli/incident.go b/internal/cli/incident.go index ffb2065..b1fac24 100644 --- a/internal/cli/incident.go +++ b/internal/cli/incident.go @@ -693,7 +693,7 @@ func newIncidentTimelineCmd() *cobra.Command { } func newIncidentAlertsCmd() *cobra.Command { - var limit int + var limit, page int cmd := &cobra.Command{ Use: "alerts ", @@ -704,6 +704,7 @@ func newIncidentAlertsCmd() *cobra.Command { return runCommand(cmd, args, func(ctx *RunContext) error { req := &flashduty.ListIncidentAlertsRequest{IncidentID: ctx.Args[0]} req.Limit = limit + req.Page = page result, _, err := ctx.Client.Incidents.AlertList(cmdContext(ctx.Cmd), req) if err != nil { return err @@ -722,12 +723,13 @@ func newIncidentAlertsCmd() *cobra.Command { {Header: "STARTED", Field: func(v any) string { return output.FormatTime(v.(flashduty.AlertInfo).StartTime) }}, } - return ctx.PrintTotal(result.Items, cols, int(result.Total)) + return ctx.PrintList(result.Items, cols, len(result.Items), page, limit, int(result.Total)) }) }, } cmd.Flags().IntVar(&limit, "limit", 10, "Max alerts to show") + cmd.Flags().IntVar(&page, "page", 1, "Page number") return cmd } @@ -758,6 +760,9 @@ func newIncidentSimilarCmd() *cobra.Command { _, _ = fmt.Fprintln(ctx.Writer, "No similar incidents found.") return nil } + // A top-N answer carries no total and no has-more signal: a full + // list can only say more may exist. + similarPage := listPage{Count: len(result.Items), Limit: limit, Total: -1} if ctx.Structured() { fieldNames := []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "close_time", "ack_time", "alert_cnt", "root_cause", "score", "detail_url"} @@ -776,10 +781,10 @@ func newIncidentSimilarCmd() *cobra.Command { } proj = bounded.([]map[string]any) noteProjectionBound(cmd, bound) - return ctx.Printer.Print(proj, nil) + return ctx.PrintPage(proj, nil, similarPage) } - return ctx.Printer.Print(result.Items, pastIncidentColumns()) + return ctx.PrintPage(result.Items, pastIncidentColumns(), similarPage) }) }, } @@ -1451,7 +1456,7 @@ as get, delete, and add-member.`, "Incidents", "WarRoomList"), if err != nil { return err } - return ctx.PrintTotal(result.Items, incidentWarRoomColumns(), len(result.Items)) + return ctx.PrintPage(result.Items, incidentWarRoomColumns(), listPage{Count: len(result.Items), Total: -1}) }) }, } @@ -1602,7 +1607,7 @@ This is a read-only preview of the users FlashDuty would add when if err != nil { return err } - return ctx.PrintTotal(result.Observers, incidentWarRoomObserverColumns(), len(result.Observers)) + return ctx.PrintPage(result.Observers, incidentWarRoomObserverColumns(), listPage{Count: len(result.Observers), Total: -1}) }) }, } @@ -1694,7 +1699,9 @@ func newIncidentFeedCmd() *cobra.Command { }}, } - return ctx.Printer.Print(result.Items, cols) + return ctx.PrintPage(result.Items, cols, listPage{ + Count: len(result.Items), Page: page, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), + }) }) }, } diff --git a/internal/cli/insight.go b/internal/cli/insight.go index 155034f..0a32e43 100644 --- a/internal/cli/insight.go +++ b/internal/cli/insight.go @@ -64,7 +64,7 @@ func newInsightTopAlertsCmd() *cobra.Command { }}, } - return ctx.PrintTotal(result.Items, cols, len(result.Items)) + return ctx.PrintPage(result.Items, cols, listPage{Count: len(result.Items), Limit: limit, Total: -1}) }) }, } diff --git a/internal/cli/list_completeness_test.go b/internal/cli/list_completeness_test.go new file mode 100644 index 0000000..685ad1f --- /dev/null +++ b/internal/cli/list_completeness_test.go @@ -0,0 +1,277 @@ +package cli + +import ( + "bytes" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +// pagedCmd is a command with the --page/--limit pair most list commands have. +func pagedCmd() *cobra.Command { + cmd := &cobra.Command{Use: "x"} + cmd.Flags().Int("page", 1, "") + cmd.Flags().Int("limit", 20, "") + return cmd +} + +// TestListPageStatement pins the four completeness rules, in priority order: +// a known total wins, then a has-more signal, then a full page that cannot +// tell, then the bare count. +func TestListPageStatement(t *testing.T) { + limitOnly := &cobra.Command{Use: "x"} + limitOnly.Flags().Int("limit", 5, "") + + tests := []struct { + name string + cmd *cobra.Command + pg listPage + wantFooter string + wantNote string + }{ + { + name: "a: total known, rows remain", + cmd: pagedCmd(), + pg: listPage{Count: 20, Page: 1, Limit: 20, Total: 55}, + wantFooter: "Showing 20 results (page 1, total 55).", + wantNote: "note: showing 20 of 55 total results (page 1); raise --limit or use --page 2", + }, + { + name: "a: total known, last page", + cmd: pagedCmd(), + pg: listPage{Count: 15, Page: 3, Limit: 20, Total: 55}, + wantFooter: "Showing 15 results (page 3, total 55).", + }, + { + name: "a: total beats has-more=false", + cmd: pagedCmd(), + pg: listPage{Count: 2, Page: 1, Limit: 20, Total: 9, More: moreNo}, + wantFooter: "Showing 2 results (page 1, total 9).", + wantNote: "note: showing 2 of 9 total results (page 1); raise --limit or use --page 2", + }, + { + name: "a: a total below the shown count is an absent field, not a total", + cmd: pagedCmd(), + pg: listPage{Count: 3, Page: 1, Limit: 20, Total: 0}, + wantFooter: "Showing 3 results (page 1).", + }, + { + name: "b: has-more true", + cmd: pagedCmd(), + pg: listPage{Count: 20, Page: 2, Limit: 20, Total: -1, More: moreYes}, + wantFooter: "Showing 20 results (page 2); more results exist; raise --limit or use --page 3.", + wantNote: "note: showing 20 results (page 2); more results exist; raise --limit or use --page 3", + }, + { + name: "b: has-more false, even on a full page", + cmd: pagedCmd(), + pg: listPage{Count: 20, Page: 1, Limit: 20, Total: -1, More: moreNo}, + wantFooter: "Showing 20 results (page 1).", + }, + { + name: "c: full page with no signal", + cmd: pagedCmd(), + pg: listPage{Count: 20, Page: 1, Limit: 20, Total: -1}, + wantFooter: "Showing 20 results (page 1) (= limit 20); more may exist; raise --limit or use --page 2.", + wantNote: "note: showing 20 results (page 1) (= limit 20); more may exist; raise --limit or use --page 2", + }, + { + name: "c: names only the flag the command has", + cmd: limitOnly, + pg: listPage{Count: 5, Limit: 5, Total: -1}, + wantFooter: "Showing 5 results (= limit 5); more may exist; raise --limit.", + wantNote: "note: showing 5 results (= limit 5); more may exist; raise --limit", + }, + { + name: "d: short page with no signal", + cmd: pagedCmd(), + pg: listPage{Count: 7, Page: 1, Limit: 20, Total: -1}, + wantFooter: "Showing 7 results (page 1).", + }, + { + name: "d: unknown limit", + cmd: &cobra.Command{Use: "x"}, + pg: listPage{Count: 7, Total: -1}, + wantFooter: "Showing 7 results.", + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + footer, note := tc.pg.statement(tc.cmd) + if footer != tc.wantFooter { + t.Errorf("footer = %q, want %q", footer, tc.wantFooter) + } + if note != tc.wantNote { + t.Errorf("note = %q, want %q", note, tc.wantNote) + } + }) + } +} + +// A generated command whose response is a bare array carries no total and no +// has-more flag. A full page (rows == the limit the request carried) is the +// only signal there is, and it is announced on stderr while stdout stays the +// plain array. +func TestGeneratedBareArrayFullPageNotesOnStderr(t *testing.T) { + rows := []any{ + map[string]any{"id": 1, "folder_id": 7, "name": "a"}, + map[string]any{"id": 2, "folder_id": 7, "name": "b"}, + } + args := func(limit string) []string { + return []string{"monit", "rule-list-basic", "--folder-id", "7", "--include-descendants", "--limit", limit, "--output-format", "json"} + } + + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = rows + full, fullErr, err := execCommandSplit(args("2")...) + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + want := "note: showing 2 results (= limit 2); more may exist; raise --limit" + if !strings.Contains(fullErr, want) { + t.Errorf("full page should note on stderr %q, got:\n%s", want, fullErr) + } + if strings.Contains(full, "note:") || !strings.HasPrefix(strings.TrimSpace(full), "[") { + t.Errorf("stdout must stay the bare JSON array, got:\n%s", full) + } + + saveAndResetGlobals(t) + stub = newGFStub(t) + stub.data = rows + short, shortErr, err := execCommandSplit(args("5")...) + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if strings.Contains(shortErr, "note:") { + t.Errorf("a short page proves the set is complete; no note wanted, got:\n%s", shortErr) + } + if short != full { + t.Errorf("stdout must not depend on the note:\nfull: %s\nshort: %s", full, short) + } +} + +// pagedResp is a list envelope shaped like the SDK's has_next_page responses +// that carry no total. +type pagedResp struct { + Items []heuristicRow + HasNextPage bool +} + +// cursorResp is a list envelope that pages by an opaque next cursor. +type cursorResp struct { + Items []heuristicRow + NextCursor string +} + +// An envelope that reports has_next_page / a next cursor says so in table +// mode, and a total it never returned is not invented from the row count. +func TestGenericEnvelopeMoreSignalInTableMode(t *testing.T) { + rows := []heuristicRow{{Name: "a"}, {Name: "b"}} + cursorCmd := &cobra.Command{Use: "x"} + cursorCmd.Flags().Int("limit", 20, "") + tests := []struct { + name string + cmd *cobra.Command + data any + want string + }{ + {"has_next_page true", pagedCmd(), &pagedResp{Items: rows, HasNextPage: true}, "Showing 2 results (page 1); more results exist; raise --limit or use --page 2."}, + {"has_next_page false", pagedCmd(), &pagedResp{Items: rows}, "Showing 2 results (page 1)."}, + {"next cursor set", cursorCmd, &cursorResp{Items: rows, NextCursor: "abc"}, "Showing 2 results; more results exist; raise --limit."}, + {"next cursor empty", cursorCmd, &cursorResp{Items: rows}, "Showing 2 results."}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + var buf bytes.Buffer + ctx := tableCtx(&buf) + ctx.Cmd = tc.cmd + if err := printGenericResult(ctx, tc.data, nil); err != nil { + t.Fatalf("printGenericResult: %v", err) + } + got := buf.String() + if !strings.Contains(got, tc.want) { + t.Errorf("footer %q missing from:\n%s", tc.want, got) + } + if strings.Contains(got, "Total:") || strings.Contains(got, "total") { + t.Errorf("no total was returned; none may be printed:\n%s", got) + } + }) + } +} + +// alert events used to print the row count as "Total: N" with no way to page. +func TestAlertEventsStatesCompleteness(t *testing.T) { + event := map[string]any{"event_id": "e1", "event_severity": "Critical", "event_status": "Triggered", "title": "t"} + + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = map[string]any{"items": []any{event, event}, "total": 45, "has_next_page": true} + out, _, err := execCommandSplit("alert", "events", "a1", "--limit", "2", "--page", "2") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if stub.lastBody["limit"] != float64(2) || stub.lastBody["p"] != float64(2) { + t.Errorf("--limit/--page must reach the request, got %#v", stub.lastBody) + } + if !strings.Contains(out, "Showing 2 results (page 2, total 45).") || strings.Contains(out, "Total:") { + t.Errorf("table footer should state the real total, got:\n%s", out) + } + + saveAndResetGlobals(t) + stub = newGFStub(t) + stub.data = map[string]any{"items": []any{event, event}, "total": 45, "has_next_page": true} + jsonOut, stderrText, err := execCommandSplit("alert", "events", "a1", "--limit", "2", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if !strings.HasPrefix(strings.TrimSpace(jsonOut), "[") || strings.Contains(jsonOut, "note:") { + t.Errorf("stdout must stay the bare JSON array, got:\n%s", jsonOut) + } + if !strings.Contains(stderrText, "note: showing 2 of 45 total results (page 1); raise --limit or use --page 2") { + t.Errorf("structured mode should note the remaining rows on stderr, got:\n%s", stderrText) + } +} + +// incident feed / alert timeline return has_next_page but no total. +func TestFeedCommandsSurfaceHasNextPage(t *testing.T) { + item := map[string]any{"type": "i_comm", "creator_id": 0, "created_at": 1700000000} + + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = map[string]any{"items": []any{item}, "has_next_page": true} + _, stderrText, err := execCommandSplit("incident", "feed", "inc-1", "--limit", "1", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if !strings.Contains(stderrText, "note: showing 1 results (page 1); more results exist; raise --limit or use --page 2") { + t.Errorf("has_next_page=true must be announced, got:\n%s", stderrText) + } + + saveAndResetGlobals(t) + stub = newGFStub(t) + stub.data = map[string]any{"items": []any{item}, "has_next_page": false} + _, stderrText, err = execCommandSplit("alert", "timeline", "a1", "--limit", "1", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if strings.Contains(stderrText, "note:") { + t.Errorf("has_next_page=false is a complete list; no note wanted, got:\n%s", stderrText) + } +} + +// incident similar is a top-N answer with neither a total nor a has-more flag. +func TestIncidentSimilarFullListNotes(t *testing.T) { + saveAndResetGlobals(t) + stub := newGFStub(t) + row := map[string]any{"incident_id": "p1", "title": "t", "score": 0.9} + stub.data = map[string]any{"items": []any{row, row}} + _, stderrText, err := execCommandSplit("incident", "similar", "inc-1", "--limit", "2", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if !strings.Contains(stderrText, "note: showing 2 results (= limit 2); more may exist; raise --limit") { + t.Errorf("a full top-N list should say more may exist, got:\n%s", stderrText) + } +} diff --git a/internal/cli/monit_prometheus_label_values.go b/internal/cli/monit_prometheus_label_values.go index 8228e86..3fb994a 100644 --- a/internal/cli/monit_prometheus_label_values.go +++ b/internal/cli/monit_prometheus_label_values.go @@ -35,7 +35,7 @@ API: GET /monit/prometheus/api/v1/label/{label_name}/values (monit-prometheus-re if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } diff --git a/internal/cli/monit_query.go b/internal/cli/monit_query.go index 40900c5..0c91ae0 100644 --- a/internal/cli/monit_query.go +++ b/internal/cli/monit_query.go @@ -56,7 +56,7 @@ Query tools are '.query' where '' is one of 'prometheus', 'mysql', ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, nil) }) }, } diff --git a/internal/cli/oncall.go b/internal/cli/oncall.go index 1bba0ba..435824f 100644 --- a/internal/cli/oncall.go +++ b/internal/cli/oncall.go @@ -81,7 +81,7 @@ func newOncallWhoCmd() *cobra.Command { }}, } - return ctx.PrintTotal(result.Items, cols, int(result.Total)) + return ctx.PrintList(result.Items, cols, len(result.Items), page, limit, int(result.Total)) }) }, } @@ -151,7 +151,7 @@ func newOncallScheduleListCmd() *cobra.Command { }}, } - return ctx.PrintTotal(result.Items, cols, int(result.Total)) + return ctx.PrintList(result.Items, cols, len(result.Items), page, limit, int(result.Total)) }) }, } diff --git a/internal/cli/session.go b/internal/cli/session.go index 51055ea..4e002b0 100644 --- a/internal/cli/session.go +++ b/internal/cli/session.go @@ -125,11 +125,30 @@ func newSessionListCmd() *cobra.Command { return err } + // Rows come newest first, so a row dropped by --since proves the + // window was reached and nothing newer than it is missing. + fetched := len(sessions) if sinceUnix > 0 { sessions = filterSessionsSince(sessions, sinceUnix) } + // Page 0: --page here is the page fetching starts from, not a page of + // --limit rows, so no next-page hint applies. The server total is + // comparable only when fetching starts at page 1. + pg := listPage{Count: len(sessions), Limit: limit, Total: -1} + if page <= 1 { + pg.Total = int(total) + } + if len(sessions) < fetched { + pg = listPage{Count: len(sessions), Total: -1, More: moreNo} + } - return writeSessionList(ctx.Writer, format, sessions, total) + if err := writeSessionList(ctx.Writer, format, sessions, total); err != nil { + return err + } + // The session formats are machine-readable whatever the global format + // resolved to, so only the stderr note applies. + ctx.noteIncomplete(pg) + return nil }) }, } diff --git a/internal/cli/session_test.go b/internal/cli/session_test.go index 6dbd541..603cdd4 100644 --- a/internal/cli/session_test.go +++ b/internal/cli/session_test.go @@ -292,10 +292,13 @@ func TestCommandSessionListPaginatesBeyond100(t *testing.T) { return map[string]any{"sessions": sessions, "total": totalAvailable} } - out, err := execCommand("session", "list", "--app", "ai-sre", "--limit", "200", "--output-format", "jsonl") + out, stderrText, err := execCommandSplit("session", "list", "--app", "ai-sre", "--limit", "200", "--output-format", "jsonl") if err != nil { t.Fatalf("[session-paginate] unexpected error: %v", err) } + if !strings.Contains(stderrText, "note: showing 200 of ") || !strings.Contains(stderrText, "raise --limit") || strings.Contains(stderrText, "--page") { + t.Errorf("[session-paginate] a capped fetch should note the remainder on stderr without a misleading --page hint, got:\n%s", stderrText) + } // (a) Multiple page requests were issued, and (b) p advanced across them. if stub.requests < 2 { diff --git a/internal/cli/team.go b/internal/cli/team.go index f99a209..9fc2b1c 100644 --- a/internal/cli/team.go +++ b/internal/cli/team.go @@ -66,7 +66,7 @@ Examples: nameByID := resolveTeamMemberNames(ctx, result.Items) cols := teamListColumns(nameByID) - return ctx.PrintTotal(result.Items, cols, int(result.Total)) + return ctx.PrintList(result.Items, cols, len(result.Items), page, limit, int(result.Total)) }) }, } diff --git a/internal/cli/zz_generated_a2a_agents.go b/internal/cli/zz_generated_a2a_agents.go index fbfb7b6..73dc13c 100644 --- a/internal/cli/zz_generated_a2a_agents.go +++ b/internal/cli/zz_generated_a2a_agents.go @@ -73,7 +73,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -170,7 +170,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -278,7 +278,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -337,7 +337,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -385,7 +385,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -433,7 +433,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -542,7 +542,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_account.go b/internal/cli/zz_generated_account.go index d9a9762..e01068b 100644 --- a/internal/cli/zz_generated_account.go +++ b/internal/cli/zz_generated_account.go @@ -48,7 +48,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_alert_enrichment.go b/internal/cli/zz_generated_alert_enrichment.go index 9d7c79b..31d5a0a 100644 --- a/internal/cli/zz_generated_alert_enrichment.go +++ b/internal/cli/zz_generated_alert_enrichment.go @@ -74,7 +74,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -150,7 +150,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -362,7 +362,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -439,7 +439,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -632,7 +632,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -685,7 +685,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -763,7 +763,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1052,7 +1052,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1219,7 +1219,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1281,7 +1281,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1331,7 +1331,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1398,7 +1398,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_alert_rules.go b/internal/cli/zz_generated_alert_rules.go index f80d104..2b55a26 100644 --- a/internal/cli/zz_generated_alert_rules.go +++ b/internal/cli/zz_generated_alert_rules.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -107,7 +107,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -141,7 +141,7 @@ API: POST /monit/rule/counter/channel (monit-rule-read-counter-channel) if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -180,7 +180,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -315,7 +315,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -396,7 +396,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -724,7 +724,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -967,7 +967,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1033,7 +1033,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_alerts.go b/internal/cli/zz_generated_alerts.go index 7af61d4..7907b7e 100644 --- a/internal/cli/zz_generated_alerts.go +++ b/internal/cli/zz_generated_alerts.go @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -240,7 +240,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -350,7 +350,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -467,7 +467,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -655,7 +655,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -786,7 +786,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -858,7 +858,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -928,7 +928,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_analytics.go b/internal/cli/zz_generated_analytics.go index 06d50af..4fad26c 100644 --- a/internal/cli/zz_generated_analytics.go +++ b/internal/cli/zz_generated_analytics.go @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -399,7 +399,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -601,7 +601,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -812,7 +812,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1395,7 +1395,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1958,7 +1958,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_applications.go b/internal/cli/zz_generated_applications.go index cafee33..562fc1b 100644 --- a/internal/cli/zz_generated_applications.go +++ b/internal/cli/zz_generated_applications.go @@ -86,7 +86,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -174,7 +174,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -295,7 +295,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -375,7 +375,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -475,7 +475,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -574,7 +574,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -638,7 +638,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -717,7 +717,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -776,7 +776,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_artifacts.go b/internal/cli/zz_generated_artifacts.go index ca91a7c..d7f9213 100644 --- a/internal/cli/zz_generated_artifacts.go +++ b/internal/cli/zz_generated_artifacts.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -224,7 +224,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -291,7 +291,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -393,7 +393,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -451,7 +451,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -507,7 +507,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -555,7 +555,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -610,7 +610,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_audit_logs.go b/internal/cli/zz_generated_audit_logs.go index ce23b32..c2a1719 100644 --- a/internal/cli/zz_generated_audit_logs.go +++ b/internal/cli/zz_generated_audit_logs.go @@ -38,7 +38,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -154,7 +154,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_automations.go b/internal/cli/zz_generated_automations.go index 052703f..0eb4db9 100644 --- a/internal/cli/zz_generated_automations.go +++ b/internal/cli/zz_generated_automations.go @@ -75,7 +75,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -184,7 +184,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -323,7 +323,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -383,7 +383,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -446,7 +446,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -592,7 +592,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -712,7 +712,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -771,7 +771,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_calendars.go b/internal/cli/zz_generated_calendars.go index c4263c8..6a65cfb 100644 --- a/internal/cli/zz_generated_calendars.go +++ b/internal/cli/zz_generated_calendars.go @@ -131,7 +131,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -296,7 +296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -484,7 +484,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_changes.go b/internal/cli/zz_generated_changes.go index aa47937..27f39d8 100644 --- a/internal/cli/zz_generated_changes.go +++ b/internal/cli/zz_generated_changes.go @@ -159,7 +159,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_channels.go b/internal/cli/zz_generated_channels.go index f7aeb54..38a4e13 100644 --- a/internal/cli/zz_generated_channels.go +++ b/internal/cli/zz_generated_channels.go @@ -138,7 +138,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -405,7 +405,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -662,7 +662,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -747,7 +747,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -957,7 +957,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1011,7 +1011,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1091,7 +1091,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1322,7 +1322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1558,7 +1558,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1660,7 +1660,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1902,7 +1902,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2056,7 +2056,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2282,7 +2282,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2474,7 +2474,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2556,7 +2556,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2629,7 +2629,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_dashboards.go b/internal/cli/zz_generated_dashboards.go index 5cb105f..3960353 100644 --- a/internal/cli/zz_generated_dashboards.go +++ b/internal/cli/zz_generated_dashboards.go @@ -187,7 +187,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -301,7 +301,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -385,7 +385,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -506,7 +506,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -591,7 +591,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -768,7 +768,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -892,7 +892,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -952,7 +952,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1023,7 +1023,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1126,7 +1126,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1198,7 +1198,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1381,7 +1381,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1440,7 +1440,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1538,7 +1538,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1670,7 +1670,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1835,7 +1835,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_data_query.go b/internal/cli/zz_generated_data_query.go index 12bd24c..2a0a448 100644 --- a/internal/cli/zz_generated_data_query.go +++ b/internal/cli/zz_generated_data_query.go @@ -58,7 +58,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_data_sources.go b/internal/cli/zz_generated_data_sources.go index 6591eff..184b937 100644 --- a/internal/cli/zz_generated_data_sources.go +++ b/internal/cli/zz_generated_data_sources.go @@ -56,7 +56,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -172,7 +172,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -248,7 +248,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -317,7 +317,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -571,7 +571,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_diagnostics.go b/internal/cli/zz_generated_diagnostics.go index 1fb405c..257b380 100644 --- a/internal/cli/zz_generated_diagnostics.go +++ b/internal/cli/zz_generated_diagnostics.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -167,7 +167,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_error_ingestion_rules.go b/internal/cli/zz_generated_error_ingestion_rules.go index c650e2e..5bb27d6 100644 --- a/internal/cli/zz_generated_error_ingestion_rules.go +++ b/internal/cli/zz_generated_error_ingestion_rules.go @@ -65,7 +65,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -452,7 +452,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_facets.go b/internal/cli/zz_generated_facets.go index 1b46f0f..8918b2e 100644 --- a/internal/cli/zz_generated_facets.go +++ b/internal/cli/zz_generated_facets.go @@ -89,7 +89,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -164,7 +164,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_im_integrations.go b/internal/cli/zz_generated_im_integrations.go index 5d39d0a..3a12bd3 100644 --- a/internal/cli/zz_generated_im_integrations.go +++ b/internal/cli/zz_generated_im_integrations.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_incidents.go b/internal/cli/zz_generated_incidents.go index eb86589..66a29c9 100644 --- a/internal/cli/zz_generated_incidents.go +++ b/internal/cli/zz_generated_incidents.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -135,7 +135,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -326,7 +326,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -530,7 +530,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -734,7 +734,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -833,7 +833,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1022,7 +1022,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1077,7 +1077,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1305,7 +1305,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1584,7 +1584,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1908,7 +1908,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2142,7 +2142,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2438,7 +2438,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2572,7 +2572,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -2691,7 +2691,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3267,7 +3267,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3382,7 +3382,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3449,7 +3449,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3533,7 +3533,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3627,7 +3627,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3722,7 +3722,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3844,7 +3844,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -3934,7 +3934,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4038,7 +4038,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4134,7 +4134,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4238,7 +4238,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4322,7 +4322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4384,7 +4384,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4523,7 +4523,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -4868,7 +4868,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_integrations.go b/internal/cli/zz_generated_integrations.go index 3c06dd5..cca3f4d 100644 --- a/internal/cli/zz_generated_integrations.go +++ b/internal/cli/zz_generated_integrations.go @@ -50,7 +50,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -235,7 +235,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -397,7 +397,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -607,7 +607,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -686,7 +686,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -759,7 +759,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -871,7 +871,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_issue_preset_severity_rules.go b/internal/cli/zz_generated_issue_preset_severity_rules.go index d5ab680..1f95917 100644 --- a/internal/cli/zz_generated_issue_preset_severity_rules.go +++ b/internal/cli/zz_generated_issue_preset_severity_rules.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -337,7 +337,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -463,7 +463,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_issues.go b/internal/cli/zz_generated_issues.go index 052148d..3d5818d 100644 --- a/internal/cli/zz_generated_issues.go +++ b/internal/cli/zz_generated_issues.go @@ -233,7 +233,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -386,7 +386,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_knowledge.go b/internal/cli/zz_generated_knowledge.go index 837f905..6555614 100644 --- a/internal/cli/zz_generated_knowledge.go +++ b/internal/cli/zz_generated_knowledge.go @@ -60,7 +60,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -195,7 +195,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -271,7 +271,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -333,7 +333,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -423,7 +423,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -480,7 +480,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -544,7 +544,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -618,7 +618,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_licenses.go b/internal/cli/zz_generated_licenses.go index 627ad7c..456c559 100644 --- a/internal/cli/zz_generated_licenses.go +++ b/internal/cli/zz_generated_licenses.go @@ -39,7 +39,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_mcp_servers.go b/internal/cli/zz_generated_mcp_servers.go index ee16a2b..34a32eb 100644 --- a/internal/cli/zz_generated_mcp_servers.go +++ b/internal/cli/zz_generated_mcp_servers.go @@ -76,7 +76,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -181,7 +181,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -342,7 +342,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -406,7 +406,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -454,7 +454,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -502,7 +502,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -656,7 +656,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_members.go b/internal/cli/zz_generated_members.go index 3dc3185..a7dfcb1 100644 --- a/internal/cli/zz_generated_members.go +++ b/internal/cli/zz_generated_members.go @@ -199,7 +199,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -358,7 +358,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -426,7 +426,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -701,7 +701,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_notification_templates.go b/internal/cli/zz_generated_notification_templates.go index 7a27e77..67f7b98 100644 --- a/internal/cli/zz_generated_notification_templates.go +++ b/internal/cli/zz_generated_notification_templates.go @@ -82,7 +82,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -204,7 +204,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -453,7 +453,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_resources.go b/internal/cli/zz_generated_resources.go index a549f24..b30ce52 100644 --- a/internal/cli/zz_generated_resources.go +++ b/internal/cli/zz_generated_resources.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_roles_permissions.go b/internal/cli/zz_generated_roles_permissions.go index d5450b1..034dea5 100644 --- a/internal/cli/zz_generated_roles_permissions.go +++ b/internal/cli/zz_generated_roles_permissions.go @@ -57,7 +57,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -123,7 +123,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -239,7 +239,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -580,7 +580,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_rule_folders.go b/internal/cli/zz_generated_rule_folders.go index b87d87d..f094ad8 100644 --- a/internal/cli/zz_generated_rule_folders.go +++ b/internal/cli/zz_generated_rule_folders.go @@ -43,7 +43,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_schedules.go b/internal/cli/zz_generated_schedules.go index 5371a7f..ca52877 100644 --- a/internal/cli/zz_generated_schedules.go +++ b/internal/cli/zz_generated_schedules.go @@ -62,7 +62,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -208,7 +208,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -478,7 +478,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -647,7 +647,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -859,7 +859,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1155,7 +1155,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1338,7 +1338,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_session_replay.go b/internal/cli/zz_generated_session_replay.go index e16f667..77a2409 100644 --- a/internal/cli/zz_generated_session_replay.go +++ b/internal/cli/zz_generated_session_replay.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -158,7 +158,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_sessions.go b/internal/cli/zz_generated_sessions.go index bb82d99..9870607 100644 --- a/internal/cli/zz_generated_sessions.go +++ b/internal/cli/zz_generated_sessions.go @@ -149,7 +149,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -316,7 +316,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -376,7 +376,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_skills.go b/internal/cli/zz_generated_skills.go index 85cd9a1..578d194 100644 --- a/internal/cli/zz_generated_skills.go +++ b/internal/cli/zz_generated_skills.go @@ -47,7 +47,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -122,7 +122,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -225,7 +225,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -279,7 +279,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -327,7 +327,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_sourcemaps.go b/internal/cli/zz_generated_sourcemaps.go index 3997925..7b7dd52 100644 --- a/internal/cli/zz_generated_sourcemaps.go +++ b/internal/cli/zz_generated_sourcemaps.go @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -268,7 +268,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_status_pages.go b/internal/cli/zz_generated_status_pages.go index 38ce8c8..f2ceda5 100644 --- a/internal/cli/zz_generated_status_pages.go +++ b/internal/cli/zz_generated_status_pages.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -156,7 +156,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -280,7 +280,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -427,7 +427,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -538,7 +538,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -616,7 +616,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -946,7 +946,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1044,7 +1044,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1154,7 +1154,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1239,7 +1239,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1296,7 +1296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1482,7 +1482,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1598,7 +1598,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1800,7 +1800,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1924,7 +1924,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -1988,7 +1988,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cli/zz_generated_teams.go b/internal/cli/zz_generated_teams.go index 33a4a4f..1ac4421 100644 --- a/internal/cli/zz_generated_teams.go +++ b/internal/cli/zz_generated_teams.go @@ -68,7 +68,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -124,7 +124,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } @@ -371,7 +371,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out) + return printGenericResult(ctx, out, body) }) }, } diff --git a/internal/cmd/cligen/main.go b/internal/cmd/cligen/main.go index 8af72d9..5ef7fb2 100644 --- a/internal/cmd/cligen/main.go +++ b/internal/cmd/cligen/main.go @@ -1345,7 +1345,7 @@ func emitCmd(fn string, s service, o specOp, mi methodInfo) string { case mi.HasData: fmt.Fprintf(&b, "\t\t\t\tout, _, err := %s\n", call) b.WriteString("\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n") - b.WriteString("\t\t\t\treturn printGenericResult(ctx, out)\n") + b.WriteString("\t\t\t\treturn printGenericResult(ctx, out, body)\n") default: // (*Response, error): a mutation, OR an export/attachment endpoint // whose CSV/file body the SDK surfaces on Response.Raw. Capture the diff --git a/skills/flashduty/reference/alert.md b/skills/flashduty/reference/alert.md index 09f26d8..5a62cb3 100644 --- a/skills/flashduty/reference/alert.md +++ b/skills/flashduty/reference/alert.md @@ -64,6 +64,8 @@ List events for an alert ### events List alert events +- `--limit` int +- `--page` int - response: TOP-LEVEL array — pipe `--json | jq '.[]'` (NOT `.items[]`) — fields: account_id (integer); alert_id (string); alert_key (string); channel_id (integer); created_at (string); data_source_id (integer); deleted_at (string); description (string); event_id (string); event_severity (string); event_status (string); event_time (string); images (array); integration_id (integer); integration_type (string); labels (object); title (string); title_rule (string); updated_at (string) ### feed diff --git a/skills/flashduty/reference/incident.md b/skills/flashduty/reference/incident.md index c91ef0f..022b458 100644 --- a/skills/flashduty/reference/incident.md +++ b/skills/flashduty/reference/incident.md @@ -152,6 +152,7 @@ List alerts of incident ### alerts View incident alerts - `--limit` int +- `--page` int - response: TOP-LEVEL array — pipe `--json | jq '.[]'` (NOT `.items[]`) — fields: account_id (integer); alert_id (string); alert_key (string); alert_severity (string); alert_status (string); channel_id (integer); channel_name (string); channel_status (string); created_at (string); data_source_id (integer); data_source_name (string); data_source_ref_id (string); data_source_type (string); deleted_at (string); description (string); detail_url (string); end_time (string); event_cnt (integer); events (array); ever_muted (boolean); images (array); incident (object); integration_id (integer); integration_name (string); integration_ref_id (string); integration_type (string); labels (object); last_time (string); responder_email (string); responder_name (string); start_time (string); title (string); title_rule (string); updated_at (string) ### assign From e976206ea65d73a6ac31a0fa6fcfd1207c9b52c0 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Sun, 11 Oct 2026 02:20:34 -0700 Subject: [PATCH 2/3] fix(cli): judge generated lists against the schema's default page size A generated list called without --limit is served the API's default page size, but the completeness check only knew about a limit the request carried, so a full default page (e.g. 50 rules) went unannounced. cligen now reads the structured integer `default` of a request's `limit` property (never description text) and passes it to printGenericResult, which uses it as the effective limit when the request set none. Commands whose schema declares no default pass 0 and behave as before. --- internal/cli/automation.go | 14 ++--- internal/cli/gen_support.go | 17 +++-- internal/cli/gen_support_test.go | 4 +- internal/cli/generic_table_test.go | 2 +- internal/cli/list_completeness_test.go | 42 ++++++++++++- internal/cli/monit_prometheus_label_values.go | 2 +- internal/cli/monit_query.go | 2 +- internal/cli/zz_generated_a2a_agents.go | 14 ++--- internal/cli/zz_generated_account.go | 2 +- internal/cli/zz_generated_alert_enrichment.go | 26 ++++---- internal/cli/zz_generated_alert_rules.go | 20 +++--- internal/cli/zz_generated_alerts.go | 16 ++--- internal/cli/zz_generated_analytics.go | 12 ++-- internal/cli/zz_generated_applications.go | 20 +++--- internal/cli/zz_generated_artifacts.go | 20 +++--- internal/cli/zz_generated_audit_logs.go | 4 +- internal/cli/zz_generated_automations.go | 16 ++--- internal/cli/zz_generated_calendars.go | 10 +-- internal/cli/zz_generated_changes.go | 2 +- internal/cli/zz_generated_channels.go | 32 +++++----- internal/cli/zz_generated_dashboards.go | 34 +++++----- internal/cli/zz_generated_data_query.go | 2 +- internal/cli/zz_generated_data_sources.go | 14 ++--- internal/cli/zz_generated_diagnostics.go | 4 +- .../cli/zz_generated_error_ingestion_rules.go | 6 +- internal/cli/zz_generated_facets.go | 4 +- internal/cli/zz_generated_im_integrations.go | 2 +- internal/cli/zz_generated_incidents.go | 62 +++++++++---------- internal/cli/zz_generated_integrations.go | 18 +++--- ...z_generated_issue_preset_severity_rules.go | 6 +- internal/cli/zz_generated_issues.go | 4 +- internal/cli/zz_generated_knowledge.go | 18 +++--- internal/cli/zz_generated_licenses.go | 2 +- internal/cli/zz_generated_mcp_servers.go | 14 ++--- internal/cli/zz_generated_members.go | 10 +-- .../zz_generated_notification_templates.go | 8 +-- internal/cli/zz_generated_resources.go | 2 +- .../cli/zz_generated_roles_permissions.go | 10 +-- internal/cli/zz_generated_rule_folders.go | 2 +- internal/cli/zz_generated_schedules.go | 14 ++--- internal/cli/zz_generated_session_replay.go | 4 +- internal/cli/zz_generated_sessions.go | 6 +- internal/cli/zz_generated_skills.go | 12 ++-- internal/cli/zz_generated_sourcemaps.go | 4 +- internal/cli/zz_generated_status_pages.go | 34 +++++----- internal/cli/zz_generated_teams.go | 8 +-- internal/cmd/cligen/main.go | 19 +++++- 47 files changed, 333 insertions(+), 267 deletions(-) diff --git a/internal/cli/automation.go b/internal/cli/automation.go index 2d76d87..80f66df 100644 --- a/internal/cli/automation.go +++ b/internal/cli/automation.go @@ -111,7 +111,7 @@ the rule under that team. The scope is immutable after creation. if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -167,7 +167,7 @@ func newAutomationListCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -194,7 +194,7 @@ func newAutomationGetCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -327,7 +327,7 @@ func newAutomationUpdateCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -423,7 +423,7 @@ func newAutomationRunsCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -452,7 +452,7 @@ func newAutomationTemplatesCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } @@ -490,7 +490,7 @@ The trigger authenticates with its one-time token, not the account app key. Pass if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } diff --git a/internal/cli/gen_support.go b/internal/cli/gen_support.go index 7540439..34a84ce 100644 --- a/internal/cli/gen_support.go +++ b/internal/cli/gen_support.go @@ -346,15 +346,17 @@ func bindURLTagged(body map[string]any, rv reflect.Value) { // // body is the request body the command sent (nil when it has none); it supplies // the page and page size the list-completeness statement is judged against. +// defaultLimit is the page size the API applies when the request sets none (the +// schema's declared default; 0 when it declares none). // A list-shaped response also states how complete it is: a footer in table mode, // a stderr note in structured mode (see listPage). -func printGenericResult(ctx *RunContext, data any, body map[string]any) error { +func printGenericResult(ctx *RunContext, data any, body map[string]any, defaultLimit int) error { var err error data, err = datasourceToolOutput(data, currentOutputFormat()) if err != nil { return err } - win := requestWindow(ctx.Cmd, body) + win := requestWindow(ctx.Cmd, body, defaultLimit) if ctx.Structured() { var pg listPage isList := false @@ -391,8 +393,9 @@ func printGenericResult(ctx *RunContext, data any, body map[string]any) error { // requestWindow reads the page and page size a command's request carried: the // body's "p"/"page" and "limit" keys (which cover --data and typed flags alike), // else the command's own --page/--limit flags (curated commands with defaults). -// A command with a --page flag and no explicit page is on page 1. -func requestWindow(cmd *cobra.Command, body map[string]any) listWindow { +// A command with a --page flag and no explicit page is on page 1. A request that +// sets no limit is served defaultLimit rows. +func requestWindow(cmd *cobra.Command, body map[string]any, defaultLimit int) listWindow { var win listWindow for _, key := range []string{"p", "page"} { if n := bodyInt(body[key]); n > 0 { @@ -401,6 +404,9 @@ func requestWindow(cmd *cobra.Command, body map[string]any) listWindow { } win.limit = bodyInt(body["limit"]) if cmd == nil { + if win.limit == 0 { + win.limit = defaultLimit + } return win } flagInt := func(name string) int { @@ -419,6 +425,9 @@ func requestWindow(cmd *cobra.Command, body map[string]any) listWindow { if win.limit == 0 { win.limit = flagInt("limit") } + if win.limit == 0 { + win.limit = defaultLimit + } return win } diff --git a/internal/cli/gen_support_test.go b/internal/cli/gen_support_test.go index f607697..f392e36 100644 --- a/internal/cli/gen_support_test.go +++ b/internal/cli/gen_support_test.go @@ -222,7 +222,7 @@ func TestPrintGenericResultDetailNeverBounded(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail, nil); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil, 0); err != nil { t.Fatalf("%v oversized detail errored: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(detail, nil); err != nil { @@ -303,7 +303,7 @@ func TestPrintGenericResultNestedDetailNotReduced(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail, nil); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil, 0); err != nil { t.Fatalf("%v nested detail errored: %v", f, err) } if len(got.Bytes()) < compactListOutputLimit || !strings.Contains(got.String(), strings.Repeat("report line ", 5000)) { diff --git a/internal/cli/generic_table_test.go b/internal/cli/generic_table_test.go index 6013c3a..1c0f966 100644 --- a/internal/cli/generic_table_test.go +++ b/internal/cli/generic_table_test.go @@ -297,7 +297,7 @@ func TestPrintGenericResult_StructuredUnchanged(t *testing.T) { // output to the direct printer (the agent path is untouched by the renderer). for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), resp, nil); err != nil { + if err := printGenericResult(structuredCtx(&got, f), resp, nil, 0); err != nil { t.Fatalf("%v render: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(resp, nil); err != nil { diff --git a/internal/cli/list_completeness_test.go b/internal/cli/list_completeness_test.go index 685ad1f..2da839a 100644 --- a/internal/cli/list_completeness_test.go +++ b/internal/cli/list_completeness_test.go @@ -187,7 +187,7 @@ func TestGenericEnvelopeMoreSignalInTableMode(t *testing.T) { var buf bytes.Buffer ctx := tableCtx(&buf) ctx.Cmd = tc.cmd - if err := printGenericResult(ctx, tc.data, nil); err != nil { + if err := printGenericResult(ctx, tc.data, nil, 0); err != nil { t.Fatalf("printGenericResult: %v", err) } got := buf.String() @@ -275,3 +275,43 @@ func TestIncidentSimilarFullListNotes(t *testing.T) { t.Errorf("a full top-N list should say more may exist, got:\n%s", stderrText) } } + +// With no --limit the request is served the schema's declared default page +// size (rule-list-basic: 50), so a full default page still cannot prove the +// list is complete. +func TestGeneratedBareArrayDefaultLimit(t *testing.T) { + makeRows := func(n int) []any { + rows := make([]any, n) + for i := range rows { + rows[i] = map[string]any{"id": i + 1, "folder_id": 7, "name": "r"} + } + return rows + } + run := func(t *testing.T, n int) (stdout, stderr string) { + t.Helper() + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = makeRows(n) + out, errText, err := execCommandSplit("monit", "rule-list-basic", "--folder-id", "7", "--include-descendants", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if _, sent := stub.lastBody["limit"]; sent { + t.Fatalf("no --limit was given; none may be sent, got %#v", stub.lastBody) + } + return out, errText + } + + fullOut, fullErr := run(t, 50) + if want := "note: showing 50 results (= limit 50); more may exist; raise --limit"; !strings.Contains(fullErr, want) { + t.Errorf("a full default page should note %q, got:\n%s", want, fullErr) + } + if strings.Contains(fullOut, "note:") || !strings.HasPrefix(strings.TrimSpace(fullOut), "[") { + t.Errorf("stdout must stay the bare JSON array, got prefix %q", fullOut[:min(len(fullOut), 40)]) + } + + _, shortErr := run(t, 3) + if strings.Contains(shortErr, "note:") { + t.Errorf("a short default page proves the set is complete; no note wanted, got:\n%s", shortErr) + } +} diff --git a/internal/cli/monit_prometheus_label_values.go b/internal/cli/monit_prometheus_label_values.go index 3fb994a..334abe1 100644 --- a/internal/cli/monit_prometheus_label_values.go +++ b/internal/cli/monit_prometheus_label_values.go @@ -35,7 +35,7 @@ API: GET /monit/prometheus/api/v1/label/{label_name}/values (monit-prometheus-re if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } diff --git a/internal/cli/monit_query.go b/internal/cli/monit_query.go index 0c91ae0..c8006c2 100644 --- a/internal/cli/monit_query.go +++ b/internal/cli/monit_query.go @@ -56,7 +56,7 @@ Query tools are '.query' where '' is one of 'prometheus', 'mysql', ' if err != nil { return err } - return printGenericResult(ctx, out, nil) + return printGenericResult(ctx, out, nil, 0) }) }, } diff --git a/internal/cli/zz_generated_a2a_agents.go b/internal/cli/zz_generated_a2a_agents.go index 73dc13c..114397f 100644 --- a/internal/cli/zz_generated_a2a_agents.go +++ b/internal/cli/zz_generated_a2a_agents.go @@ -73,7 +73,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -170,7 +170,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -278,7 +278,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -337,7 +337,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -385,7 +385,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -433,7 +433,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -542,7 +542,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_account.go b/internal/cli/zz_generated_account.go index e01068b..3beeb30 100644 --- a/internal/cli/zz_generated_account.go +++ b/internal/cli/zz_generated_account.go @@ -48,7 +48,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_alert_enrichment.go b/internal/cli/zz_generated_alert_enrichment.go index 31d5a0a..f4ee975 100644 --- a/internal/cli/zz_generated_alert_enrichment.go +++ b/internal/cli/zz_generated_alert_enrichment.go @@ -74,7 +74,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -150,7 +150,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -362,7 +362,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -439,7 +439,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -632,7 +632,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -685,7 +685,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -763,7 +763,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1052,7 +1052,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1219,7 +1219,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1281,7 +1281,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1331,7 +1331,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1398,7 +1398,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_alert_rules.go b/internal/cli/zz_generated_alert_rules.go index 2b55a26..f376a0a 100644 --- a/internal/cli/zz_generated_alert_rules.go +++ b/internal/cli/zz_generated_alert_rules.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -107,7 +107,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -141,7 +141,7 @@ API: POST /monit/rule/counter/channel (monit-rule-read-counter-channel) if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -180,7 +180,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -315,7 +315,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -396,7 +396,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 50) }) }, } @@ -724,7 +724,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -967,7 +967,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1033,7 +1033,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_alerts.go b/internal/cli/zz_generated_alerts.go index 7907b7e..2a0eefd 100644 --- a/internal/cli/zz_generated_alerts.go +++ b/internal/cli/zz_generated_alerts.go @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -240,7 +240,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -350,7 +350,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -467,7 +467,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -655,7 +655,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -786,7 +786,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -858,7 +858,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -928,7 +928,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_analytics.go b/internal/cli/zz_generated_analytics.go index 4fad26c..fbcb020 100644 --- a/internal/cli/zz_generated_analytics.go +++ b/internal/cli/zz_generated_analytics.go @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -399,7 +399,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -601,7 +601,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -812,7 +812,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1395,7 +1395,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -1958,7 +1958,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_applications.go b/internal/cli/zz_generated_applications.go index 562fc1b..eda5747 100644 --- a/internal/cli/zz_generated_applications.go +++ b/internal/cli/zz_generated_applications.go @@ -86,7 +86,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -174,7 +174,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -295,7 +295,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -375,7 +375,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -475,7 +475,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -574,7 +574,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -638,7 +638,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -717,7 +717,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -776,7 +776,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_artifacts.go b/internal/cli/zz_generated_artifacts.go index d7f9213..451eb8a 100644 --- a/internal/cli/zz_generated_artifacts.go +++ b/internal/cli/zz_generated_artifacts.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -224,7 +224,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -291,7 +291,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -393,7 +393,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -451,7 +451,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -507,7 +507,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -555,7 +555,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -610,7 +610,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_audit_logs.go b/internal/cli/zz_generated_audit_logs.go index c2a1719..74d9175 100644 --- a/internal/cli/zz_generated_audit_logs.go +++ b/internal/cli/zz_generated_audit_logs.go @@ -38,7 +38,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -154,7 +154,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_automations.go b/internal/cli/zz_generated_automations.go index 0eb4db9..2077c61 100644 --- a/internal/cli/zz_generated_automations.go +++ b/internal/cli/zz_generated_automations.go @@ -75,7 +75,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -184,7 +184,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -323,7 +323,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -383,7 +383,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -446,7 +446,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -592,7 +592,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -712,7 +712,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -771,7 +771,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_calendars.go b/internal/cli/zz_generated_calendars.go index 6a65cfb..7d917cb 100644 --- a/internal/cli/zz_generated_calendars.go +++ b/internal/cli/zz_generated_calendars.go @@ -131,7 +131,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -296,7 +296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -484,7 +484,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_changes.go b/internal/cli/zz_generated_changes.go index 27f39d8..1933374 100644 --- a/internal/cli/zz_generated_changes.go +++ b/internal/cli/zz_generated_changes.go @@ -159,7 +159,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 10) }) }, } diff --git a/internal/cli/zz_generated_channels.go b/internal/cli/zz_generated_channels.go index 38a4e13..bbf717a 100644 --- a/internal/cli/zz_generated_channels.go +++ b/internal/cli/zz_generated_channels.go @@ -138,7 +138,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -405,7 +405,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -662,7 +662,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -747,7 +747,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -957,7 +957,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1011,7 +1011,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1091,7 +1091,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1322,7 +1322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1558,7 +1558,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 100) }) }, } @@ -1660,7 +1660,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1902,7 +1902,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2056,7 +2056,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2282,7 +2282,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2474,7 +2474,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2556,7 +2556,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2629,7 +2629,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_dashboards.go b/internal/cli/zz_generated_dashboards.go index 3960353..5f7a656 100644 --- a/internal/cli/zz_generated_dashboards.go +++ b/internal/cli/zz_generated_dashboards.go @@ -187,7 +187,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -301,7 +301,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -385,7 +385,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -506,7 +506,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -591,7 +591,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -768,7 +768,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -892,7 +892,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -952,7 +952,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1023,7 +1023,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1126,7 +1126,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1198,7 +1198,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1381,7 +1381,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1440,7 +1440,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1538,7 +1538,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1670,7 +1670,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1835,7 +1835,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_data_query.go b/internal/cli/zz_generated_data_query.go index 2a0a448..dee199b 100644 --- a/internal/cli/zz_generated_data_query.go +++ b/internal/cli/zz_generated_data_query.go @@ -58,7 +58,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_data_sources.go b/internal/cli/zz_generated_data_sources.go index 184b937..0a18502 100644 --- a/internal/cli/zz_generated_data_sources.go +++ b/internal/cli/zz_generated_data_sources.go @@ -56,7 +56,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -172,7 +172,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -248,7 +248,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -317,7 +317,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -571,7 +571,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_diagnostics.go b/internal/cli/zz_generated_diagnostics.go index 257b380..5c5dd79 100644 --- a/internal/cli/zz_generated_diagnostics.go +++ b/internal/cli/zz_generated_diagnostics.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -167,7 +167,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_error_ingestion_rules.go b/internal/cli/zz_generated_error_ingestion_rules.go index 5bb27d6..1bc911f 100644 --- a/internal/cli/zz_generated_error_ingestion_rules.go +++ b/internal/cli/zz_generated_error_ingestion_rules.go @@ -65,7 +65,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -452,7 +452,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_facets.go b/internal/cli/zz_generated_facets.go index 8918b2e..899eccc 100644 --- a/internal/cli/zz_generated_facets.go +++ b/internal/cli/zz_generated_facets.go @@ -89,7 +89,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 100) }) }, } @@ -164,7 +164,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_im_integrations.go b/internal/cli/zz_generated_im_integrations.go index 3a12bd3..37b7142 100644 --- a/internal/cli/zz_generated_im_integrations.go +++ b/internal/cli/zz_generated_im_integrations.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_incidents.go b/internal/cli/zz_generated_incidents.go index 66a29c9..07dc24b 100644 --- a/internal/cli/zz_generated_incidents.go +++ b/internal/cli/zz_generated_incidents.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -135,7 +135,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -326,7 +326,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -530,7 +530,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 1000) }) }, } @@ -734,7 +734,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -833,7 +833,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1022,7 +1022,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1077,7 +1077,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1305,7 +1305,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -1584,7 +1584,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1908,7 +1908,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -2142,7 +2142,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2438,7 +2438,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 5) }) }, } @@ -2572,7 +2572,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -2691,7 +2691,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -3267,7 +3267,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3382,7 +3382,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3449,7 +3449,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3533,7 +3533,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3627,7 +3627,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3722,7 +3722,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3844,7 +3844,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -3934,7 +3934,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -4038,7 +4038,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 50) }) }, } @@ -4134,7 +4134,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -4238,7 +4238,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -4322,7 +4322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -4384,7 +4384,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -4523,7 +4523,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -4868,7 +4868,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_integrations.go b/internal/cli/zz_generated_integrations.go index cca3f4d..c4b61c4 100644 --- a/internal/cli/zz_generated_integrations.go +++ b/internal/cli/zz_generated_integrations.go @@ -50,7 +50,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -235,7 +235,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 100) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -397,7 +397,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -607,7 +607,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -686,7 +686,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -759,7 +759,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -871,7 +871,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_issue_preset_severity_rules.go b/internal/cli/zz_generated_issue_preset_severity_rules.go index 1f95917..3e08927 100644 --- a/internal/cli/zz_generated_issue_preset_severity_rules.go +++ b/internal/cli/zz_generated_issue_preset_severity_rules.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -337,7 +337,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -463,7 +463,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_issues.go b/internal/cli/zz_generated_issues.go index 3d5818d..cf7e337 100644 --- a/internal/cli/zz_generated_issues.go +++ b/internal/cli/zz_generated_issues.go @@ -233,7 +233,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -386,7 +386,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_knowledge.go b/internal/cli/zz_generated_knowledge.go index 6555614..337ccc9 100644 --- a/internal/cli/zz_generated_knowledge.go +++ b/internal/cli/zz_generated_knowledge.go @@ -60,7 +60,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -195,7 +195,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -271,7 +271,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -333,7 +333,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -423,7 +423,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -480,7 +480,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -544,7 +544,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -618,7 +618,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_licenses.go b/internal/cli/zz_generated_licenses.go index 456c559..ada37c2 100644 --- a/internal/cli/zz_generated_licenses.go +++ b/internal/cli/zz_generated_licenses.go @@ -39,7 +39,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_mcp_servers.go b/internal/cli/zz_generated_mcp_servers.go index 34a32eb..3e4edaf 100644 --- a/internal/cli/zz_generated_mcp_servers.go +++ b/internal/cli/zz_generated_mcp_servers.go @@ -76,7 +76,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -181,7 +181,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -342,7 +342,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -406,7 +406,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -454,7 +454,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -502,7 +502,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -656,7 +656,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_members.go b/internal/cli/zz_generated_members.go index a7dfcb1..3f946f0 100644 --- a/internal/cli/zz_generated_members.go +++ b/internal/cli/zz_generated_members.go @@ -199,7 +199,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -358,7 +358,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 100) }) }, } @@ -426,7 +426,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -701,7 +701,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_notification_templates.go b/internal/cli/zz_generated_notification_templates.go index 67f7b98..2745874 100644 --- a/internal/cli/zz_generated_notification_templates.go +++ b/internal/cli/zz_generated_notification_templates.go @@ -82,7 +82,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -204,7 +204,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -453,7 +453,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_resources.go b/internal/cli/zz_generated_resources.go index b30ce52..2997b12 100644 --- a/internal/cli/zz_generated_resources.go +++ b/internal/cli/zz_generated_resources.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_roles_permissions.go b/internal/cli/zz_generated_roles_permissions.go index 034dea5..9ab2401 100644 --- a/internal/cli/zz_generated_roles_permissions.go +++ b/internal/cli/zz_generated_roles_permissions.go @@ -57,7 +57,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -123,7 +123,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -239,7 +239,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -580,7 +580,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_rule_folders.go b/internal/cli/zz_generated_rule_folders.go index f094ad8..24d7b18 100644 --- a/internal/cli/zz_generated_rule_folders.go +++ b/internal/cli/zz_generated_rule_folders.go @@ -43,7 +43,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_schedules.go b/internal/cli/zz_generated_schedules.go index ca52877..fc3383b 100644 --- a/internal/cli/zz_generated_schedules.go +++ b/internal/cli/zz_generated_schedules.go @@ -62,7 +62,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -208,7 +208,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -478,7 +478,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -647,7 +647,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -859,7 +859,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 10) }) }, } @@ -1155,7 +1155,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1338,7 +1338,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_session_replay.go b/internal/cli/zz_generated_session_replay.go index 77a2409..26bef7f 100644 --- a/internal/cli/zz_generated_session_replay.go +++ b/internal/cli/zz_generated_session_replay.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -158,7 +158,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } diff --git a/internal/cli/zz_generated_sessions.go b/internal/cli/zz_generated_sessions.go index 9870607..4e0a09a 100644 --- a/internal/cli/zz_generated_sessions.go +++ b/internal/cli/zz_generated_sessions.go @@ -149,7 +149,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -316,7 +316,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -376,7 +376,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_skills.go b/internal/cli/zz_generated_skills.go index 578d194..5f935f7 100644 --- a/internal/cli/zz_generated_skills.go +++ b/internal/cli/zz_generated_skills.go @@ -47,7 +47,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -122,7 +122,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -225,7 +225,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -279,7 +279,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -327,7 +327,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_sourcemaps.go b/internal/cli/zz_generated_sourcemaps.go index 7b7dd52..11a3442 100644 --- a/internal/cli/zz_generated_sourcemaps.go +++ b/internal/cli/zz_generated_sourcemaps.go @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -268,7 +268,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_status_pages.go b/internal/cli/zz_generated_status_pages.go index f2ceda5..4491a4d 100644 --- a/internal/cli/zz_generated_status_pages.go +++ b/internal/cli/zz_generated_status_pages.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -156,7 +156,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -280,7 +280,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -427,7 +427,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -538,7 +538,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -616,7 +616,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -946,7 +946,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1044,7 +1044,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1154,7 +1154,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1239,7 +1239,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1296,7 +1296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1482,7 +1482,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1598,7 +1598,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1800,7 +1800,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1924,7 +1924,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -1988,7 +1988,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cli/zz_generated_teams.go b/internal/cli/zz_generated_teams.go index 1ac4421..8d70cda 100644 --- a/internal/cli/zz_generated_teams.go +++ b/internal/cli/zz_generated_teams.go @@ -68,7 +68,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -124,7 +124,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 20) }) }, } @@ -371,7 +371,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body) + return printGenericResult(ctx, out, body, 0) }) }, } diff --git a/internal/cmd/cligen/main.go b/internal/cmd/cligen/main.go index 5ef7fb2..9ee9560 100644 --- a/internal/cmd/cligen/main.go +++ b/internal/cmd/cligen/main.go @@ -173,6 +173,7 @@ type specField struct { Desc string Enum []string Constraint string // compact bound, e.g. "max 100", "1-39 chars" + Default int // schema `default` of an integer property; 0 when the schema has none } func collectServices(paths, schemas map[string]any, sdk map[string]map[string]methodInfo) []service { @@ -469,6 +470,7 @@ func (w *specWalker) fields(op map[string]any) []specField { Desc: propertyDescription(raw, pv), Enum: w.enumOf(pv), Constraint: constraintOf(pv), + Default: intDefault(pv), }) } } @@ -582,6 +584,15 @@ func constraintOf(s map[string]any) string { return strings.Join(parts, ", ") } +// intDefault returns a property schema's structured integer `default`, or 0 +// when it declares none. Description text is never read for a default. +func intDefault(s map[string]any) int { + if n, ok := s["default"].(float64); ok && n > 0 && n == float64(int64(n)) { + return int(n) + } + return 0 +} + // numStr formats a JSON number (float64 / json.Number) without a trailing ".0", // returning ok=false for nil/non-numeric so callers can omit absent bounds. func numStr(v any) (string, bool) { @@ -1345,7 +1356,13 @@ func emitCmd(fn string, s service, o specOp, mi methodInfo) string { case mi.HasData: fmt.Fprintf(&b, "\t\t\t\tout, _, err := %s\n", call) b.WriteString("\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n") - b.WriteString("\t\t\t\treturn printGenericResult(ctx, out, body)\n") + defaultLimit := 0 + for _, f := range o.Fields { + if f.Wire == "limit" { + defaultLimit = f.Default + } + } + fmt.Fprintf(&b, "\t\t\t\treturn printGenericResult(ctx, out, body, %d)\n", defaultLimit) default: // (*Response, error): a mutation, OR an export/attachment endpoint // whose CSV/file body the SDK surfaces on Response.Raw. Capture the From 6a6db05d92d77218dc3300ef68a539c2492ebd35 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Sun, 11 Oct 2026 02:29:03 -0700 Subject: [PATCH 3/3] fix(cli): page base, unknown limit, and wording of list completeness notes - Page numbering now comes from the request schema's structured default for the page property (1 = one-based, 0 = zero-based, none = unknown) through a generated Service.Method table (listDefaultsFor), shared by generated and curated commands together with the default page size. Zero-based lists no longer skip a page in the hint or false-alarm on their last page; when the base is unknown the note names no page number and claims a remainder only for the first page. - The "rows remain" judgment from a page offset is made only when the offset is knowable (first page, or known page size and base); it no longer estimates the page size from the row count. - alert events sends --limit/--page only when set and is judged against the schema default page size. - Wording: singular "1 result", and one separator scheme across the rules: "showing , : ". --- internal/cli/alert.go | 12 +- internal/cli/automation.go | 14 +- internal/cli/command.go | 144 +++++++++++---- internal/cli/command_test.go | 6 +- internal/cli/gen_support.go | 50 +++-- internal/cli/gen_support_test.go | 4 +- internal/cli/generic_table.go | 10 +- internal/cli/generic_table_test.go | 2 +- internal/cli/incident.go | 2 +- internal/cli/list_completeness_test.go | 174 ++++++++++++++---- internal/cli/monit_prometheus_label_values.go | 2 +- internal/cli/monit_query.go | 2 +- internal/cli/zz_generated_a2a_agents.go | 14 +- internal/cli/zz_generated_account.go | 2 +- internal/cli/zz_generated_alert_enrichment.go | 26 +-- internal/cli/zz_generated_alert_rules.go | 20 +- internal/cli/zz_generated_alerts.go | 16 +- internal/cli/zz_generated_analytics.go | 12 +- internal/cli/zz_generated_applications.go | 20 +- internal/cli/zz_generated_artifacts.go | 20 +- internal/cli/zz_generated_audit_logs.go | 4 +- internal/cli/zz_generated_automations.go | 16 +- internal/cli/zz_generated_calendars.go | 10 +- internal/cli/zz_generated_changes.go | 2 +- internal/cli/zz_generated_channels.go | 32 ++-- internal/cli/zz_generated_dashboards.go | 34 ++-- internal/cli/zz_generated_data_query.go | 2 +- internal/cli/zz_generated_data_sources.go | 14 +- internal/cli/zz_generated_diagnostics.go | 4 +- .../cli/zz_generated_error_ingestion_rules.go | 6 +- internal/cli/zz_generated_facets.go | 4 +- internal/cli/zz_generated_im_integrations.go | 2 +- internal/cli/zz_generated_incidents.go | 62 +++---- internal/cli/zz_generated_integrations.go | 18 +- ...z_generated_issue_preset_severity_rules.go | 6 +- internal/cli/zz_generated_issues.go | 4 +- internal/cli/zz_generated_knowledge.go | 18 +- internal/cli/zz_generated_licenses.go | 2 +- internal/cli/zz_generated_list_defaults.go | 53 ++++++ internal/cli/zz_generated_mcp_servers.go | 14 +- internal/cli/zz_generated_members.go | 10 +- .../zz_generated_notification_templates.go | 8 +- internal/cli/zz_generated_resources.go | 2 +- .../cli/zz_generated_roles_permissions.go | 10 +- internal/cli/zz_generated_rule_folders.go | 2 +- internal/cli/zz_generated_schedules.go | 14 +- internal/cli/zz_generated_session_replay.go | 4 +- internal/cli/zz_generated_sessions.go | 6 +- internal/cli/zz_generated_skills.go | 12 +- internal/cli/zz_generated_sourcemaps.go | 4 +- internal/cli/zz_generated_status_pages.go | 34 ++-- internal/cli/zz_generated_teams.go | 8 +- internal/cmd/cligen/main.go | 80 +++++++- 53 files changed, 683 insertions(+), 370 deletions(-) create mode 100644 internal/cli/zz_generated_list_defaults.go diff --git a/internal/cli/alert.go b/internal/cli/alert.go index 3d00980..8317f07 100644 --- a/internal/cli/alert.go +++ b/internal/cli/alert.go @@ -231,15 +231,19 @@ func newAlertEventsCmd() *cobra.Command { {Header: "TITLE", MaxWidth: 50, Field: func(v any) string { return v.(flashduty.AlertEventItem).Title }}, } + // Flags left unset are not sent; the statement is judged against + // the schema defaults the server then applies. + defaults := listDefaultsFor("Alerts", "ReadEventList") + win := requestWindow(ctx.Cmd, nil, defaults) return ctx.PrintPage(result.Items, cols, listPage{ - Count: len(result.Items), Page: page, Limit: limit, Total: int(result.Total), More: moreOf(result.HasNextPage), + Count: len(result.Items), Page: win.page, Base: win.base, Limit: win.limit, Total: int(result.Total), More: moreOf(result.HasNextPage), }) }) }, } - cmd.Flags().IntVar(&limit, "limit", 20, "Max events (max 100)") - cmd.Flags().IntVar(&page, "page", 1, "Page number") + cmd.Flags().IntVar(&limit, "limit", 0, "Max events (max 100; server default 20)") + cmd.Flags().IntVar(&page, "page", 0, "Page number (starts at 1)") return cmd } @@ -298,7 +302,7 @@ func newAlertTimelineCmd() *cobra.Command { } return ctx.PrintPage(result.Items, cols, listPage{ - Count: len(result.Items), Page: page, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), + Count: len(result.Items), Page: page, Base: pageOne, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), }) }) }, diff --git a/internal/cli/automation.go b/internal/cli/automation.go index 80f66df..0ebdb49 100644 --- a/internal/cli/automation.go +++ b/internal/cli/automation.go @@ -111,7 +111,7 @@ the rule under that team. The scope is immutable after creation. if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } @@ -167,7 +167,7 @@ func newAutomationListCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaultsFor("Automations", "RuleReadList")) }) }, } @@ -194,7 +194,7 @@ func newAutomationGetCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } @@ -327,7 +327,7 @@ func newAutomationUpdateCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } @@ -423,7 +423,7 @@ func newAutomationRunsCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaultsFor("Automations", "RunReadList")) }) }, } @@ -452,7 +452,7 @@ func newAutomationTemplatesCmd() *cobra.Command { if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } @@ -490,7 +490,7 @@ The trigger authenticates with its one-time token, not the account app key. Pass if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } diff --git a/internal/cli/command.go b/internal/cli/command.go index b83019f..eea95b0 100644 --- a/internal/cli/command.go +++ b/internal/cli/command.go @@ -64,21 +64,81 @@ func moreOf(hasNext bool) moreState { return moreNo } +// pageBase says how a command numbers its pages. The zero value means the +// command has no page notion at all. +type pageBase int8 + +const ( + pageNone pageBase = iota // no page number (top-N lists, one-shot lists) + pageOne // pages start at 1 + pageZero // pages start at 0 + pageUnknown // pages by number, base not declared by the API schema +) + +// listDefaults is what an API's request schema declares for a list: the page +// size served when the request sets none (0 when undeclared) and how pages are +// numbered. +type listDefaults struct { + Limit int + PageBase pageBase +} + +// listDefaultsFor returns the schema-declared defaults of an SDK Service.Method. +func listDefaultsFor(service, method string) listDefaults { + return listDefaultsBySDKMethod[service+"."+method] +} + // listPage is everything a list response tells us about its own completeness. // It is the single input to the completeness statement every list output makes, // so a partial page is never mistaken for the whole set. type listPage struct { Count int // rows shown - Page int // 1-based page; 0 when the command has no page notion - Limit int // page size requested or the known default; 0 when unknown + Page int // page number as sent to the API (0 when the request set none) + Base pageBase // how Page is numbered + Limit int // effective page size: requested, else the schema default; 0 when unknown Total int // total matching rows; negative when the API returned none More moreState // has_next_page / next cursor, when the API returned one } // totalKnown reports whether Total is a usable server total. A total below the -// shown count is an absent field decoded as zero, not a real total. +// shown count is an absent field, not a real total. func (p listPage) totalKnown() bool { return p.Total >= 0 && p.Total >= p.Count } +// offset returns how many rows precede this page, when that is knowable: always +// for the first page, and for later pages only with a known page size and base. +func (p listPage) offset() (int, bool) { + switch { + case p.Base == pageNone, p.Page == 0 && p.Base != pageOne, p.Base == pageOne && p.Page <= 1: + return 0, true + case p.Limit <= 0: + return 0, false + case p.Base == pageOne: + return max(p.Page-1, 0) * p.Limit, true + case p.Base == pageZero: + return p.Page * p.Limit, true + } + return 0, false +} + +// nextPage returns the page number after this one, when the base is known. +func (p listPage) nextPage() (int, bool) { + if p.Base != pageOne && p.Base != pageZero { + return 0, false + } + if p.Base == pageOne { + return max(p.Page, 1) + 1, true + } + return p.Page + 1, true +} + +// results renders a row count with its noun. +func results(n int) string { + if n == 1 { + return "1 result" + } + return fmt.Sprintf("%d results", n) +} + // statement applies the completeness rules in order and returns the table // footer and the structured-mode stderr note ("" when no warning applies): // @@ -87,54 +147,72 @@ func (p listPage) totalKnown() bool { return p.Total >= 0 && p.Total >= p.Count // c. else a full page (N == limit) cannot tell: warn that more may exist; // d. else only the plain count. // -// A count is never labelled a total. +// A count is never labelled a total, and "rows remain" is claimed from a page +// offset only when that offset is known. func (p listPage) statement(cmd *cobra.Command) (footer, note string) { - pageSuffix := "" - if p.Page > 0 { - pageSuffix = fmt.Sprintf(" (page %d)", p.Page) + pageText := "" + if p.Base != pageNone && (p.Page > 0 || p.Base == pageOne || p.Base == pageZero) { + pageText = fmt.Sprintf("page %d", p.Page) } - hint := moreHint(cmd, p.Page) - warn := func(body string) (string, string) { + paren := func(extra string) string { + switch { + case pageText != "" && extra != "": + return " (" + pageText + ", " + extra + ")" + case pageText != "": + return " (" + pageText + ")" + case extra != "": + return " (" + extra + ")" + } + return "" + } + hint := moreHint(cmd, p) + // warn builds the footer and note for a partial list: ", : ". + warn := func(shown, why string) (string, string) { + body := "showing " + shown + if why != "" { + body += ", " + why + } if hint != "" { - body += "; " + hint + body += ": " + hint } return "S" + body[1:] + ".", "note: " + body } switch { case p.totalKnown(): - if p.Page > 0 { - footer = fmt.Sprintf("Showing %d results (page %d, total %d).", p.Count, p.Page, p.Total) - } else { - footer = fmt.Sprintf("Showing %d results (total %d).", p.Count, p.Total) - } - offset := (max(p.Page, 1) - 1) * p.Limit - if p.Limit == 0 { - offset = (max(p.Page, 1) - 1) * p.Count - } - if offset+p.Count < p.Total { - _, note = warn(fmt.Sprintf("showing %d of %d total results%s", p.Count, p.Total, pageSuffix)) + footer = fmt.Sprintf("Showing %s%s.", results(p.Count), paren(fmt.Sprintf("total %d", p.Total))) + if off, ok := p.offset(); ok && off+p.Count < p.Total { + body := fmt.Sprintf("showing %d of %d total results%s", p.Count, p.Total, paren("")) + if hint != "" { + body += ": " + hint + } + note = "note: " + body } return footer, note case p.More == moreYes: - return warn(fmt.Sprintf("showing %d results%s; more results exist", p.Count, pageSuffix)) + return warn(results(p.Count)+paren(""), "more exist") case p.More == moreNo: - return fmt.Sprintf("Showing %d results%s.", p.Count, pageSuffix), "" + return fmt.Sprintf("Showing %s%s.", results(p.Count), paren("")), "" case p.Limit > 0 && p.Count == p.Limit: - return warn(fmt.Sprintf("showing %d results%s (= limit %d); more may exist", p.Count, pageSuffix, p.Limit)) + return warn(results(p.Count)+paren(fmt.Sprintf("= limit %d", p.Limit)), "more may exist") } - return fmt.Sprintf("Showing %d results%s.", p.Count, pageSuffix), "" + return fmt.Sprintf("Showing %s%s.", results(p.Count), paren("")), "" } // moreHint names the flags this command actually has for reaching further rows. -// page is the page just shown; 0 means the command has no page notion, so --page -// is not offered. -func moreHint(cmd *cobra.Command, page int) string { +// A page number is offered only when the page base is known. +func moreHint(cmd *cobra.Command, p listPage) string { has := func(name string) bool { return cmd.Flags().Lookup(name) != nil } + paged := p.Base != pageNone && has("page") + next, nextKnown := p.nextPage() + pageFlag := "--page" + if nextKnown { + pageFlag = fmt.Sprintf("--page %d", next) + } switch { - case page > 0 && has("page") && has("limit"): - return fmt.Sprintf("raise --limit or use --page %d", page+1) - case page > 0 && has("page"): - return fmt.Sprintf("use --page %d", page+1) + case paged && has("limit"): + return "raise --limit or use " + pageFlag + case paged: + return "use " + pageFlag case has("search-after-ctx"): return "pass the response's search_after_ctx as --search-after-ctx" case has("cursor"): @@ -176,7 +254,7 @@ func (ctx *RunContext) PrintPage(items any, cols []output.Column, pg listPage) e // PrintList is PrintPage for a response that carried a total. func (ctx *RunContext) PrintList(items any, cols []output.Column, count, page, limit, total int) error { - return ctx.PrintPage(items, cols, listPage{Count: count, Page: page, Limit: limit, Total: total}) + return ctx.PrintPage(items, cols, listPage{Count: count, Page: page, Base: pageOne, Limit: limit, Total: total}) } // WriteResult prints a success message as plain text or JSON. diff --git a/internal/cli/command_test.go b/internal/cli/command_test.go index d7e20a2..b12af01 100644 --- a/internal/cli/command_test.go +++ b/internal/cli/command_test.go @@ -1403,7 +1403,7 @@ func TestCommandIncidentWarRoomDefaultObservers(t *testing.T) { if stub.lastBody["incident_id"] != "inc-1" { t.Fatalf("[incident-war-room-default-observers] expected incident inc-1, got %#v", stub.lastBody) } - if !strings.Contains(out, "Alice") || !strings.Contains(out, "alice@example.com") || !strings.Contains(out, "Showing 1 results.") { + if !strings.Contains(out, "Alice") || !strings.Contains(out, "alice@example.com") || !strings.Contains(out, "Showing 1 result.") { t.Fatalf("[incident-war-room-default-observers] unexpected output:\n%s", out) } } @@ -1427,7 +1427,7 @@ func TestCommandIncidentWarRoomList(t *testing.T) { if stub.lastBody["incident_id"] != "inc-1" || stub.lastBody["integration_id"] != float64(42) { t.Fatalf("[incident-war-room-list] unexpected input: %#v", stub.lastBody) } - if !strings.Contains(out, "chat-1") || !strings.Contains(out, "Showing 1 results.") { + if !strings.Contains(out, "chat-1") || !strings.Contains(out, "Showing 1 result.") { t.Fatalf("[incident-war-room-list] unexpected output:\n%s", out) } } @@ -1533,7 +1533,7 @@ func TestCommandAuditSearchPageUsesCursorPagination(t *testing.T) { if strings.Contains(out, "Alice") || strings.Contains(out, "page-1") { t.Fatalf("[audit-search-page] output should not contain first page rows, got:\n%s", out) } - if !strings.Contains(out, "Showing 1 results (page 2, total 2).") { + if !strings.Contains(out, "Showing 1 result (page 2, total 2).") { t.Fatalf("[audit-search-page] expected paginated footer, got:\n%s", out) } if len(stub.bodies) != 2 { diff --git a/internal/cli/gen_support.go b/internal/cli/gen_support.go index 34a84ce..8dfacd4 100644 --- a/internal/cli/gen_support.go +++ b/internal/cli/gen_support.go @@ -346,17 +346,17 @@ func bindURLTagged(body map[string]any, rv reflect.Value) { // // body is the request body the command sent (nil when it has none); it supplies // the page and page size the list-completeness statement is judged against. -// defaultLimit is the page size the API applies when the request sets none (the -// schema's declared default; 0 when it declares none). +// defaults are the schema-declared page size and page numbering of the list (zero +// when the schema declares none). // A list-shaped response also states how complete it is: a footer in table mode, // a stderr note in structured mode (see listPage). -func printGenericResult(ctx *RunContext, data any, body map[string]any, defaultLimit int) error { +func printGenericResult(ctx *RunContext, data any, body map[string]any, defaults listDefaults) error { var err error data, err = datasourceToolOutput(data, currentOutputFormat()) if err != nil { return err } - win := requestWindow(ctx.Cmd, body, defaultLimit) + win := requestWindow(ctx.Cmd, body, defaults) if ctx.Structured() { var pg listPage isList := false @@ -392,41 +392,37 @@ func printGenericResult(ctx *RunContext, data any, body map[string]any, defaultL // requestWindow reads the page and page size a command's request carried: the // body's "p"/"page" and "limit" keys (which cover --data and typed flags alike), -// else the command's own --page/--limit flags (curated commands with defaults). -// A command with a --page flag and no explicit page is on page 1. A request that -// sets no limit is served defaultLimit rows. -func requestWindow(cmd *cobra.Command, body map[string]any, defaultLimit int) listWindow { - var win listWindow +// else the command's own --page/--limit flag values (curated commands with +// defaults). A request that sets no limit is served the schema default; a +// one-based command that sets no page is on page 1. +func requestWindow(cmd *cobra.Command, body map[string]any, defaults listDefaults) listWindow { + win := listWindow{base: defaults.PageBase} for _, key := range []string{"p", "page"} { if n := bodyInt(body[key]); n > 0 { win.page = n } } win.limit = bodyInt(body["limit"]) - if cmd == nil { - if win.limit == 0 { - win.limit = defaultLimit + if cmd != nil { + flagInt := func(name string) int { + if f := cmd.Flags().Lookup(name); f != nil { + n, _ := strconv.Atoi(f.Value.String()) + return n + } + return 0 } - return win - } - flagInt := func(name string) int { - if f := cmd.Flags().Lookup(name); f != nil { - n, _ := strconv.Atoi(f.Value.String()) - return n + if win.page == 0 { + win.page = flagInt("page") } - return 0 - } - if win.page == 0 { - win.page = flagInt("page") - if win.page == 0 && cmd.Flags().Lookup("page") != nil { - win.page = 1 + if win.limit == 0 { + win.limit = flagInt("limit") } } if win.limit == 0 { - win.limit = flagInt("limit") + win.limit = defaults.Limit } - if win.limit == 0 { - win.limit = defaultLimit + if win.page == 0 && win.base == pageOne { + win.page = 1 } return win } diff --git a/internal/cli/gen_support_test.go b/internal/cli/gen_support_test.go index f392e36..0f15a8d 100644 --- a/internal/cli/gen_support_test.go +++ b/internal/cli/gen_support_test.go @@ -222,7 +222,7 @@ func TestPrintGenericResultDetailNeverBounded(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail, nil, 0); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil, listDefaults{}); err != nil { t.Fatalf("%v oversized detail errored: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(detail, nil); err != nil { @@ -303,7 +303,7 @@ func TestPrintGenericResultNestedDetailNotReduced(t *testing.T) { for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), detail, nil, 0); err != nil { + if err := printGenericResult(structuredCtx(&got, f), detail, nil, listDefaults{}); err != nil { t.Fatalf("%v nested detail errored: %v", f, err) } if len(got.Bytes()) < compactListOutputLimit || !strings.Contains(got.String(), strings.Repeat("report line ", 5000)) { diff --git a/internal/cli/generic_table.go b/internal/cli/generic_table.go index d86dace..2a9889e 100644 --- a/internal/cli/generic_table.go +++ b/internal/cli/generic_table.go @@ -73,14 +73,18 @@ func renderGenericTable(ctx *RunContext, data any, win listWindow) error { return jsonFallback(ctx, data) } -// listWindow is the page and page size the request carried (0 = not stated). -type listWindow struct{ page, limit int } +// listWindow is the page and page size a request was served: what it carried, +// else the schema defaults (0 = unknown). +type listWindow struct { + page, limit int + base pageBase +} // genericListPage reports whether v (a dereferenced typed response) is // list-shaped — a row array, or a paginated envelope — and, when it is, // returns the rows with what the response says about its own completeness. func genericListPage(v reflect.Value, win listWindow) (rows reflect.Value, pg listPage, ok bool) { - pg = listPage{Page: win.page, Limit: win.limit, Total: -1} + pg = listPage{Page: win.page, Base: win.base, Limit: win.limit, Total: -1} switch v.Kind() { case reflect.Slice: if !isRowSlice(v.Type()) { diff --git a/internal/cli/generic_table_test.go b/internal/cli/generic_table_test.go index 1c0f966..a733d7d 100644 --- a/internal/cli/generic_table_test.go +++ b/internal/cli/generic_table_test.go @@ -297,7 +297,7 @@ func TestPrintGenericResult_StructuredUnchanged(t *testing.T) { // output to the direct printer (the agent path is untouched by the renderer). for _, f := range []output.Format{output.FormatJSON, output.FormatTOON} { var got, want bytes.Buffer - if err := printGenericResult(structuredCtx(&got, f), resp, nil, 0); err != nil { + if err := printGenericResult(structuredCtx(&got, f), resp, nil, listDefaults{}); err != nil { t.Fatalf("%v render: %v", f, err) } if err := output.NewPrinter(f, false, &want).Print(resp, nil); err != nil { diff --git a/internal/cli/incident.go b/internal/cli/incident.go index b1fac24..04aa10f 100644 --- a/internal/cli/incident.go +++ b/internal/cli/incident.go @@ -1700,7 +1700,7 @@ func newIncidentFeedCmd() *cobra.Command { } return ctx.PrintPage(result.Items, cols, listPage{ - Count: len(result.Items), Page: page, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), + Count: len(result.Items), Page: page, Base: pageOne, Limit: limit, Total: -1, More: moreOf(result.HasNextPage), }) }) }, diff --git a/internal/cli/list_completeness_test.go b/internal/cli/list_completeness_test.go index 2da839a..2291998 100644 --- a/internal/cli/list_completeness_test.go +++ b/internal/cli/list_completeness_test.go @@ -23,6 +23,10 @@ func TestListPageStatement(t *testing.T) { limitOnly := &cobra.Command{Use: "x"} limitOnly.Flags().Int("limit", 5, "") + zeroPaged := &cobra.Command{Use: "x"} + zeroPaged.Flags().Int("page", 0, "") + zeroPaged.Flags().Int("limit", 20, "") + tests := []struct { name string cmd *cobra.Command @@ -33,60 +37,99 @@ func TestListPageStatement(t *testing.T) { { name: "a: total known, rows remain", cmd: pagedCmd(), - pg: listPage{Count: 20, Page: 1, Limit: 20, Total: 55}, + pg: listPage{Count: 20, Page: 1, Base: pageOne, Limit: 20, Total: 55}, wantFooter: "Showing 20 results (page 1, total 55).", - wantNote: "note: showing 20 of 55 total results (page 1); raise --limit or use --page 2", + wantNote: "note: showing 20 of 55 total results (page 1): raise --limit or use --page 2", }, { name: "a: total known, last page", cmd: pagedCmd(), - pg: listPage{Count: 15, Page: 3, Limit: 20, Total: 55}, + pg: listPage{Count: 15, Page: 3, Base: pageOne, Limit: 20, Total: 55}, wantFooter: "Showing 15 results (page 3, total 55).", }, { name: "a: total beats has-more=false", cmd: pagedCmd(), - pg: listPage{Count: 2, Page: 1, Limit: 20, Total: 9, More: moreNo}, + pg: listPage{Count: 2, Page: 1, Base: pageOne, Limit: 20, Total: 9, More: moreNo}, wantFooter: "Showing 2 results (page 1, total 9).", - wantNote: "note: showing 2 of 9 total results (page 1); raise --limit or use --page 2", + wantNote: "note: showing 2 of 9 total results (page 1): raise --limit or use --page 2", }, { name: "a: a total below the shown count is an absent field, not a total", cmd: pagedCmd(), - pg: listPage{Count: 3, Page: 1, Limit: 20, Total: 0}, + pg: listPage{Count: 3, Page: 1, Base: pageOne, Limit: 20, Total: 0}, wantFooter: "Showing 3 results (page 1).", }, { - name: "b: has-more true", + name: "a: zero-based pages: first page, next is 1", + cmd: zeroPaged, + pg: listPage{Count: 20, Page: 0, Base: pageZero, Limit: 20, Total: 25}, + wantFooter: "Showing 20 results (page 0, total 25).", + wantNote: "note: showing 20 of 25 total results (page 0): raise --limit or use --page 1", + }, + { + name: "a: zero-based pages: last page is complete", + cmd: zeroPaged, + pg: listPage{Count: 5, Page: 1, Base: pageZero, Limit: 20, Total: 25}, + wantFooter: "Showing 5 results (page 1, total 25).", + }, + { + name: "a: unknown page base, first page: remainder known, no page number offered", cmd: pagedCmd(), - pg: listPage{Count: 20, Page: 2, Limit: 20, Total: -1, More: moreYes}, - wantFooter: "Showing 20 results (page 2); more results exist; raise --limit or use --page 3.", - wantNote: "note: showing 20 results (page 2); more results exist; raise --limit or use --page 3", + pg: listPage{Count: 20, Base: pageUnknown, Limit: 20, Total: 25}, + wantFooter: "Showing 20 results (total 25).", + wantNote: "note: showing 20 of 25 total results: raise --limit or use --page", + }, + { + name: "a: unknown page base, later page: no claim of more", + cmd: pagedCmd(), + pg: listPage{Count: 5, Page: 2, Base: pageUnknown, Limit: 20, Total: 25}, + wantFooter: "Showing 5 results (page 2, total 25).", + }, + { + name: "a: unknown limit, later page: no claim of more", + cmd: pagedCmd(), + pg: listPage{Count: 5, Page: 3, Base: pageOne, Total: 45}, + wantFooter: "Showing 5 results (page 3, total 45).", + }, + { + name: "a: unknown limit, first page: remainder still known", + cmd: pagedCmd(), + pg: listPage{Count: 5, Page: 1, Base: pageOne, Total: 45}, + wantFooter: "Showing 5 results (page 1, total 45).", + wantNote: "note: showing 5 of 45 total results (page 1): raise --limit or use --page 2", + }, + { + name: "b: has-more true, singular noun", + cmd: pagedCmd(), + pg: listPage{Count: 1, Page: 1, Base: pageOne, Limit: 1, Total: -1, More: moreYes}, + wantFooter: "Showing 1 result (page 1), more exist: raise --limit or use --page 2.", + wantNote: "note: showing 1 result (page 1), more exist: raise --limit or use --page 2", }, { name: "b: has-more false, even on a full page", cmd: pagedCmd(), - pg: listPage{Count: 20, Page: 1, Limit: 20, Total: -1, More: moreNo}, + pg: listPage{Count: 20, Page: 1, Base: pageOne, Limit: 20, Total: -1, More: moreNo}, wantFooter: "Showing 20 results (page 1).", }, { name: "c: full page with no signal", cmd: pagedCmd(), - pg: listPage{Count: 20, Page: 1, Limit: 20, Total: -1}, - wantFooter: "Showing 20 results (page 1) (= limit 20); more may exist; raise --limit or use --page 2.", - wantNote: "note: showing 20 results (page 1) (= limit 20); more may exist; raise --limit or use --page 2", + pg: listPage{Count: 20, Page: 1, Base: pageOne, Limit: 20, Total: -1}, + wantFooter: "Showing 20 results (page 1, = limit 20), more may exist: raise --limit or use --page 2.", + wantNote: "note: showing 20 results (page 1, = limit 20), more may exist: raise --limit or use --page 2", }, { name: "c: names only the flag the command has", cmd: limitOnly, pg: listPage{Count: 5, Limit: 5, Total: -1}, - wantFooter: "Showing 5 results (= limit 5); more may exist; raise --limit.", - wantNote: "note: showing 5 results (= limit 5); more may exist; raise --limit", + wantFooter: "Showing 5 results (= limit 5), more may exist: raise --limit.", + wantNote: "note: showing 5 results (= limit 5), more may exist: raise --limit", }, { name: "d: short page with no signal", cmd: pagedCmd(), - pg: listPage{Count: 7, Page: 1, Limit: 20, Total: -1}, + pg: listPage{Count: 7, Page: 1, Base: pageOne, Limit: 20, Total: -1}, wantFooter: "Showing 7 results (page 1).", }, { @@ -129,7 +172,7 @@ func TestGeneratedBareArrayFullPageNotesOnStderr(t *testing.T) { if err != nil { t.Fatalf("execCommandSplit: %v", err) } - want := "note: showing 2 results (= limit 2); more may exist; raise --limit" + want := "note: showing 2 results (= limit 2), more may exist: raise --limit" if !strings.Contains(fullErr, want) { t.Errorf("full page should note on stderr %q, got:\n%s", want, fullErr) } @@ -172,22 +215,23 @@ func TestGenericEnvelopeMoreSignalInTableMode(t *testing.T) { cursorCmd := &cobra.Command{Use: "x"} cursorCmd.Flags().Int("limit", 20, "") tests := []struct { - name string - cmd *cobra.Command - data any - want string + name string + cmd *cobra.Command + defaults listDefaults + data any + want string }{ - {"has_next_page true", pagedCmd(), &pagedResp{Items: rows, HasNextPage: true}, "Showing 2 results (page 1); more results exist; raise --limit or use --page 2."}, - {"has_next_page false", pagedCmd(), &pagedResp{Items: rows}, "Showing 2 results (page 1)."}, - {"next cursor set", cursorCmd, &cursorResp{Items: rows, NextCursor: "abc"}, "Showing 2 results; more results exist; raise --limit."}, - {"next cursor empty", cursorCmd, &cursorResp{Items: rows}, "Showing 2 results."}, + {"has_next_page true", pagedCmd(), listDefaults{PageBase: pageOne}, &pagedResp{Items: rows, HasNextPage: true}, "Showing 2 results (page 1), more exist: raise --limit or use --page 2."}, + {"has_next_page false", pagedCmd(), listDefaults{PageBase: pageOne}, &pagedResp{Items: rows}, "Showing 2 results (page 1)."}, + {"next cursor set", cursorCmd, listDefaults{}, &cursorResp{Items: rows, NextCursor: "abc"}, "Showing 2 results, more exist: raise --limit."}, + {"next cursor empty", cursorCmd, listDefaults{}, &cursorResp{Items: rows}, "Showing 2 results."}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { var buf bytes.Buffer ctx := tableCtx(&buf) ctx.Cmd = tc.cmd - if err := printGenericResult(ctx, tc.data, nil, 0); err != nil { + if err := printGenericResult(ctx, tc.data, nil, tc.defaults); err != nil { t.Fatalf("printGenericResult: %v", err) } got := buf.String() @@ -229,7 +273,7 @@ func TestAlertEventsStatesCompleteness(t *testing.T) { if !strings.HasPrefix(strings.TrimSpace(jsonOut), "[") || strings.Contains(jsonOut, "note:") { t.Errorf("stdout must stay the bare JSON array, got:\n%s", jsonOut) } - if !strings.Contains(stderrText, "note: showing 2 of 45 total results (page 1); raise --limit or use --page 2") { + if !strings.Contains(stderrText, "note: showing 2 of 45 total results (page 1): raise --limit or use --page 2") { t.Errorf("structured mode should note the remaining rows on stderr, got:\n%s", stderrText) } } @@ -245,7 +289,7 @@ func TestFeedCommandsSurfaceHasNextPage(t *testing.T) { if err != nil { t.Fatalf("execCommandSplit: %v", err) } - if !strings.Contains(stderrText, "note: showing 1 results (page 1); more results exist; raise --limit or use --page 2") { + if !strings.Contains(stderrText, "note: showing 1 result (page 1), more exist: raise --limit or use --page 2") { t.Errorf("has_next_page=true must be announced, got:\n%s", stderrText) } @@ -271,7 +315,7 @@ func TestIncidentSimilarFullListNotes(t *testing.T) { if err != nil { t.Fatalf("execCommandSplit: %v", err) } - if !strings.Contains(stderrText, "note: showing 2 results (= limit 2); more may exist; raise --limit") { + if !strings.Contains(stderrText, "note: showing 2 results (= limit 2), more may exist: raise --limit") { t.Errorf("a full top-N list should say more may exist, got:\n%s", stderrText) } } @@ -303,7 +347,7 @@ func TestGeneratedBareArrayDefaultLimit(t *testing.T) { } fullOut, fullErr := run(t, 50) - if want := "note: showing 50 results (= limit 50); more may exist; raise --limit"; !strings.Contains(fullErr, want) { + if want := "note: showing 50 results (= limit 50), more may exist: raise --limit"; !strings.Contains(fullErr, want) { t.Errorf("a full default page should note %q, got:\n%s", want, fullErr) } if strings.Contains(fullOut, "note:") || !strings.HasPrefix(strings.TrimSpace(fullOut), "[") { @@ -315,3 +359,71 @@ func TestGeneratedBareArrayDefaultLimit(t *testing.T) { t.Errorf("a short default page proves the set is complete; no note wanted, got:\n%s", shortErr) } } + +// A command whose schema declares a zero-based page (default 0) is on page 0 +// when it sets none: the next page is 1, and page 1 of 25 rows at limit 20 is +// the last page. +func TestZeroBasedPageHintAndOffset(t *testing.T) { + rows := func(n int) []any { + out := make([]any, n) + for i := range out { + out[i] = map[string]any{"version": i + 1} + } + return out + } + run := func(t *testing.T, n int, extra ...string) string { + t.Helper() + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = map[string]any{"items": rows(n), "total": 25} + args := append([]string{"rum", "application-remote-config-history-list", "app1", "--output-format", "json"}, extra...) + _, stderrText, err := execCommandSplit(args...) + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + return stderrText + } + + if got, want := run(t, 20), "note: showing 20 of 25 total results (page 0): raise --limit or use --page 1"; !strings.Contains(got, want) { + t.Errorf("first zero-based page should note %q, got:\n%s", want, got) + } + if got := run(t, 5, "--page", "1"); strings.Contains(got, "note:") { + t.Errorf("page 1 of 25 rows at limit 20 is the last page; no note wanted, got:\n%s", got) + } +} + +// alert events sends --limit/--page only when the user set them, and judges the +// page against the schema's default page size. +func TestAlertEventsSendsFlagsOnlyWhenSet(t *testing.T) { + event := map[string]any{"event_id": "e1", "event_severity": "Critical", "event_status": "Triggered", "title": "t"} + + saveAndResetGlobals(t) + stub := newGFStub(t) + stub.data = map[string]any{"items": []any{event}, "total": 1} + if _, _, err := execCommandSplit("alert", "events", "a1"); err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if _, ok := stub.lastBody["limit"]; ok { + t.Errorf("unset --limit must not be sent, got %#v", stub.lastBody) + } + if _, ok := stub.lastBody["p"]; ok { + t.Errorf("unset --page must not be sent, got %#v", stub.lastBody) + } + + // 20 rows of 45 with nothing set: the default page size (20) and first + // page are known, so the remainder is announced. + saveAndResetGlobals(t) + stub = newGFStub(t) + rows := make([]any, 20) + for i := range rows { + rows[i] = event + } + stub.data = map[string]any{"items": rows, "total": 45} + _, stderrText, err := execCommandSplit("alert", "events", "a1", "--output-format", "json") + if err != nil { + t.Fatalf("execCommandSplit: %v", err) + } + if !strings.Contains(stderrText, "note: showing 20 of 45 total results (page 1): raise --limit or use --page 2") { + t.Errorf("default page of a longer list should be announced, got:\n%s", stderrText) + } +} diff --git a/internal/cli/monit_prometheus_label_values.go b/internal/cli/monit_prometheus_label_values.go index 334abe1..d54433f 100644 --- a/internal/cli/monit_prometheus_label_values.go +++ b/internal/cli/monit_prometheus_label_values.go @@ -35,7 +35,7 @@ API: GET /monit/prometheus/api/v1/label/{label_name}/values (monit-prometheus-re if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } diff --git a/internal/cli/monit_query.go b/internal/cli/monit_query.go index c8006c2..ccf3b72 100644 --- a/internal/cli/monit_query.go +++ b/internal/cli/monit_query.go @@ -56,7 +56,7 @@ Query tools are '.query' where '' is one of 'prometheus', 'mysql', ' if err != nil { return err } - return printGenericResult(ctx, out, nil, 0) + return printGenericResult(ctx, out, nil, listDefaults{}) }) }, } diff --git a/internal/cli/zz_generated_a2a_agents.go b/internal/cli/zz_generated_a2a_agents.go index 114397f..c5a680e 100644 --- a/internal/cli/zz_generated_a2a_agents.go +++ b/internal/cli/zz_generated_a2a_agents.go @@ -73,7 +73,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "ReadGet")) }) }, } @@ -170,7 +170,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "ReadList")) }) }, } @@ -278,7 +278,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "WriteCreate")) }) }, } @@ -337,7 +337,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "WriteDelete")) }) }, } @@ -385,7 +385,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "WriteDisable")) }) }, } @@ -433,7 +433,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "WriteEnable")) }) }, } @@ -542,7 +542,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("A2aAgents", "WriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_account.go b/internal/cli/zz_generated_account.go index 3beeb30..ea30d54 100644 --- a/internal/cli/zz_generated_account.go +++ b/internal/cli/zz_generated_account.go @@ -48,7 +48,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Account", "Info")) }) }, } diff --git a/internal/cli/zz_generated_alert_enrichment.go b/internal/cli/zz_generated_alert_enrichment.go index f4ee975..9e51d10 100644 --- a/internal/cli/zz_generated_alert_enrichment.go +++ b/internal/cli/zz_generated_alert_enrichment.go @@ -74,7 +74,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "EnrichmentReadInfo")) }) }, } @@ -150,7 +150,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "EnrichmentReadList")) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "FieldReadInfo")) }) }, } @@ -362,7 +362,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "FieldReadList")) }) }, } @@ -439,7 +439,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "FieldWriteCreate")) }) }, } @@ -632,7 +632,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingAPIReadInfo")) }) }, } @@ -685,7 +685,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingAPIReadList")) }) }, } @@ -763,7 +763,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingAPIWriteCreate")) }) }, } @@ -1052,7 +1052,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingDataReadList")) }) }, } @@ -1219,7 +1219,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingDataWriteUpsert")) }) }, } @@ -1281,7 +1281,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingSchemaReadInfo")) }) }, } @@ -1331,7 +1331,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingSchemaReadList")) }) }, } @@ -1398,7 +1398,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertEnrichment", "MappingSchemaWriteCreate")) }) }, } diff --git a/internal/cli/zz_generated_alert_rules.go b/internal/cli/zz_generated_alert_rules.go index f376a0a..9135d6f 100644 --- a/internal/cli/zz_generated_alert_rules.go +++ b/internal/cli/zz_generated_alert_rules.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadAuditDetail")) }) }, } @@ -107,7 +107,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadAudits")) }) }, } @@ -141,7 +141,7 @@ API: POST /monit/rule/counter/channel (monit-rule-read-counter-channel) if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadCounterChannel")) }) }, } @@ -180,7 +180,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadCounterTotal")) }) }, } @@ -315,7 +315,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadInfoV2")) }) }, } @@ -396,7 +396,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 50) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "ReadList")) }) }, } @@ -724,7 +724,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "WriteCreateV2")) }) }, } @@ -967,7 +967,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "WriteFieldsUpdate")) }) }, } @@ -1033,7 +1033,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "WriteMove")) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AlertRules", "WriteUpdateV2")) }) }, } diff --git a/internal/cli/zz_generated_alerts.go b/internal/cli/zz_generated_alerts.go index 2a0eefd..b4be0f0 100644 --- a/internal/cli/zz_generated_alerts.go +++ b/internal/cli/zz_generated_alerts.go @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "EventReadList")) }) }, } @@ -240,7 +240,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadEventList")) }) }, } @@ -350,7 +350,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadFeed")) }) }, } @@ -467,7 +467,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadInfo")) }) }, } @@ -655,7 +655,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadList")) }) }, } @@ -786,7 +786,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadListByIDs")) }) }, } @@ -858,7 +858,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadPipelineInfo")) }) }, } @@ -928,7 +928,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Alerts", "ReadPipelineList")) }) }, } diff --git a/internal/cli/zz_generated_analytics.go b/internal/cli/zz_generated_analytics.go index fbcb020..abd3322 100644 --- a/internal/cli/zz_generated_analytics.go +++ b/internal/cli/zz_generated_analytics.go @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "ByAccount")) }) }, } @@ -399,7 +399,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "ByChannel")) }) }, } @@ -601,7 +601,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "ByResponder")) }) }, } @@ -812,7 +812,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "ByTeam")) }) }, } @@ -1395,7 +1395,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "IncidentList")) }) }, } @@ -1958,7 +1958,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Analytics", "TopkAlertsByLabel")) }) }, } diff --git a/internal/cli/zz_generated_applications.go b/internal/cli/zz_generated_applications.go index eda5747..7e248fd 100644 --- a/internal/cli/zz_generated_applications.go +++ b/internal/cli/zz_generated_applications.go @@ -86,7 +86,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "ReadInfo")) }) }, } @@ -174,7 +174,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "ReadInfos")) }) }, } @@ -295,7 +295,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "ReadList")) }) }, } @@ -375,7 +375,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "RemoteConfigReadGet")) }) }, } @@ -475,7 +475,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "RemoteConfigReadHistoryList")) }) }, } @@ -574,7 +574,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "RemoteConfigReadPreview")) }) }, } @@ -638,7 +638,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "RemoteConfigWriteHistoryRevert")) }) }, } @@ -717,7 +717,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "RemoteConfigWriteUpdate")) }) }, } @@ -776,7 +776,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "WebhookTest")) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Applications", "WriteCreate")) }) }, } diff --git a/internal/cli/zz_generated_artifacts.go b/internal/cli/zz_generated_artifacts.go index 451eb8a..dfbe32d 100644 --- a/internal/cli/zz_generated_artifacts.go +++ b/internal/cli/zz_generated_artifacts.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "ReadGet")) }) }, } @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "ReadGetFileState")) }) }, } @@ -224,7 +224,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "ReadList")) }) }, } @@ -291,7 +291,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "ReadSign")) }) }, } @@ -393,7 +393,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WriteDelete")) }) }, } @@ -451,7 +451,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WritePublish")) }) }, } @@ -507,7 +507,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WriteShareEnable")) }) }, } @@ -555,7 +555,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WriteShareRevoke")) }) }, } @@ -610,7 +610,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WriteShareSync")) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Artifacts", "WriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_audit_logs.go b/internal/cli/zz_generated_audit_logs.go index 74d9175..b3b000d 100644 --- a/internal/cli/zz_generated_audit_logs.go +++ b/internal/cli/zz_generated_audit_logs.go @@ -38,7 +38,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AuditLogs", "OperationList")) }) }, } @@ -154,7 +154,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("AuditLogs", "Search")) }) }, } diff --git a/internal/cli/zz_generated_automations.go b/internal/cli/zz_generated_automations.go index 2077c61..e7cef6a 100644 --- a/internal/cli/zz_generated_automations.go +++ b/internal/cli/zz_generated_automations.go @@ -75,7 +75,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleReadGet")) }) }, } @@ -184,7 +184,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleReadList")) }) }, } @@ -323,7 +323,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleWriteCreate")) }) }, } @@ -383,7 +383,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleWriteDelete")) }) }, } @@ -446,7 +446,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleWriteRun")) }) }, } @@ -592,7 +592,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RuleWriteUpdate")) }) }, } @@ -712,7 +712,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "RunReadList")) }) }, } @@ -771,7 +771,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Automations", "TemplateReadList")) }) }, } diff --git a/internal/cli/zz_generated_calendars.go b/internal/cli/zz_generated_calendars.go index 7d917cb..c184d20 100644 --- a/internal/cli/zz_generated_calendars.go +++ b/internal/cli/zz_generated_calendars.go @@ -131,7 +131,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Calendars", "CalEventList")) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Calendars", "CalEventUpsert")) }) }, } @@ -296,7 +296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Calendars", "CalendarCreate")) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Calendars", "CalendarInfo")) }) }, } @@ -484,7 +484,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Calendars", "CalendarList")) }) }, } diff --git a/internal/cli/zz_generated_changes.go b/internal/cli/zz_generated_changes.go index 1933374..90baa8e 100644 --- a/internal/cli/zz_generated_changes.go +++ b/internal/cli/zz_generated_changes.go @@ -159,7 +159,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 10) + return printGenericResult(ctx, out, body, listDefaultsFor("Changes", "List")) }) }, } diff --git a/internal/cli/zz_generated_channels.go b/internal/cli/zz_generated_channels.go index bbf717a..7f4ce88 100644 --- a/internal/cli/zz_generated_channels.go +++ b/internal/cli/zz_generated_channels.go @@ -138,7 +138,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelCreate")) }) }, } @@ -405,7 +405,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelEscalateRuleCreate")) }) }, } @@ -662,7 +662,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelEscalateRuleInfo")) }) }, } @@ -747,7 +747,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelEscalateRuleList")) }) }, } @@ -957,7 +957,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelInfo")) }) }, } @@ -1011,7 +1011,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelInfos")) }) }, } @@ -1091,7 +1091,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelInhibitRuleCreate")) }) }, } @@ -1322,7 +1322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelInhibitRuleList")) }) }, } @@ -1558,7 +1558,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 100) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelList")) }) }, } @@ -1660,7 +1660,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelSilenceRuleCreate")) }) }, } @@ -1902,7 +1902,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelSilenceRuleList")) }) }, } @@ -2056,7 +2056,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelUnsubscribeRuleCreate")) }) }, } @@ -2282,7 +2282,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelUnsubscribeRuleList")) }) }, } @@ -2474,7 +2474,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "ChannelUpdate")) }) }, } @@ -2556,7 +2556,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "RouteInfo")) }) }, } @@ -2629,7 +2629,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Channels", "RouteList")) }) }, } diff --git a/internal/cli/zz_generated_dashboards.go b/internal/cli/zz_generated_dashboards.go index 5f7a656..8600675 100644 --- a/internal/cli/zz_generated_dashboards.go +++ b/internal/cli/zz_generated_dashboards.go @@ -187,7 +187,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "PanelReadPreview")) }) }, } @@ -301,7 +301,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "PanelReadRun")) }) }, } @@ -385,7 +385,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "QueryReadResolve")) }) }, } @@ -506,7 +506,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "ReadGet")) }) }, } @@ -591,7 +591,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "ReadList")) }) }, } @@ -691,7 +691,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "ReadOutline")) }) }, } @@ -768,7 +768,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "ReadSearch")) }) }, } @@ -892,7 +892,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "RevisionReadGet")) }) }, } @@ -952,7 +952,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "RevisionReadList")) }) }, } @@ -1023,7 +1023,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "TrashReadList")) }) }, } @@ -1126,7 +1126,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "VariableReadPreview")) }) }, } @@ -1198,7 +1198,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "VariableReadResolve")) }) }, } @@ -1381,7 +1381,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "WriteCreate")) }) }, } @@ -1440,7 +1440,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "WriteDelete")) }) }, } @@ -1538,7 +1538,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "WriteMove")) }) }, } @@ -1670,7 +1670,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "WriteRestore")) }) }, } @@ -1835,7 +1835,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Dashboards", "WriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_data_query.go b/internal/cli/zz_generated_data_query.go index dee199b..0bf1276 100644 --- a/internal/cli/zz_generated_data_query.go +++ b/internal/cli/zz_generated_data_query.go @@ -58,7 +58,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataQuery", "Query")) }) }, } diff --git a/internal/cli/zz_generated_data_sources.go b/internal/cli/zz_generated_data_sources.go index 0a18502..302438f 100644 --- a/internal/cli/zz_generated_data_sources.go +++ b/internal/cli/zz_generated_data_sources.go @@ -56,7 +56,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "ReadInfo")) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "ReadList")) }) }, } @@ -172,7 +172,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "ReadSLSLogstores")) }) }, } @@ -248,7 +248,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "ReadSLSProjects")) }) }, } @@ -317,7 +317,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "ToolsInvoke")) }) }, } @@ -571,7 +571,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "WriteCreate")) }) }, } @@ -878,7 +878,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("DataSources", "WriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_diagnostics.go b/internal/cli/zz_generated_diagnostics.go index 5c5dd79..1cb9a9d 100644 --- a/internal/cli/zz_generated_diagnostics.go +++ b/internal/cli/zz_generated_diagnostics.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Diagnostics", "QueryData")) }) }, } @@ -167,7 +167,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Diagnostics", "QueryExplore")) }) }, } diff --git a/internal/cli/zz_generated_error_ingestion_rules.go b/internal/cli/zz_generated_error_ingestion_rules.go index 1bc911f..22637ac 100644 --- a/internal/cli/zz_generated_error_ingestion_rules.go +++ b/internal/cli/zz_generated_error_ingestion_rules.go @@ -65,7 +65,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("ErrorIngestionRules", "Create")) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("ErrorIngestionRules", "HistoryList")) }) }, } @@ -452,7 +452,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("ErrorIngestionRules", "List")) }) }, } diff --git a/internal/cli/zz_generated_facets.go b/internal/cli/zz_generated_facets.go index 899eccc..ff51377 100644 --- a/internal/cli/zz_generated_facets.go +++ b/internal/cli/zz_generated_facets.go @@ -89,7 +89,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 100) + return printGenericResult(ctx, out, body, listDefaultsFor("Facets", "FacetCount")) }) }, } @@ -164,7 +164,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Facets", "FieldList")) }) }, } diff --git a/internal/cli/zz_generated_im_integrations.go b/internal/cli/zz_generated_im_integrations.go index 37b7142..598aeb1 100644 --- a/internal/cli/zz_generated_im_integrations.go +++ b/internal/cli/zz_generated_im_integrations.go @@ -53,7 +53,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("ImIntegrations", "List")) }) }, } diff --git a/internal/cli/zz_generated_incidents.go b/internal/cli/zz_generated_incidents.go index 07dc24b..5dee996 100644 --- a/internal/cli/zz_generated_incidents.go +++ b/internal/cli/zz_generated_incidents.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostMortemWriteResetContent")) }) }, } @@ -135,7 +135,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "ReadGetWarRoomDefaultObservers")) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "ServiceDeskPlusRequestReadList")) }) }, } @@ -326,7 +326,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WriteAddWarRoomMember")) }) }, } @@ -530,7 +530,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 1000) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "AlertList")) }) }, } @@ -734,7 +734,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "CommentTypeCreate")) }) }, } @@ -833,7 +833,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "CommentTypeList")) }) }, } @@ -1022,7 +1022,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "Create")) }) }, } @@ -1077,7 +1077,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "CustomActionDo")) }) }, } @@ -1305,7 +1305,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "Feed")) }) }, } @@ -1584,7 +1584,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "Info")) }) }, } @@ -1908,7 +1908,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "List")) }) }, } @@ -2142,7 +2142,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "ListByIDs")) }) }, } @@ -2438,7 +2438,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 5) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PastList")) }) }, } @@ -2572,7 +2572,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostMortemInfo")) }) }, } @@ -2691,7 +2691,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostMortemList")) }) }, } @@ -3267,7 +3267,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WarRoomCreate")) }) }, } @@ -3382,7 +3382,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WarRoomDetail")) }) }, } @@ -3449,7 +3449,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WarRoomList")) }) }, } @@ -3533,7 +3533,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemBindPostMortem")) }) }, } @@ -3627,7 +3627,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemComplete")) }) }, } @@ -3722,7 +3722,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemConvert")) }) }, } @@ -3844,7 +3844,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemCreate")) }) }, } @@ -3934,7 +3934,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemDelete")) }) }, } @@ -4038,7 +4038,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 50) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemList")) }) }, } @@ -4134,7 +4134,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemResetAssignees")) }) }, } @@ -4238,7 +4238,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "WorkItemUpdate")) }) }, } @@ -4322,7 +4322,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostmortemReadListTemplates")) }) }, } @@ -4384,7 +4384,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostmortemReadTemplateInfo")) }) }, } @@ -4523,7 +4523,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostmortemWriteInit")) }) }, } @@ -4868,7 +4868,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Incidents", "PostmortemWriteUpsertTemplate")) }) }, } diff --git a/internal/cli/zz_generated_integrations.go b/internal/cli/zz_generated_integrations.go index c4b61c4..ac8b856 100644 --- a/internal/cli/zz_generated_integrations.go +++ b/internal/cli/zz_generated_integrations.go @@ -50,7 +50,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "DatasourceImPersonTryLink")) }) }, } @@ -113,7 +113,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIReadInfo")) }) }, } @@ -235,7 +235,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 100) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIReadList")) }) }, } @@ -328,7 +328,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIReadTypeList")) }) }, } @@ -397,7 +397,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIWriteCreate")) }) }, } @@ -607,7 +607,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIWriteRotateKey")) }) }, } @@ -686,7 +686,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "IntegrationAPIWriteUpdate")) }) }, } @@ -759,7 +759,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "Detail")) }) }, } @@ -871,7 +871,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Integrations", "List")) }) }, } diff --git a/internal/cli/zz_generated_issue_preset_severity_rules.go b/internal/cli/zz_generated_issue_preset_severity_rules.go index 3e08927..d6120fb 100644 --- a/internal/cli/zz_generated_issue_preset_severity_rules.go +++ b/internal/cli/zz_generated_issue_preset_severity_rules.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("IssuePresetSeverityRules", "Create")) }) }, } @@ -337,7 +337,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("IssuePresetSeverityRules", "HistoryList")) }) }, } @@ -463,7 +463,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("IssuePresetSeverityRules", "List")) }) }, } diff --git a/internal/cli/zz_generated_issues.go b/internal/cli/zz_generated_issues.go index cf7e337..b0f2e31 100644 --- a/internal/cli/zz_generated_issues.go +++ b/internal/cli/zz_generated_issues.go @@ -233,7 +233,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Issues", "ReadInfo")) }) }, } @@ -386,7 +386,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Issues", "ReadList")) }) }, } diff --git a/internal/cli/zz_generated_knowledge.go b/internal/cli/zz_generated_knowledge.go index 337ccc9..a32d194 100644 --- a/internal/cli/zz_generated_knowledge.go +++ b/internal/cli/zz_generated_knowledge.go @@ -60,7 +60,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "FileReadGet")) }) }, } @@ -132,7 +132,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "FileReadList")) }) }, } @@ -195,7 +195,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "FileWriteDelete")) }) }, } @@ -271,7 +271,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "FileWritePut")) }) }, } @@ -333,7 +333,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "PackReadGet")) }) }, } @@ -423,7 +423,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "PackReadList")) }) }, } @@ -480,7 +480,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "PackWriteDelete")) }) }, } @@ -544,7 +544,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "PackWriteEnsure")) }) }, } @@ -618,7 +618,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Knowledge", "PackWriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_licenses.go b/internal/cli/zz_generated_licenses.go index ada37c2..43a8aec 100644 --- a/internal/cli/zz_generated_licenses.go +++ b/internal/cli/zz_generated_licenses.go @@ -39,7 +39,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Licenses", "List")) }) }, } diff --git a/internal/cli/zz_generated_list_defaults.go b/internal/cli/zz_generated_list_defaults.go new file mode 100644 index 0000000..4f4b093 --- /dev/null +++ b/internal/cli/zz_generated_list_defaults.go @@ -0,0 +1,53 @@ +// Code generated by internal/cmd/cligen; DO NOT EDIT. + +package cli + +// listDefaultsBySDKMethod maps an SDK "Service.Method" to the page size its API +// serves when a request sets none and how its page is numbered, as declared by +// the request schema's structured defaults. +var listDefaultsBySDKMethod = map[string]listDefaults{ + "A2aAgents.ReadList": {Limit: 20}, + "AlertEnrichment.MappingDataReadList": {PageBase: pageUnknown}, + "AlertRules.ReadList": {Limit: 50}, + "Alerts.EventReadList": {PageBase: pageUnknown}, + "Alerts.ReadEventList": {Limit: 20, PageBase: pageOne}, + "Alerts.ReadFeed": {PageBase: pageOne}, + "Alerts.ReadList": {PageBase: pageUnknown}, + "Analytics.IncidentList": {Limit: 20, PageBase: pageOne}, + "Applications.ReadList": {PageBase: pageUnknown}, + "Applications.RemoteConfigReadHistoryList": {Limit: 20, PageBase: pageZero}, + "Artifacts.ReadList": {Limit: 20, PageBase: pageOne}, + "Automations.RuleReadList": {Limit: 20, PageBase: pageOne}, + "Automations.RunReadList": {Limit: 20, PageBase: pageOne}, + "Changes.List": {Limit: 10, PageBase: pageUnknown}, + "Channels.ChannelList": {Limit: 100, PageBase: pageUnknown}, + "Dashboards.ReadList": {PageBase: pageUnknown}, + "Dashboards.ReadSearch": {PageBase: pageUnknown}, + "Dashboards.TrashReadList": {PageBase: pageUnknown}, + "ErrorIngestionRules.HistoryList": {Limit: 20, PageBase: pageZero}, + "Facets.FacetCount": {Limit: 100}, + "Incidents.AlertList": {Limit: 1000, PageBase: pageOne}, + "Incidents.Feed": {Limit: 20, PageBase: pageUnknown}, + "Incidents.List": {Limit: 20, PageBase: pageUnknown}, + "Incidents.PastList": {Limit: 5}, + "Incidents.PostMortemList": {Limit: 20, PageBase: pageUnknown}, + "Incidents.PostmortemReadListTemplates": {Limit: 20, PageBase: pageUnknown}, + "Incidents.ServiceDeskPlusRequestReadList": {Limit: 20, PageBase: pageUnknown}, + "Incidents.WorkItemList": {Limit: 50}, + "Integrations.IntegrationAPIReadList": {Limit: 100, PageBase: pageOne}, + "Integrations.IntegrationAPIReadTypeList": {Limit: 20, PageBase: pageOne}, + "IssuePresetSeverityRules.HistoryList": {Limit: 20, PageBase: pageZero}, + "Issues.ReadExport": {PageBase: pageUnknown}, + "Issues.ReadList": {PageBase: pageUnknown}, + "Knowledge.FileReadList": {PageBase: pageUnknown}, + "Knowledge.PackReadList": {PageBase: pageUnknown}, + "McpServers.ReadServerList": {Limit: 20, PageBase: pageOne}, + "Members.MemberList": {Limit: 100, PageBase: pageUnknown}, + "NotificationTemplates.ReadList": {Limit: 20, PageBase: pageOne}, + "Schedules.List": {Limit: 10, PageBase: pageOne}, + "SessionReplay.Segments": {Limit: 20}, + "Sessions.ReadList": {Limit: 20, PageBase: pageOne}, + "Skills.ReadList": {Limit: 20, PageBase: pageOne}, + "Sourcemaps.List": {Limit: 20, PageBase: pageOne}, + "Teams.ReadList": {Limit: 20, PageBase: pageOne}, +} diff --git a/internal/cli/zz_generated_mcp_servers.go b/internal/cli/zz_generated_mcp_servers.go index 3e4edaf..74dfa27 100644 --- a/internal/cli/zz_generated_mcp_servers.go +++ b/internal/cli/zz_generated_mcp_servers.go @@ -76,7 +76,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "ReadServerGet")) }) }, } @@ -181,7 +181,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "ReadServerList")) }) }, } @@ -342,7 +342,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "WriteServerCreate")) }) }, } @@ -406,7 +406,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "WriteServerDelete")) }) }, } @@ -454,7 +454,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "WriteServerDisable")) }) }, } @@ -502,7 +502,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "WriteServerEnable")) }) }, } @@ -656,7 +656,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("McpServers", "WriteServerUpdate")) }) }, } diff --git a/internal/cli/zz_generated_members.go b/internal/cli/zz_generated_members.go index 3f946f0..b5120c9 100644 --- a/internal/cli/zz_generated_members.go +++ b/internal/cli/zz_generated_members.go @@ -199,7 +199,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Members", "MemberInfo")) }) }, } @@ -256,7 +256,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Members", "MemberInvite")) }) }, } @@ -358,7 +358,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 100) + return printGenericResult(ctx, out, body, listDefaultsFor("Members", "MemberList")) }) }, } @@ -426,7 +426,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Members", "MemberNotify")) }) }, } @@ -701,7 +701,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Members", "PersonInfos")) }) }, } diff --git a/internal/cli/zz_generated_notification_templates.go b/internal/cli/zz_generated_notification_templates.go index 2745874..8a88ca2 100644 --- a/internal/cli/zz_generated_notification_templates.go +++ b/internal/cli/zz_generated_notification_templates.go @@ -82,7 +82,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("NotificationTemplates", "ReadInfo")) }) }, } @@ -204,7 +204,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("NotificationTemplates", "ReadList")) }) }, } @@ -285,7 +285,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("NotificationTemplates", "ReadPreview")) }) }, } @@ -453,7 +453,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("NotificationTemplates", "WriteCreate")) }) }, } diff --git a/internal/cli/zz_generated_resources.go b/internal/cli/zz_generated_resources.go index 2997b12..d8509aa 100644 --- a/internal/cli/zz_generated_resources.go +++ b/internal/cli/zz_generated_resources.go @@ -71,7 +71,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Resources", "Info")) }) }, } diff --git a/internal/cli/zz_generated_roles_permissions.go b/internal/cli/zz_generated_roles_permissions.go index 9ab2401..d8228e8 100644 --- a/internal/cli/zz_generated_roles_permissions.go +++ b/internal/cli/zz_generated_roles_permissions.go @@ -57,7 +57,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RolesPermissions", "ReadInfo")) }) }, } @@ -123,7 +123,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RolesPermissions", "ReadList")) }) }, } @@ -188,7 +188,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RolesPermissions", "ReadListPermission")) }) }, } @@ -239,7 +239,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RolesPermissions", "ReadListPermissionFactor")) }) }, } @@ -580,7 +580,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RolesPermissions", "WriteUpsert")) }) }, } diff --git a/internal/cli/zz_generated_rule_folders.go b/internal/cli/zz_generated_rule_folders.go index 24d7b18..d47eac6 100644 --- a/internal/cli/zz_generated_rule_folders.go +++ b/internal/cli/zz_generated_rule_folders.go @@ -43,7 +43,7 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("RuleFolders", "List")) }) }, } diff --git a/internal/cli/zz_generated_schedules.go b/internal/cli/zz_generated_schedules.go index fc3383b..80f48a2 100644 --- a/internal/cli/zz_generated_schedules.go +++ b/internal/cli/zz_generated_schedules.go @@ -62,7 +62,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "ByPerson")) }) }, } @@ -208,7 +208,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "Create")) }) }, } @@ -478,7 +478,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "Info")) }) }, } @@ -647,7 +647,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "Infos")) }) }, } @@ -859,7 +859,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 10) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "List")) }) }, } @@ -1155,7 +1155,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "Preview")) }) }, } @@ -1338,7 +1338,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Schedules", "Self")) }) }, } diff --git a/internal/cli/zz_generated_session_replay.go b/internal/cli/zz_generated_session_replay.go index 26bef7f..994f254 100644 --- a/internal/cli/zz_generated_session_replay.go +++ b/internal/cli/zz_generated_session_replay.go @@ -80,7 +80,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("SessionReplay", "Metadata")) }) }, } @@ -158,7 +158,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("SessionReplay", "Segments")) }) }, } diff --git a/internal/cli/zz_generated_sessions.go b/internal/cli/zz_generated_sessions.go index 4e0a09a..2191f53 100644 --- a/internal/cli/zz_generated_sessions.go +++ b/internal/cli/zz_generated_sessions.go @@ -149,7 +149,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Sessions", "ReadInfo")) }) }, } @@ -316,7 +316,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Sessions", "ReadList")) }) }, } @@ -376,7 +376,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Sessions", "WriteDelete")) }) }, } diff --git a/internal/cli/zz_generated_skills.go b/internal/cli/zz_generated_skills.go index 5f935f7..4ced769 100644 --- a/internal/cli/zz_generated_skills.go +++ b/internal/cli/zz_generated_skills.go @@ -47,7 +47,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "ReadEnable")) }) }, } @@ -122,7 +122,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "ReadGet")) }) }, } @@ -225,7 +225,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "ReadList")) }) }, } @@ -279,7 +279,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "WriteDelete")) }) }, } @@ -327,7 +327,7 @@ Request fields: if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "WriteDisable")) }) }, } @@ -417,7 +417,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Skills", "WriteUpdate")) }) }, } diff --git a/internal/cli/zz_generated_sourcemaps.go b/internal/cli/zz_generated_sourcemaps.go index 11a3442..01d523b 100644 --- a/internal/cli/zz_generated_sourcemaps.go +++ b/internal/cli/zz_generated_sourcemaps.go @@ -125,7 +125,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Sourcemaps", "List")) }) }, } @@ -268,7 +268,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Sourcemaps", "StackEnrich")) }) }, } diff --git a/internal/cli/zz_generated_status_pages.go b/internal/cli/zz_generated_status_pages.go index 4491a4d..57c749b 100644 --- a/internal/cli/zz_generated_status_pages.go +++ b/internal/cli/zz_generated_status_pages.go @@ -70,7 +70,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ReadPageList")) }) }, } @@ -156,7 +156,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ChangeActiveList")) }) }, } @@ -280,7 +280,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ChangeCreate")) }) }, } @@ -427,7 +427,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ChangeInfo")) }) }, } @@ -538,7 +538,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ChangeList")) }) }, } @@ -616,7 +616,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ChangeTimelineCreate")) }) }, } @@ -946,7 +946,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "ComponentUpsert")) }) }, } @@ -1044,7 +1044,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "Create")) }) }, } @@ -1154,7 +1154,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "DraftCreate")) }) }, } @@ -1239,7 +1239,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "Info")) }) }, } @@ -1296,7 +1296,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "MigrateEmailSubscribers")) }) }, } @@ -1359,7 +1359,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "MigrateStructure")) }) }, } @@ -1482,7 +1482,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "MigrationStatus")) }) }, } @@ -1598,7 +1598,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "SectionUpsert")) }) }, } @@ -1800,7 +1800,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "SubscriberList")) }) }, } @@ -1924,7 +1924,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "TemplateList")) }) }, } @@ -1988,7 +1988,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("StatusPages", "TemplateUpsert")) }) }, } diff --git a/internal/cli/zz_generated_teams.go b/internal/cli/zz_generated_teams.go index 8d70cda..0cf4919 100644 --- a/internal/cli/zz_generated_teams.go +++ b/internal/cli/zz_generated_teams.go @@ -68,7 +68,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Teams", "ReadInfo")) }) }, } @@ -124,7 +124,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Teams", "ReadInfos")) }) }, } @@ -217,7 +217,7 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; if err != nil { return err } - return printGenericResult(ctx, out, body, 20) + return printGenericResult(ctx, out, body, listDefaultsFor("Teams", "ReadList")) }) }, } @@ -371,7 +371,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if err != nil { return err } - return printGenericResult(ctx, out, body, 0) + return printGenericResult(ctx, out, body, listDefaultsFor("Teams", "WriteUpsert")) }) }, } diff --git a/internal/cmd/cligen/main.go b/internal/cmd/cligen/main.go index 9ee9560..ded835c 100644 --- a/internal/cmd/cligen/main.go +++ b/internal/cmd/cligen/main.go @@ -101,6 +101,9 @@ func run(only string) error { } // Response-help table covers ALL services so curated commands can look up // any method; only complete on a full run. + if err := writeGo(filepath.Join(genDir, "zz_generated_list_defaults.go"), emitListDefaults(services)); err != nil { + return err + } if err := writeGo(filepath.Join(genDir, "zz_generated_response_help.go"), emitResponseHelp(services)); err != nil { return err } @@ -174,6 +177,7 @@ type specField struct { Enum []string Constraint string // compact bound, e.g. "max 100", "1-39 chars" Default int // schema `default` of an integer property; 0 when the schema has none + PageBase string // for the page property: pageOne / pageZero from its schema default, else pageUnknown } func collectServices(paths, schemas map[string]any, sdk map[string]map[string]methodInfo) []service { @@ -471,6 +475,7 @@ func (w *specWalker) fields(op map[string]any) []specField { Enum: w.enumOf(pv), Constraint: constraintOf(pv), Default: intDefault(pv), + PageBase: pageBaseOf(wire, pv), }) } } @@ -593,6 +598,36 @@ func intDefault(s map[string]any) int { return 0 } +// pageBaseOf names how a command's page property is numbered, from the schema's +// structured `default` only: 1 is one-based, 0 is zero-based, and no default +// leaves the base unknown. It is "" for any property other than the page. +func pageBaseOf(wire string, s map[string]any) string { + if wire != "p" && wire != "page" { + return "" + } + switch s["default"] { + case float64(1): + return "pageOne" + case float64(0): + return "pageZero" + } + return "pageUnknown" +} + +// listDefaultsOf returns an operation's schema-declared list defaults: the page +// size served when the request sets none, and how its page is numbered. +func listDefaultsOf(o specOp) (limit int, base string) { + for _, f := range o.Fields { + switch f.Wire { + case "limit": + limit = f.Default + case "p", "page": + base = f.PageBase + } + } + return limit, base +} + // numStr formats a JSON number (float64 / json.Number) without a trailing ".0", // returning ok=false for nil/non-numeric so callers can omit absent bounds. func numStr(v any) (string, bool) { @@ -1356,13 +1391,7 @@ func emitCmd(fn string, s service, o specOp, mi methodInfo) string { case mi.HasData: fmt.Fprintf(&b, "\t\t\t\tout, _, err := %s\n", call) b.WriteString("\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n") - defaultLimit := 0 - for _, f := range o.Fields { - if f.Wire == "limit" { - defaultLimit = f.Default - } - } - fmt.Fprintf(&b, "\t\t\t\treturn printGenericResult(ctx, out, body, %d)\n", defaultLimit) + fmt.Fprintf(&b, "\t\t\t\treturn printGenericResult(ctx, out, body, listDefaultsFor(%q, %q))\n", s.Name, o.Method) default: // (*Response, error): a mutation, OR an export/attachment endpoint // whose CSV/file body the SDK surfaces on Response.Raw. Capture the @@ -1467,6 +1496,43 @@ func emitResponseHelp(services []service) string { return b.String() } +// emitListDefaults writes the table of schema-declared list defaults, keyed by +// SDK "Service.Method". Generated and curated commands share it through +// listDefaultsFor, so there is one source for the effective page size and page +// numbering of every list. +func emitListDefaults(services []service) string { + type kv struct{ k, v string } + var rows []kv + for _, s := range services { + for _, o := range s.Ops { + limit, base := listDefaultsOf(o) + if limit == 0 && base == "" { + continue + } + var parts []string + if limit > 0 { + parts = append(parts, fmt.Sprintf("Limit: %d", limit)) + } + if base != "" { + parts = append(parts, "PageBase: "+base) + } + rows = append(rows, kv{s.Name + "." + o.Method, "{" + strings.Join(parts, ", ") + "}"}) + } + } + sort.Slice(rows, func(i, j int) bool { return rows[i].k < rows[j].k }) + + var b strings.Builder + b.WriteString(genHeader) + b.WriteString("package cli\n\n") + b.WriteString("// listDefaultsBySDKMethod maps an SDK \"Service.Method\" to the page size its API\n// serves when a request sets none and how its page is numbered, as declared by\n// the request schema's structured defaults.\n") + b.WriteString("var listDefaultsBySDKMethod = map[string]listDefaults{\n") + for _, r := range rows { + fmt.Fprintf(&b, "\t%q: %s,\n", r.k, r.v) + } + b.WriteString("}\n") + return b.String() +} + // ---- help text ------------------------------------------------------------- func longHelp(o specOp, scalars []scalarField, complexFields []string, byWire map[string]specField) string {