Package com.jagrosh.jdautilities.oauth2
Enum Class Scope
- All Implemented Interfaces:
Serializable
,Comparable<Scope>
,Constable
Constants used to specify the scope of OAuth2 sessions.
All OAuth2 sessions can act within' their available scope upon creation, and as such, these are specified in when the session's are created.
- Author:
- John Grosh ([email protected])
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionFor oauth2 bots, this puts the bot in the user's selected guild by defaultAllows /users/@me/connections to return linked third-party accountsEnables /users/@me to return an emailAllows your app to join users to a group dmAllows /users/@me/guilds to return basic information about all of a user's guildsAllows /invites/{invite.id} to be used for joining users to a guildAllows /users/@me without emailFor local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates)For local rpc server access, this allows you to control a user's local Discord clientFor local rpc server api access, this allows you to access the API as the local userFor local rpc server api access, this allows you to receive notifications pushed out to the userUnknown scopeThis generates a webhook that is returned in the oauth token response for authorization code grants -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static Scope
Gets a scope based on the specified text key.getText()
The text key associated with this scope.static String
Joins the specified scopes properly as they should be represented as part of an authorization URL.static String
Joins the specified scopes properly as they should be represented as part of an authorization URL.static Scope
Returns the enum constant of this class with the specified name.static Scope[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BOT
For oauth2 bots, this puts the bot in the user's selected guild by default -
CONNECTIONS
Allows /users/@me/connections to return linked third-party accounts -
EMAIL
Enables /users/@me to return an email -
IDENTIFY
Allows /users/@me without email -
GUILDS
Allows /users/@me/guilds to return basic information about all of a user's guilds -
GUILDS_JOIN
Allows /invites/{invite.id} to be used for joining users to a guild -
GDM_JOIN
Allows your app to join users to a group dm -
MESSAGES_READ
For local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates) -
RPC
For local rpc server access, this allows you to control a user's local Discord client -
RPC_API
For local rpc server api access, this allows you to access the API as the local user -
RPC_NOTIFICATIONS_READ
For local rpc server api access, this allows you to receive notifications pushed out to the user -
WEBHOOK_INCOMING
This generates a webhook that is returned in the oauth token response for authorization code grants -
UNKNOWN
Unknown scope
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
getText
The text key associated with this scope.- Returns:
- The text key associated with this scope.
-
contains
-
join
Joins the specified scopes properly as they should be represented as part of an authorization URL.- Parameters:
scopes
- The scopes to join.- Returns:
- A String representing how the scopes should be represented as part of an authorization URL.
-
join
Joins the specified scopes properly as they should be represented as part of an authorization URL.- Parameters:
bySpace
- If the scopes should be joined by " " or "%20" (default: "%20")scopes
- The scopes to join.- Returns:
- A String representing how the scopes should be represented as part of an authorization URL.
-
from
Gets a scope based on the specified text key.- Parameters:
scope
- A text key to get a scope by.- Returns:
- The scope matching the provided text key
(
UNKNOWN
by default)
-