add endpoint for recent fee report

This commit is contained in:
Carsten Otto
2021-12-30 14:16:54 +01:00
parent 06bab3c295
commit 2c648c12ce
3 changed files with 23 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Period;
import java.util.List;
import java.util.Set;
@@ -87,6 +88,12 @@ public class NodeController {
return FeeReportDto.createFromModel(feeService.getFeeReportForPeer(pubkey));
}
@Timed
@GetMapping("/fee-report/last-days/{lastDays}")
public FeeReportDto getFeeReport(@PathVariable Pubkey pubkey, @PathVariable int lastDays) {
return FeeReportDto.createFromModel(feeService.getFeeReportForPeer(pubkey, Period.ofDays(lastDays)));
}
private List<ChannelId> toSortedList(Set<? extends Channel> channels) {
return channels.stream()
.map(Channel::getId)