2016-05-01 06:34:02 +02:00
|
|
|
package net.frozenorb.apiv3.routes;
|
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
2016-06-10 04:39:23 +02:00
|
|
|
import io.vertx.core.Handler;
|
|
|
|
import io.vertx.ext.web.RoutingContext;
|
|
|
|
import net.frozenorb.apiv3.APIv3;
|
2016-05-01 06:34:02 +02:00
|
|
|
import net.frozenorb.apiv3.actors.Actor;
|
|
|
|
|
2016-06-01 20:23:37 +02:00
|
|
|
public final class GETWhoAmI implements Handler<RoutingContext> {
|
2016-05-01 06:34:02 +02:00
|
|
|
|
2016-06-01 20:23:37 +02:00
|
|
|
public void handle(RoutingContext ctx) {
|
|
|
|
Actor actor = ctx.get("actor");
|
2016-05-01 06:34:02 +02:00
|
|
|
|
2016-06-10 04:39:23 +02:00
|
|
|
APIv3.respondJson(ctx, ImmutableMap.of(
|
2016-05-01 06:34:02 +02:00
|
|
|
"name", actor.getName(),
|
|
|
|
"type", actor.getType(),
|
|
|
|
"authorized", actor.isAuthorized()
|
2016-06-10 04:39:23 +02:00
|
|
|
));
|
2016-05-01 06:34:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|