Skip to content

Commit a2affaf

Browse files
committed
Version 5.2.3
1 parent afc3d66 commit a2affaf

File tree

9 files changed

+70
-208
lines changed

9 files changed

+70
-208
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins{
99
id 'net.kyori.blossom' version '1.1.0'
1010
}
1111

12-
def ver = new Version(major: 5, minor: 2, revision: 2)
12+
def ver = new Version(major: 5, minor: 2, revision: 3)
1313

1414
group = "org.botblock"
1515
version = "$ver"

src/main/java/org/botblock/javabotblockapi/BotBlockAPI.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818
package org.botblock.javabotblockapi;
1919

20-
import org.botblock.javabotblockapi.annotations.DeprecatedSince;
21-
import org.botblock.javabotblockapi.annotations.PlannedRemoval;
2220
import org.botblock.javabotblockapi.requests.CheckUtil;
2321
import org.botblock.javabotblockapi.requests.PostAction;
2422

@@ -37,26 +35,6 @@ public class BotBlockAPI{
3735

3836
private final Map<String, String> tokens;
3937
private final int updateDelay;
40-
41-
/**
42-
* Constructor to set the Map with the sites and tokens.
43-
*
44-
* @param tokens
45-
* A not null Map of sites and their tokens.
46-
* <br>You may receive the API-token from your bot list.
47-
*
48-
* @throws java.lang.NullPointerException
49-
* When the provided Map is empty.
50-
*
51-
* @deprecated This constructor will no longer be accessible in future versions.
52-
* <br>Use the {@link org.botblock.javabotblockapi.BotBlockAPI.Builder Builder} instead!
53-
*/
54-
@Deprecated
55-
@DeprecatedSince(version = "5.2.0")
56-
@PlannedRemoval(version = "5.2.3")
57-
public BotBlockAPI(@Nonnull Map<String, String> tokens){
58-
this(tokens, DEFAULT_DELAY);
59-
}
6038

6139
private BotBlockAPI(@Nonnull Map<String, String> tokens, int updateDelay){
6240
if(tokens.isEmpty())

src/main/java/org/botblock/javabotblockapi/Site.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
*/
1818
package org.botblock.javabotblockapi;
1919

20+
import org.botblock.javabotblockapi.annotations.DeprecatedSince;
21+
import org.botblock.javabotblockapi.annotations.PlannedRemoval;
22+
2023
/**
2124
* Enum class containing all sites currently supported by BotBlock.org.
2225
*
@@ -76,6 +79,13 @@ public enum Site {
7679
*/
7780
DISCORDBOTLIST_COM("discordbotlist.com"),
7881

82+
/**
83+
* <a href="https://discordbots.co" target="_blank">discordbots.co</a>
84+
*
85+
* @since 5.2.3
86+
*/
87+
DISCORDBOTS_CO("discordbots.co"),
88+
7989
/**
8090
* <a href="https://discord.bots.gg" target="_blank">discord.bots.gg</a>
8191
*/
@@ -124,7 +134,13 @@ public enum Site {
124134
* <a href="https://vultrex.io" target="_blank">vultrex.io</a>
125135
*
126136
* @since 5.2.1
137+
*
138+
* @deprecated Renamed to {@link #DISCORDBOTS_CO DISCORDBOTS_CO}
139+
* <br>Planned removal in v5.2.5
127140
*/
141+
@Deprecated
142+
@DeprecatedSince(version = "5.2.3", replacements = {"#DISCORDBOTS_CO"})
143+
@PlannedRemoval(version = "5.2.5")
128144
VULTREX_IO("vultrex.io"),
129145

130146
/**

src/main/java/org/botblock/javabotblockapi/requests/GetBotAction.java

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
package org.botblock.javabotblockapi.requests;
2020

2121
import org.botblock.javabotblockapi.Site;
22-
import org.botblock.javabotblockapi.annotations.DeprecatedSince;
23-
import org.botblock.javabotblockapi.annotations.PlannedRemoval;
2422
import org.json.JSONArray;
2523
import org.json.JSONObject;
2624

@@ -32,7 +30,8 @@
3230
/**
3331
* Class used to perform GET actions on the <a href="https://botblock.org/api/docs#bots" target="_blank">{@code /api/bots/:id}</a> endpoint.
3432
*
35-
* <p>GET requests are cached for 2 minutes unless disabled through {@link #GetBotAction(boolean) GetBotAction(true)}
33+
* <p>GET requests are cached for 2 minutes unless disabled through either {@link #GetBotAction(boolean, String) GetBotAction(true, String)}
34+
* or {@link #GetBotAction(boolean, String, String) GetBotAction(true, String, String)}.
3635
*
3736
* @since 5.0.0
3837
*/
@@ -42,38 +41,6 @@ public class GetBotAction{
4241

4342
private final boolean disableCache;
4443

45-
/**
46-
* Constructor to get the instance of GetBotAction.
47-
*
48-
* @deprecated This Constructor can no longer be used and will throw an {@link java.lang.IllegalStateException IllegalStateException}
49-
* when used.
50-
*/
51-
@Deprecated
52-
@DeprecatedSince(version = "5.2.0", replacements = {"GetBotAction(String)", "GetBotAction(boolean, String)", "GetBotAction(boolean, String, String)"})
53-
@PlannedRemoval(version = "5.2.3")
54-
public GetBotAction(){
55-
throw new IllegalStateException("This constructor may no longer be used.");
56-
}
57-
58-
/**
59-
* Constructor to get an instance of GetBotAction.
60-
* <br>Use this if you want to disable the caching of the GET requests.
61-
* <br><b>We do not recommend this without own caching/ratelimiting.</b>
62-
*
63-
* @param disableCache
64-
* Whether or not caching should be disabled.
65-
* <br>{@code true} means caching is <b>disabled</b>!
66-
*
67-
* @deprecated This Constructor can no longer be used and will throw an {@link java.lang.IllegalStateException IllegalStateException}
68-
* when used.
69-
*/
70-
@Deprecated
71-
@DeprecatedSince(version = "5.2.0", replacements = {"GetBotAction(String)", "GetBotAction(boolean, String)", "GetBotAction(boolean, String, String)"})
72-
@PlannedRemoval(version = "5.2.3")
73-
public GetBotAction(boolean disableCache){
74-
throw new IllegalStateException("This constructor may no longer be used.");
75-
}
76-
7744
/**
7845
* Constructor to get an instance of GetBotAction.
7946
*

src/main/java/org/botblock/javabotblockapi/requests/GetListAction.java

Lines changed: 28 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
package org.botblock.javabotblockapi.requests;
2020

2121
import org.botblock.javabotblockapi.Site;
22-
import org.botblock.javabotblockapi.annotations.DeprecatedSince;
23-
import org.botblock.javabotblockapi.annotations.PlannedRemoval;
2422
import org.jetbrains.annotations.Nullable;
2523
import org.json.JSONArray;
2624
import org.json.JSONObject;
@@ -31,7 +29,8 @@
3129
* Class used to perform GET actions on the <a href="https://botblock.org/api/docs#lists" target="_blank">{@code /api/lists}</a>
3230
* and <a href="https://botblock.org/api/docs#list" target="_blank">{@code /api/lists/:id}</a> endpoints.
3331
*
34-
* <p>GET requests are cached for 2 minutes unless disabled through {@link #GetListAction(boolean) GetListAction(true)}.
32+
* <p>GET requests are cached for 2 minutes unless disabled through {@link #GetListAction(boolean, String) GetListAction(true, String)}
33+
* or {@link #GetListAction(boolean, String, String) GetListAction(true, String, String)}.
3534
*
3635
* @since 5.0.0
3736
*/
@@ -40,37 +39,6 @@ public class GetListAction{
4039
private final RequestHandler REQUEST_HANDLER;
4140
private final boolean disableCache;
4241

43-
/**
44-
* Constructor to get an instance of GetListAction.
45-
*
46-
* @deprecated This Constructor can no longer be used and will throw an {@link java.lang.IllegalStateException IllegalStateException}
47-
* when used.
48-
*/
49-
@Deprecated
50-
@DeprecatedSince(version = "5.2.0")
51-
@PlannedRemoval(version = "5.2.3")
52-
public GetListAction(){
53-
throw new IllegalStateException("This constructor may no longer be used.");
54-
}
55-
56-
/**
57-
* Constructor to get an instance of GetListAction.
58-
* <br>Use this if you want to disable the caching of the GET requests.
59-
* <br><b>We do not recommend this without own caching/ratelimiting.</b>
60-
*
61-
* @param disableCache
62-
* Whether or not to disable caching. {@code true} means caching gets <b>disabled</b>!
63-
*
64-
* @deprecated This Constructor can no longer be used and will throw an {@link java.lang.IllegalStateException IllegalStateException}
65-
* when used.
66-
*/
67-
@Deprecated
68-
@DeprecatedSince(version = "5.2.0", replacements = {"GetListAction(String)", "GetListAction(boolean, String)", "GetListAction(boolean, String, String)"})
69-
@PlannedRemoval(version = "5.2.3")
70-
public GetListAction(boolean disableCache){
71-
throw new IllegalStateException("This constructor may no longer be used.");
72-
}
73-
7442
/**
7543
* Constructor to get an instance of GetListAction.
7644
*
@@ -155,7 +123,7 @@ public String getApiField(@Nonnull String id, @Nonnull Site site, @Nonnull ApiFi
155123
CheckUtil.notEmpty(id, "id");
156124
JSONObject json = getList(id, site);
157125

158-
return json.getString(field.name().toLowerCase());
126+
return json.getString(field.getApiField());
159127
}
160128

161129
/**
@@ -176,7 +144,7 @@ public String getApiField(@Nonnull String id, @Nonnull String site, @Nonnull Api
176144
CheckUtil.notEmpty(site, "site");
177145
JSONObject json = getList(id, site);
178146

179-
return json.getString(field.name().toLowerCase());
147+
return json.getString(field.getApiField());
180148
}
181149

182150
/**
@@ -721,127 +689,35 @@ public boolean isDiscordOnly(@Nonnull String id, @Nonnull String site){
721689
* @since 5.0.0
722690
*/
723691
public enum ApiField{
724-
// URL fields
725-
726-
/**
727-
* API field to return the URL to list all bots of a bot list.
728-
*
729-
* @deprecated Since: 5.2.0
730-
* <br>Replacement: {@link #URL_ALL URL_ALL}
731-
*/
732-
@Deprecated
733-
@DeprecatedSince(version = "5.2.0", replacements = {"#URL_ALL"})
734-
@PlannedRemoval(version = "5.2.3")
735-
API_ALL,
736-
737-
/**
738-
* API field to return the URL to the API documentation of the bot list.
739-
*
740-
* @deprecated Since: 5.2.0
741-
* <br>Replacement: {@link #URL_DOCS URL_DOCS}
742-
*/
743-
@Deprecated
744-
@DeprecatedSince(version = "5.2.0", replacements = {"#URL_DOCS"})
745-
@PlannedRemoval(version = "5.2.3")
746-
API_DOCS,
747-
748-
/**
749-
* API field to return the URL used to GET information about a bot.
750-
*
751-
* @deprecated Since: 5.2.0
752-
* <br>Replacement: {@link #URL_GET URL_GET}
753-
*/
754-
@Deprecated
755-
@DeprecatedSince(version = "5.2.0", replacements = {"#URL_GET"})
756-
@PlannedRemoval(version = "5.2.3")
757-
API_GET,
758-
759-
/**
760-
* API field to return the URL used to POST information from a bot.
761-
*
762-
* @deprecated Since: 5.2.0
763-
* <br>Replacement: {@link #URL_POST URL_POST}
764-
*/
765-
@Deprecated
766-
@DeprecatedSince(version = "5.2.0", replacements = {"#URL_POST"})
767-
@PlannedRemoval(version = "5.2.3")
768-
API_POST,
769-
770-
// Fields returning a String
771-
772-
/**
773-
* Name of the field for posting the server count (i.e. {@code server_count})
774-
*
775-
* @deprecated Since: 5.2.0
776-
* <br>Replacement: {@link #STRING_SERVER_COUNT STRING_SERVER_COUNT}
777-
*/
778-
@Deprecated
779-
@DeprecatedSince(version = "5.2.0", replacements = {"#STRING_SERVER_COUNT"})
780-
@PlannedRemoval(version = "5.2.3")
781-
API_FIELD,
782-
783-
/**
784-
* Name of the field for posting the shard id (i.e. {@code shard_id})
785-
*
786-
* @deprecated Since: 5.2.0
787-
* <br>Replacement: {@link #STRING_SHARD_ID STRING_SHARD_ID}
788-
*/
789-
@Deprecated
790-
@DeprecatedSince(version = "5.2.0", replacements = {"#STRING_SHARD_ID"})
791-
@PlannedRemoval(version = "5.2.3")
792-
API_SHARD_ID,
793-
794-
/**
795-
* Name of the field for posting the shard count (i.e. {@code shard_count})
796-
*
797-
* @deprecated Since: 5.2.0
798-
* <br>Replacement: {@link #STRING_SHARD_COUNT STRING_SHARD_COUNT}
799-
*/
800-
@Deprecated
801-
@DeprecatedSince(version = "5.2.0", replacements = {"#STRING_SHARD_COUNT"})
802-
@PlannedRemoval(version = "5.2.3")
803-
API_SHARD_COUNT,
804-
805-
/**
806-
* Name of the field for posting the different shard info (i.e. {@code shards})
807-
*
808-
* @deprecated Since: 5.2.0
809-
* <br>Replacement: {@link #STRING_SHARDS STRING_SHARDS}
810-
*/
811-
@Deprecated
812-
@DeprecatedSince(version = "5.2.0", replacements = {"#STRING_SHARDS"})
813-
@PlannedRemoval(version = "5.2.3")
814-
API_SHARDS,
815-
816692
// String API field
817693

818694
/**
819695
* Name of the field for the server count. Example: {@code server_count}
820696
*
821697
* @since 5.2.0
822698
*/
823-
STRING_SERVER_COUNT,
699+
STRING_SERVER_COUNT("api_field"),
824700

825701
/**
826702
* Name of the field for the shard id. Example: {@code shard_id}
827703
*
828704
* @since 5.2.0
829705
*/
830-
STRING_SHARD_ID,
706+
STRING_SHARD_ID("api_shard_id"),
831707

832708
/**
833709
* Name of the field for the shard count. Example: {@code shard_count}
834710
*
835711
* @since 5.2.0
836712
*/
837-
STRING_SHARD_COUNT,
713+
STRING_SHARD_COUNT("api_shard_count"),
838714

839715
/**
840716
* Name of the field for the shards. Example: {@code shards}
841717
*
842718
* @since 5.2.0
843719
*/
844-
STRING_SHARDS,
720+
STRING_SHARDS("api_shards"),
845721

846722
// URL API field
847723

@@ -850,27 +726,43 @@ public enum ApiField{
850726
*
851727
* @since 5.2.0
852728
*/
853-
URL_ALL,
729+
URL_ALL("api_all"),
854730

855731
/**
856732
* URL to view the API documentation of the bot list
857733
*
858734
* @since 5.2.0
859735
*/
860-
URL_DOCS,
736+
URL_DOCS("api_docs"),
861737

862738
/**
863739
* URL to GET information about a single bot listed on the bot list.
864740
*
865741
* @since 5.2.0
866742
*/
867-
URL_GET,
743+
URL_GET("api_get"),
868744

869745
/**
870746
* URL to POST the server count to a bot list.
871747
*
872748
* @since 5.2.0
873749
*/
874-
URL_POST
750+
URL_POST("api_post");
751+
752+
private final String apiField;
753+
754+
ApiField(String apiField){
755+
this.apiField = apiField;
756+
}
757+
758+
public String getApiField(){
759+
return apiField;
760+
}
761+
762+
763+
@Override
764+
public String toString(){
765+
return apiField;
766+
}
875767
}
876768
}

0 commit comments

Comments
 (0)