runAPI is the testable core: validate inputs, dispatch via Service.Raw, classify status, and emit either the raw body or a JSON object. The caller is responsible for resolving the method (defaults / auto-POST) and uppercasing it; runAPI guards against unsupported values like `-X PATCH-INVALID` reach
(ctx context.Context, opts *Options, fopts *cmdutil.FormatOptions, svc Service, method, path string, paginate bool)
| 192 | // fetched and merged into a single {data, total} JSON response. For |
| 193 | // non-GET methods paginate is silently ignored (no offset semantic). |
| 194 | func runAPI(ctx context.Context, opts *Options, fopts *cmdutil.FormatOptions, svc Service, method, path string, paginate bool) error { |
| 195 | if paginate && method == http.MethodGet { |
| 196 | return runAPIPaginated(ctx, opts, fopts, svc, path) |
| 197 | } |
| 198 | return runAPISingle(ctx, opts, fopts, svc, method, path) |
| 199 | } |
| 200 | |
| 201 | // runAPISingle is the original single-call implementation of runAPI. |
| 202 | func runAPISingle(ctx context.Context, opts *Options, fopts *cmdutil.FormatOptions, svc Service, method, path string) error { |