Package org.javacord.core.util.rest
Enum RestEndpoint
- java.lang.Object
-
- java.lang.Enum<RestEndpoint>
-
- org.javacord.core.util.rest.RestEndpoint
-
- All Implemented Interfaces:
Serializable
,Comparable<RestEndpoint>
public enum RestEndpoint extends Enum<RestEndpoint>
This enum contains all endpoints which we may use.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUDIT_LOG
BAN
CHANNEL
CHANNEL_INVITE
CHANNEL_TYPING
CHANNEL_WEBHOOK
CURRENT_USER
CUSTOM_EMOJI
GATEWAY
GATEWAY_BOT
INVITE
MESSAGE
MESSAGE_DELETE
This is the same endpoint asMESSAGE
, but it has an different ratelimit bucket.MESSAGES_BULK_DELETE
OWN_NICKNAME
PINS
REACTION
ROLE
SELF_INFO
SERVER
SERVER_CHANNEL
SERVER_INVITE
SERVER_MEMBER
SERVER_MEMBER_ROLE
SERVER_PRUNE
SERVER_SELF
SERVER_WEBHOOK
USER
USER_CHANNEL
WEBHOOK
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEndpointUrl()
Gets the endpoint url (only including the base, not the https://discordapp.com/api/vXYZ/ "prefix".String
getFullUrl(String... parameters)
Gets the full url of the endpoint.Optional<Integer>
getHardcodedRatelimit()
Gets the hardcoded ratelimit if one is set.Optional<Integer>
getMajorParameterPosition()
Gets the major parameter position of the endpoint.okhttp3.HttpUrl
getOkHttpUrl(String... parameters)
Gets the fullhttp url
of the endpoint.boolean
isGlobal()
Checks if the endpoint is global.void
setGlobal(boolean global)
Sets whether this endpoint is global or not.static RestEndpoint
valueOf(String name)
Returns the enum constant of this type with the specified name.static RestEndpoint[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
GATEWAY
public static final RestEndpoint GATEWAY
-
GATEWAY_BOT
public static final RestEndpoint GATEWAY_BOT
-
MESSAGE
public static final RestEndpoint MESSAGE
-
MESSAGE_DELETE
public static final RestEndpoint MESSAGE_DELETE
This is the same endpoint asMESSAGE
, but it has an different ratelimit bucket.
-
MESSAGES_BULK_DELETE
public static final RestEndpoint MESSAGES_BULK_DELETE
-
CHANNEL_TYPING
public static final RestEndpoint CHANNEL_TYPING
-
CHANNEL_INVITE
public static final RestEndpoint CHANNEL_INVITE
-
USER
public static final RestEndpoint USER
-
USER_CHANNEL
public static final RestEndpoint USER_CHANNEL
-
CHANNEL
public static final RestEndpoint CHANNEL
-
ROLE
public static final RestEndpoint ROLE
-
SERVER
public static final RestEndpoint SERVER
-
SERVER_PRUNE
public static final RestEndpoint SERVER_PRUNE
-
SERVER_SELF
public static final RestEndpoint SERVER_SELF
-
SERVER_CHANNEL
public static final RestEndpoint SERVER_CHANNEL
-
REACTION
public static final RestEndpoint REACTION
-
PINS
public static final RestEndpoint PINS
-
SERVER_MEMBER
public static final RestEndpoint SERVER_MEMBER
-
SERVER_MEMBER_ROLE
public static final RestEndpoint SERVER_MEMBER_ROLE
-
OWN_NICKNAME
public static final RestEndpoint OWN_NICKNAME
-
SELF_INFO
public static final RestEndpoint SELF_INFO
-
CHANNEL_WEBHOOK
public static final RestEndpoint CHANNEL_WEBHOOK
-
SERVER_WEBHOOK
public static final RestEndpoint SERVER_WEBHOOK
-
SERVER_INVITE
public static final RestEndpoint SERVER_INVITE
-
WEBHOOK
public static final RestEndpoint WEBHOOK
-
INVITE
public static final RestEndpoint INVITE
-
BAN
public static final RestEndpoint BAN
-
CURRENT_USER
public static final RestEndpoint CURRENT_USER
-
AUDIT_LOG
public static final RestEndpoint AUDIT_LOG
-
CUSTOM_EMOJI
public static final RestEndpoint CUSTOM_EMOJI
-
-
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 nameNullPointerException
- 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 at0
!- 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 fullhttp 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.
-
-