volvox/service-td/src/main/java/io/volvox/td/TdResource.java

32 lines
718 B
Java
Raw Normal View History

2021-11-10 01:13:31 +01:00
package io.volvox.td;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
2021-11-26 18:48:17 +01:00
@Path("/td")
2021-11-10 01:13:31 +01:00
public class TdResource {
@Inject TdService tdService;
@Path("/list")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String listSessions() {
StringBuilder sb = new StringBuilder();
2021-11-14 13:07:24 +01:00
for (var session : tdService.getSessions()) {
sb.append(session.getKey()).append(System.lineSeparator());
2021-11-10 01:13:31 +01:00
}
return sb.toString();
}
@Path("/create-session")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String createSession() {
2021-11-14 13:07:24 +01:00
return tdService.startSession();
2021-11-10 01:13:31 +01:00
}
}