47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
/*
|
|
* Copyright (c) 2018 univento.eu - All rights reserved
|
|
* 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
|
|
public class UserInformation{
|
|
|
|
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());
|
|
client.getAbs("https://api.univento.eu/private/player/" + identifier).ssl(true).send(ar -> {
|
|
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;
|
|
|
|
} |