Package dev.mayuna.topggsdk
Class TopGGAPI
- java.lang.Object
-
- dev.mayuna.simpleapi.SimpleAPI
-
- dev.mayuna.topggsdk.TopGGAPI
-
public class TopGGAPI extends dev.mayuna.simpleapi.SimpleAPIMain class of Top-GG API wrapped in Java. Using this class, you can request stuff and post stuff to top.gg's API. Some endpoints/methods do not require bot ID.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description dev.mayuna.simpleapi.Action<Bot>fetchBot()Fetches your Bot by specified Bot ID in constructor.dev.mayuna.simpleapi.Action<Bot>fetchBot(java.lang.String botId)Fetches your Bot by specified Bot ID in arguments.dev.mayuna.simpleapi.Action<Stats>fetchBotStats()Fetches specific stats (server count, shards, shard count) about a bot.dev.mayuna.simpleapi.Action<User[]>fetchLast1000Votes()Fetches the last 1000 voters for your bot.
Note: If your bot receives more than 1000 votes monthly you cannot use this endpoint and must use webhooks and implement your own caching instead.
This endpoint only returns unique votes, it does not include double votes (weekend votes).dev.mayuna.simpleapi.Action<MultiplierStatus>fetchMultiplierStatus()FetchesMultiplierStatuswhich tells if currently it is weekend (during weekends, bots receive double votes).dev.mayuna.simpleapi.Action<User>fetchUser(java.lang.String userId)FetchesUserby their Discord user IDdev.mayuna.simpleapi.Action<VoteStatus>fetchVoteStatus(java.lang.String userId)Fetches status whether a user has voted for your bot.dev.mayuna.simpleapi.Header[]getDefaultHeads()java.lang.StringgetURL()dev.mayuna.simpleapi.Action<Bots>searchBots()Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(int limit)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(int limit, int offset)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(int limit, int offset, java.lang.String search)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(int limit, int offset, java.lang.String search, java.lang.String sort)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(int limit, int offset, java.lang.String search, java.lang.String sort, java.lang.String fields)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(java.lang.String search)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<Bots>searchBots(java.lang.String search, java.lang.String sort)Searches bots by specified arguments.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int serverCount)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int[] serverCount)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int[] serverCount, int shardCount)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int serverCount, int shardCount)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int serverCount, int[] shards)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int serverCount, int[] shards, int shardCount)Updates bot's stats.dev.mayuna.simpleapi.Action<TopGGAPIResponse>updateBotStats(int serverCount, int shardId, int shardCount)Updates bot's stats.
-
-
-
Method Detail
-
getURL
public java.lang.String getURL()
- Specified by:
getURLin classdev.mayuna.simpleapi.SimpleAPI
-
getDefaultHeads
public dev.mayuna.simpleapi.Header[] getDefaultHeads()
- Overrides:
getDefaultHeadsin classdev.mayuna.simpleapi.SimpleAPI
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots()
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Limit: 50
- Offset: 0
- Search empty
- Sort empty
- Fields empty- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(int limit)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Offset: 0
- Search empty
- Sort empty
- Fields empty- Parameters:
limit- The amount of bots to search for. Max. 500- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(int limit, int offset)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Search empty
- Sort empty
- Fields empty- Parameters:
limit- The amount of bots to search for. Max. 500offset- TAmount of bots to skip- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(int limit, int offset, java.lang.String search)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Sort empty
- Fields empty- Parameters:
limit- The amount of bots to search for. Max. 500offset- TAmount of bots to skipsearch- A search string in the format offield: value field2: value2- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(java.lang.String search)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Limit: 50
- Offset: 0
- Sort empty
- Fields empty- Parameters:
search- A search string in the format offield: value field2: value2- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(java.lang.String search, java.lang.String sort)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Limit: 50
- Offset: 0
- Fields empty- Parameters:
search- A search string in the format offield: value field2: value2sort- The field to sort by. Prefix with-to reverse the order- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(int limit, int offset, java.lang.String search, java.lang.String sort)
Searches bots by specified arguments. Bot ID for this endpoint is not required.
Default values:
- Fields empty- Parameters:
limit- The amount of bots to search for. Max. 500offset- TAmount of bots to skipsearch- A search string in the format offield: value field2: value2sort- The field to sort by. Prefix with-to reverse the order- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
searchBots
public dev.mayuna.simpleapi.Action<Bots> searchBots(int limit, int offset, java.lang.String search, java.lang.String sort, java.lang.String fields)
Searches bots by specified arguments. Bot ID for this endpoint is not required.- Parameters:
limit- The amount of bots to search for. Max. 500offset- TAmount of bots to skipsearch- A search string in the format offield: value field2: value2sort- The field to sort by. Prefix with-to reverse the orderfields- A comma separated list of fields to show- Returns:
ActionwithBotsobject- See Also:
- https://docs.top.gg/api/bot/#search-bots
-
fetchBot
public dev.mayuna.simpleapi.Action<Bot> fetchBot(java.lang.String botId)
Fetches your Bot by specified Bot ID in arguments. Bot ID for this method is not required.- Parameters:
botId- Bot's Discord ID- Returns:
ActionwithBotobject- See Also:
- https://docs.top.gg/api/bot/#find-one-bot
-
fetchBot
public dev.mayuna.simpleapi.Action<Bot> fetchBot()
Fetches your Bot by specified Bot ID in constructor. Bot ID for this method is required.- Returns:
ActionwithBotobject- See Also:
- https://docs.top.gg/api/bot/#find-one-bot
-
fetchLast1000Votes
public dev.mayuna.simpleapi.Action<User[]> fetchLast1000Votes()
Fetches the last 1000 voters for your bot.
Note: If your bot receives more than 1000 votes monthly you cannot use this endpoint and must use webhooks and implement your own caching instead.
This endpoint only returns unique votes, it does not include double votes (weekend votes).- Returns:
ActionwithUserarray- See Also:
- https://docs.top.gg/api/bot/#last-1000-votes
-
fetchBotStats
public dev.mayuna.simpleapi.Action<Stats> fetchBotStats()
Fetches specific stats (server count, shards, shard count) about a bot.- Returns:
ActionwithStatsobject
-
fetchVoteStatus
public dev.mayuna.simpleapi.Action<VoteStatus> fetchVoteStatus(java.lang.String userId)
Fetches status whether a user has voted for your bot. Safe to use even if you have over 1k monthly votes.- Parameters:
userId- User ID (Discord user ID)- Returns:
ActionwithVoteStatusobject- See Also:
- https://docs.top.gg/api/bot/#individual-user-vote
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int serverCount)
Updates bot's stats.- Parameters:
serverCount- Amount of servers the bot is in- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int serverCount, int shardCount)
Updates bot's stats.- Parameters:
serverCount- Amount of servers the bot is inshardCount- The amount of shards the bot has- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int serverCount, int shardId, int shardCount)
Updates bot's stats.- Parameters:
serverCount- Amount of servers the bot is inshardId- The zero-indexed id of the shard posting. Makes server_count set the shard specific server count.shardCount- The amount of shards the bot has- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int[] serverCount)
Updates bot's stats.- Parameters:
serverCount- Amount of servers the bot is in per shard- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int[] serverCount, int shardCount)
Updates bot's stats.- Parameters:
serverCount- Amount of servers the bot is in per shardshardCount- The amount of shards the bot has- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int serverCount, int[] shards)
Updates bot's stats. This method seems quite useless, however I am keeping this method just in case.- Parameters:
serverCount- Amount of servers the bot is inshards- Amount of servers the bot is in per shard- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
updateBotStats
public dev.mayuna.simpleapi.Action<TopGGAPIResponse> updateBotStats(int serverCount, int[] shards, int shardCount)
Updates bot's stats. This method seems quite useless, however I am keeping this method just in case.- Parameters:
serverCount- Amount of servers the bot is in per shardshards- Amount of servers the bot is in per shardshardCount- The amount of shards the bot has- Returns:
ActionwithTopGGAPIResponseobject- See Also:
- https://docs.top.gg/api/bot/#post-stats
-
fetchUser
public dev.mayuna.simpleapi.Action<User> fetchUser(java.lang.String userId)
FetchesUserby their Discord user ID- Parameters:
userId- User ID (Discord user ID)- Returns:
ActionwithUserobject
-
fetchMultiplierStatus
public dev.mayuna.simpleapi.Action<MultiplierStatus> fetchMultiplierStatus()
FetchesMultiplierStatuswhich tells if currently it is weekend (during weekends, bots receive double votes).- Returns:
ActionwithMultiplierStatusobject
-
-