rename controller

This commit is contained in:
Carsten Otto
2021-11-12 09:06:55 +01:00
parent 2f8980db0f
commit 3888614d56
3 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
package de.cotto.lndmanagej.controller;
import de.cotto.lndmanagej.model.ChannelId;
import de.cotto.lndmanagej.model.Pubkey;
import de.cotto.lndmanagej.service.NodeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/node/{pubkey}/")
public class LegacyController {
private final NodeService nodeService;
public LegacyController(NodeService nodeService) {
this.nodeService = nodeService;
}
@GetMapping("/alias")
public String getAlias(@PathVariable Pubkey pubkey) {
return nodeService.getAlias(pubkey);
}
@GetMapping("/open-channels")
public List<String> getOpenChannelIds(@PathVariable Pubkey pubkey) {
return nodeService.getOpenChannelIds(pubkey).stream()
.map(ChannelId::toString)
.collect(Collectors.toList());
}
}