26
26
27
27
import static net .dv8tion .jda .core .requests .Method .*;
28
28
29
+ @ SuppressWarnings ("unused" )
29
30
public class Route
30
31
{
31
32
public static class Misc
32
33
{
33
- public static final Route GET_VOICE_REGIONS = new Route (GET , "voice/regions " );
34
- public static final Route GATEWAY = new Route (GET , "gateway " );
35
- public static final Route GATEWAY_BOT = new Route (GET , "gateway/bot " );
36
- public static final Route TRACK = new Route (POST , "track " );
34
+ public static final Route TRACK = new Route (POST , true , "track " );
35
+ public static final Route GET_VOICE_REGIONS = new Route (GET , true , "voice/regions " );
36
+ public static final Route GATEWAY = new Route (GET , true , "gateway" );
37
+ public static final Route GATEWAY_BOT = new Route (GET , true , "gateway/bot " );
37
38
}
38
39
39
40
public static class Applications
@@ -57,17 +58,15 @@ public static class Applications
57
58
public static final Route GET_AUTHORIZED_APPLICATION = new Route (GET , "oauth2/tokens/{auth_id}" );
58
59
public static final Route DELETE_AUTHORIZED_APPLICATION = new Route (DELETE , "oauth2/tokens/{auth_id}" );
59
60
}
60
-
61
+
61
62
public static class Self
62
63
{
63
- public static final Route GET_SELF = new Route (GET , "users/@me" );
64
- public static final Route MODIFY_SELF = new Route (PATCH , "users/@me" );
65
- public static final Route GET_GUILDS = new Route (GET , "users/@me/guilds" );
66
- public static final Route LEAVE_GUILD = new Route (DELETE , "users/@me/guilds/{guild_id}" );
67
- public static final Route GET_PRIVATE_CHANNELS = new Route (GET , "users/@me/channels" );
68
- public static final Route CREATE_PRIVATE_CHANNEL = new Route (POST , "users/@me/channels" );
69
-
70
- public static final Route GATEWAY_BOT = new Route (GET , "gateway/bot" );
64
+ public static final Route GET_SELF = new Route (GET , true , "users/@me" );
65
+ public static final Route MODIFY_SELF = new Route (PATCH , "users/@me" );
66
+ public static final Route GET_GUILDS = new Route (GET , "users/@me/guilds" );
67
+ public static final Route LEAVE_GUILD = new Route (DELETE , "users/@me/guilds/{guild_id}" );
68
+ public static final Route GET_PRIVATE_CHANNELS = new Route (GET , "users/@me/channels" );
69
+ public static final Route CREATE_PRIVATE_CHANNEL = new Route (POST , "users/@me/channels" );
71
70
72
71
// Client only
73
72
public static final Route USER_SETTINGS = new Route (GET , "users/@me/settings" );
@@ -115,8 +114,8 @@ public static class Guilds
115
114
public static final Route GET_GUILD_EMBED = new Route (GET , "guilds/{guild_id}/embed" , "guild_id" );
116
115
public static final Route MODIFY_GUILD_EMBED = new Route (PATCH , "guilds/{guild_id}/embed" , "guild_id" );
117
116
public static final Route GET_GUILD_EMOTES = new Route (GET , "guilds/{guild_id}/emojis" , "guild_id" );
118
- public static final Route GET_AUDIT_LOGS = new Route (GET , "guilds/{guild_id}/audit-logs" , "guild_id" );
119
- public static final Route GET_VOICE_REGIONS = new Route (GET , "guilds/{guild_id}/regions" , "guild_id" );
117
+ public static final Route GET_AUDIT_LOGS = new Route (GET , true , "guilds/{guild_id}/audit-logs" , "guild_id" );
118
+ public static final Route GET_VOICE_REGIONS = new Route (GET , true , "guilds/{guild_id}/regions" , "guild_id" );
120
119
121
120
public static final Route GET_INTEGRATIONS = new Route (GET , "guilds/{guild_id}/integrations" , "guild_id" );
122
121
public static final Route CREATE_INTEGRATION = new Route (POST , "guilds/{guild_id}/integrations" , "guild_id" );
@@ -194,7 +193,6 @@ public static class Messages
194
193
{
195
194
public static final Route SEND_MESSAGE = new Route (POST , "channels/{channel_id}/messages" , "channel_id" );
196
195
public static final Route EDIT_MESSAGE = new Route (PATCH , "channels/{channel_id}/messages/{message_id}" , "channel_id" );
197
- public static final Route DELETE_MESSAGE = new Route (DELETE , "channels/{channel_id}/messages/{message_id}" , "channel_id" );
198
196
public static final Route GET_PINNED_MESSAGES = new Route (GET , "channels/{channel_id}/pins" , "channel_id" );
199
197
public static final Route ADD_PINNED_MESSAGE = new Route (PUT , "channels/{channel_id}/pins/{message_id}" , "channel_id" );
200
198
public static final Route REMOVE_PINNED_MESSAGE = new Route (DELETE , "channels/{channel_id}/pins/{message_id}" , "channel_id" );
@@ -206,23 +204,24 @@ public static class Messages
206
204
public static final Route REMOVE_ALL_REACTIONS = new Route (DELETE , "channels/{channel_id}/messages/{message_id}/reactions" , "channel_id" );
207
205
public static final Route GET_REACTION_USERS = new Route (GET , "channels/{channel_id}/messages/{message_id}/reactions/{reaction_code}" , "channel_id" );
208
206
209
- public static final Route GET_MESSAGE_HISTORY = new Route (GET , "channels/{channel_id}/messages" , "channel_id" );
207
+ public static final Route DELETE_MESSAGE = new Route (DELETE , true , "channels/{channel_id}/messages/{message_id}" , "channel_id" );
208
+ public static final Route GET_MESSAGE_HISTORY = new Route (GET , true , "channels/{channel_id}/messages" , "channel_id" );
210
209
211
210
//Bot only
212
- public static final Route GET_MESSAGE = new Route (GET , "channels/{channel_id}/messages/{message_id}" , "channel_id" );
213
- public static final Route DELETE_MESSAGES = new Route (POST , "channels/{channel_id}/messages/bulk-delete" , "channel_id" );
211
+ public static final Route GET_MESSAGE = new Route (GET , true , "channels/{channel_id}/messages/{message_id}" , "channel_id" );
212
+ public static final Route DELETE_MESSAGES = new Route (POST , "channels/{channel_id}/messages/bulk-delete" , "channel_id" );
214
213
215
214
//Client only
216
215
public static final Route ACK_MESSAGE = new Route (POST , "channels/{channel_id}/messages/{message_id}/ack" );
217
216
}
218
217
219
218
public static class Invites
220
219
{
221
- public static final Route GET_INVITE = new Route (GET , "invites/{code}" );
222
- public static final Route DELETE_INVITE = new Route (DELETE , "invites/{code} " );
223
- public static final Route GET_GUILD_INVITES = new Route (GET , "guilds/{guild_id }/invites" , "guild_id " );
224
- public static final Route GET_CHANNEL_INVITES = new Route (GET , "channels/{channel_id}/invites" , "channel_id" );
225
- public static final Route CREATE_INVITE = new Route (POST , "channels/{channel_id}/invites" , "channel_id " );
220
+ public static final Route GET_INVITE = new Route (GET , true , "invites/{code}" );
221
+ public static final Route GET_GUILD_INVITES = new Route (GET , true , "guilds/{guild_id}/invites" , "guild_id " );
222
+ public static final Route GET_CHANNEL_INVITES = new Route (GET , true , "channels/{channel_id }/invites" , "channel_id " );
223
+ public static final Route CREATE_INVITE = new Route (POST , "channels/{channel_id}/invites" , "channel_id" );
224
+ public static final Route DELETE_INVITE = new Route (DELETE , "invites/{code} " );
226
225
}
227
226
228
227
public static class Custom
@@ -241,15 +240,27 @@ public static class Custom
241
240
private final Method method ;
242
241
private final List <Integer > majorParamIndexes = new ArrayList <>();
243
242
private final RateLimit ratelimit ;
243
+ private final boolean missingHeaders ;
244
244
245
245
private Route (Method method , String route , String ... majorParameters )
246
246
{
247
- this (method , null , route , majorParameters );
247
+ this (method , null , false , route , majorParameters );
248
248
}
249
249
250
250
private Route (Method method , RateLimit rateLimit , String route , String ... majorParameters )
251
+ {
252
+ this (method , rateLimit , false , route , majorParameters );
253
+ }
254
+
255
+ private Route (Method method , boolean missingHeaders , String route , String ... majorParameters )
256
+ {
257
+ this (method , null , missingHeaders , route , majorParameters );
258
+ }
259
+
260
+ private Route (Method method , RateLimit rateLimit , boolean missingHeaders , String route , String ... majorParameters )
251
261
{
252
262
this .method = method ;
263
+ this .missingHeaders = missingHeaders ;
253
264
this .ratelimit = rateLimit ;
254
265
this .route = route ;
255
266
this .paramCount = Helpers .countMatches (route , '{' ); //All parameters start with {
@@ -303,6 +314,11 @@ public String getRoute()
303
314
return route ;
304
315
}
305
316
317
+ public boolean isMissingHeaders ()
318
+ {
319
+ return missingHeaders ;
320
+ }
321
+
306
322
public String getRatelimitRoute ()
307
323
{
308
324
return ratelimitRoute ;
0 commit comments