Commons/src/main/java/eu/univento/commons/player/user/UserInformation.java

47 lines
1.3 KiB
Java
Raw Normal View History

2017-08-14 12:06:33 +02:00
/*
2018-01-15 12:23:58 +01:00
* Copyright (c) 2018 univento.eu - All rights reserved
2017-08-14 12:06:33 +02:00
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.commons.player.user;
import eu.univento.commons.Commons;
import io.vertx.ext.web.client.WebClient;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* @author joethei
* @version 1.0
*/
@Getter
@AllArgsConstructor
2018-01-15 12:23:58 +01:00
public class UserInformation{
2017-08-14 12:06:33 +02:00
private static WebClient client;
public static CompletableFuture<UserInformation> get(String identifier) {
CompletableFuture<UserInformation> future = new CompletableFuture<>();
if(client == null) client = WebClient.create(Commons.getCommons().getVertx());
2018-01-15 12:23:58 +01:00
client.getAbs("https://api.univento.eu/private/player/" + identifier).ssl(true).send(ar -> {
2017-08-14 12:06:33 +02:00
if(ar.succeeded()) {
future.complete(ar.result().bodyAsJsonObject().mapTo(UserInformation.class));
}else future.complete(null);
});
return future;
}
private Result result;
private String uuid;
private String username;
private boolean premium;
private List<History> history;
private UserProperties properties;
private Updated updated;
}