Data

This will teach you how to retrieve character data and basic properties.

Fetching user data

So, with all this out of the way, I will now explain how to fetch data. To do this, we simply use the method fetchGenshinUser(id, ...):

api.fetchGenshinUser(722777337, (user) -> {
   final GenshinUserInformation info = user.toGenshinUser();
});

Fetching users characters

You can loop through the characters that this user has in their showcase.

api.fetchGenshinUser(722777337, (user) -> {
    final GenshinUserInformation info = user.toGenshinUser();

    for (GenshinUserCharacter character : info.getCharacters()) {

    }
});

Fetching a characters name

To fetch a character name, you can simply get the game data and then invoke getName.

api.fetchGenshinUser(722777337, (user) -> {
    final GenshinUserInformation info = user.toGenshinUser();

    for (GenshinUserCharacter character : info.getCharacters()) {
        System.out.println(character.getGameData().getName());
    }
});

Last updated

Was this helpful?