Class Route.CompiledRoute
java.lang.Object
net.dv8tion.jda.api.requests.Route.CompiledRoute
- Enclosing class:
Route
-
Method Summary
Modifier and TypeMethodDescriptionbooleanThe route template with the original placeholders.The compiled route string of the endpoint, including all arguments and query parameters.The string of major parameters used by this route.The HTTP method.inthashCode()okhttp3.HttpUrltoHttpUrl(okhttp3.HttpUrl baseUrl) Builds anHttpUrlfor this route using the providedbaseUrl.toString()withQueryParams(String... params) Returns a copy of this CompiledRoute with the provided parameters added as query.
-
Method Details
-
withQueryParams
Returns a copy of this CompiledRoute with the provided parameters added as query.
This will use percent-encoding for all provided values but not for the keys.Example Usage
Route.CompiledRoute history = Route.GET_MESSAGE_HISTORY.compile(channelId); // returns a new route route = history.withQueryParams( "limit", 100 ); // adds another parameter ontop of limit route = route.withQueryParams( "after", messageId ); // now the route has both limit and after, you can also do this in one call: route = history.withQueryParams( "limit", 100, "after", messageId );- Parameters:
params- The parameters to add as query, alternating key and value (see example)- Returns:
- A copy of this CompiledRoute with the provided parameters added as query
- Throws:
IllegalArgumentException- If the number of arguments is not even or null is provided
-
getMajorParameters
The string of major parameters used by this route.
This is important for rate-limit handling.- Returns:
- The string of major parameters used by this route
-
getCompiledRoute
The compiled route string of the endpoint, including all arguments and query parameters.- Returns:
- The compiled route string of the endpoint
-
toHttpUrl
@Nonnull public okhttp3.HttpUrl toHttpUrl(@Nonnull okhttp3.HttpUrl baseUrl) Builds anHttpUrlfor this route using the providedbaseUrl.Note: The
baseUrlshould typically point to the API root (for example,https://discord.com/api/v10/), and this method will append the compiled route path and query.- Parameters:
baseUrl- The base URL to append this route to- Returns:
- The final
HttpUrlfor this route - Throws:
IllegalArgumentException- If null is provided- See Also:
-
getBaseRoute
The route template with the original placeholders.- Returns:
- The route template with the original placeholders
-
getMethod
-
hashCode
-
equals
-
toString
-