| 472 | } |
| 473 | |
| 474 | struct command_result *do_bkpr_report(struct command *cmd, |
| 475 | struct report_info *info) |
| 476 | { |
| 477 | const struct bkpr *bkpr = bkpr_of(cmd->plugin); |
| 478 | struct income_event **events; |
| 479 | struct json_stream *js; |
| 480 | |
| 481 | events = list_income_events(tmpctx, bkpr, cmd, |
| 482 | *info->start_time, |
| 483 | *info->end_time, |
| 484 | true); |
| 485 | |
| 486 | js = jsonrpc_stream_success(cmd); |
| 487 | json_array_start(js, "report"); |
| 488 | for (size_t i = 0; i < tal_count(info->headers); i++) |
| 489 | json_add_string(js, NULL, info->headers[i]); |
| 490 | for (size_t i = 0; i < tal_count(events); i++) { |
| 491 | char *line; |
| 492 | |
| 493 | line = format_event(tmpctx, info->format, *info->escapes, |
| 494 | bkpr, events[i]); |
| 495 | json_add_string(js, NULL, line); |
| 496 | } |
| 497 | json_array_end(js); |
| 498 | /* Tell cli this is simple enough to be formatted flat for humans */ |
| 499 | json_add_string(js, "format-hint", "simple"); |
| 500 | return command_finished(cmd, js); |
| 501 | } |
nothing calls this directly
no test coverage detected