Skip to content

Commit

Permalink
Add support for the bingo data endpoint (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorLinfoot authored Mar 2, 2022
1 parent 1862d9e commit 5ed57ca
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
27 changes: 27 additions & 0 deletions hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.hypixel.api.http.HypixelHttpResponse;
import net.hypixel.api.reply.*;
import net.hypixel.api.reply.skyblock.*;
import net.hypixel.api.reply.skyblock.bingo.SkyBlockBingoDataReply;
import net.hypixel.api.util.PropertyFilter;
import net.hypixel.api.util.ResourceType;
import net.hypixel.api.util.Utilities;
Expand Down Expand Up @@ -250,6 +251,32 @@ public CompletableFuture<SkyBlockProfilesReply> getSkyBlockProfiles(String playe
);
}

/**
* Request the bingo data of a provided player. See <a href="https://api.hypixel.net/#tag/SkyBlock/paths/~1skyblock~1bingo/get">/skyblock/bingo</a>
*
* @param player uuid of a player.
* @return CompletableFuture containing a {@link SkyBlockBingoDataReply}
*/
public CompletableFuture<SkyBlockBingoDataReply> getSkyblockBingoData(UUID player) {
return get(SkyBlockBingoDataReply.class, "skyblock/bingo",
HTTPQueryParams.create()
.add("uuid", player)
);
}

/**
* Request the bingo data of a provided player. See <a href="https://api.hypixel.net/#tag/SkyBlock/paths/~1skyblock~1bingo/get">/skyblock/bingo</a>
*
* @param player uuid of a player in string format, can be both dashed or undashed.
* @return CompletableFuture containing a {@link SkyBlockBingoDataReply}
*/
public CompletableFuture<SkyBlockBingoDataReply> getSkyblockBingoData(String player) {
return get(SkyBlockBingoDataReply.class, "skyblock/bingo",
HTTPQueryParams.create()
.add("uuid", player)
);
}

public CompletableFuture<SkyBlockNewsReply> getSkyBlockNews() {
return get(SkyBlockNewsReply.class, "skyblock/news");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.hypixel.api.reply.skyblock.bingo;

import com.google.gson.annotations.SerializedName;

import java.util.List;

public class BingoEventData {
private int key;
private int points;
@SerializedName("completed_goals")
private List<String> completedGoals;

public int getKey() {
return key;
}

public int getPoints() {
return points;
}

public List<String> getCompletedGoals() {
return completedGoals;
}

@Override
public String toString() {
return "BingoEventData{" +
"key=" + key +
", points=" + points +
", completedGoals=" + completedGoals +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.hypixel.api.reply.skyblock.bingo;

import net.hypixel.api.reply.AbstractReply;

import java.util.List;

public class SkyBlockBingoDataReply extends AbstractReply {
private List<BingoEventData> events;

public List<BingoEventData> getEvents() {
return events;
}

@Override
public String toString() {
return "SkyBlockBingoPlayerDataReply{" +
"events=" + events +
"} " + super.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.hypixel.api.example.skyblock;

import net.hypixel.api.example.ExampleUtil;

public class GetSkyBlockBingoDataExample {
public static void main(String[] args) {
ExampleUtil.API.getSkyblockBingoData(ExampleUtil.HYPIXEL).whenComplete(ExampleUtil.getTestConsumer());
ExampleUtil.await();
}
}

0 comments on commit 5ed57ca

Please sign in to comment.