Class Route.CompiledRoute

java.lang.Object
net.dv8tion.jda.api.requests.Route.CompiledRoute
Enclosing class:
Route

public class Route.CompiledRoute extends Object
A route compiled with arguments.
See Also:
  • Method Details

    • withQueryParams

      @Nonnull @CheckReturnValue public Route.CompiledRoute withQueryParams(@Nonnull String... params)
      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

      @Nonnull public String 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

      @Nonnull public String getCompiledRoute()
      The compiled route string of the endpoint, including all arguments and query parameters.
      Returns:
      The compiled route string of the endpoint
    • getBaseRoute

      @Nonnull public Route getBaseRoute()
      The route template with the original placeholders.
      Returns:
      The route template with the original placeholders
    • getMethod

      @Nonnull public Method getMethod()
      The HTTP method.
      Returns:
      The HTTP method
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object