Enum RestEndpoint

    • Method Detail

      • values

        public static RestEndpoint[] values​()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (RestEndpoint c : RestEndpoint.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static RestEndpoint valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getMajorParameterPosition

        public Optional<Integer> getMajorParameterPosition​()
        Gets the major parameter position of the endpoint. If an endpoint has a major parameter, it means that the ratelimits for this endpoint are based on this parameter. The position starts counting at 0!
        Returns:
        An optional which is present, if the endpoint has a major parameter.
      • getEndpointUrl

        public String getEndpointUrl​()
        Gets the endpoint url (only including the base, not the https://discordapp.com/api/vXYZ/ "prefix".
        Returns:
        The gateway url.
      • isGlobal

        public boolean isGlobal​()
        Checks if the endpoint is global.
        Returns:
        Whether the endpoint is global or not.
      • setGlobal

        public void setGlobal​(boolean global)
        Sets whether this endpoint is global or not.
        Parameters:
        global - If the endpoint is global.
      • getHardcodedRatelimit

        public Optional<Integer> getHardcodedRatelimit​()
        Gets the hardcoded ratelimit if one is set.
        Returns:
        An optional which is present, if the endpoint has a hardcoded ratelimit.
      • getFullUrl

        public String getFullUrl​(String... parameters)
        Gets the full url of the endpoint. Parameters which are "too much" are added to the end.
        Parameters:
        parameters - The parameters of the url. E.g. for channel ids.
        Returns:
        The full url of the endpoint.
      • getOkHttpUrl

        public okhttp3.HttpUrl getOkHttpUrl​(String... parameters)
        Gets the full http url of the endpoint. Parameters which are "too much" are added to the end.
        Parameters:
        parameters - The parameters of the url. E.g. for channel ids.
        Returns:
        The full http url of the endpoint.