mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 23:44:21 +01:00
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
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());
|
|
}
|
|
}
|