Package discord4j.rest.entity
Class RestRole
- java.lang.Object
-
- discord4j.rest.entity.RestRole
-
public class RestRole extends Object
Roles represent a set of permissions, unique per guild, attached to a group of users.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Flux<discord4j.discordjson.json.RoleData>changePosition(int position)Requests to change this role's position.static RestRolecreate(RestClient restClient, Snowflake guildId, Snowflake id)Create aRestRolefor the given parameters.Mono<Void>delete(String reason)Requests to delete this role while optionally specifying the reason.Mono<discord4j.discordjson.json.RoleData>edit(discord4j.discordjson.json.RoleModifyRequest request, String reason)Requests to edit this role.booleanequals(Object o)Mono<discord4j.discordjson.json.RoleData>getData()Retrieve this role's data upon subscription.SnowflakegetGuildId()Returns the ID of the guild this role belongs to.SnowflakegetId()Returns the ID of this role.RestGuildguild()Return the guild tied to this role as a REST operations handle.inthashCode()
-
-
-
Method Detail
-
create
public static RestRole create(RestClient restClient, Snowflake guildId, Snowflake id)
Create aRestRolefor the given parameters. This method does not perform any API request.- Parameters:
restClient- the client to make API requestsid- the ID of this entity- Returns:
- a
RestRolerepresented by the given parameters.
-
getGuildId
public Snowflake getGuildId()
Returns the ID of the guild this role belongs to.- Returns:
- The ID of the the guild this role belongs to.
-
getId
public Snowflake getId()
Returns the ID of this role.- Returns:
- The ID of this role
-
guild
public RestGuild guild()
Return the guild tied to this role as a REST operations handle.- Returns:
- the parent guild for this role
-
edit
public Mono<discord4j.discordjson.json.RoleData> edit(discord4j.discordjson.json.RoleModifyRequest request, @Nullable String reason)
Requests to edit this role.- Parameters:
request- ARoleModifyRequestto parameterize this request.reason- The reason, if present.- Returns:
- A
Monowhere, upon successful completion, emits the editedRoleData. If an error is received, it is emitted through theMono.
-
delete
public Mono<Void> delete(@Nullable String reason)
Requests to delete this role while optionally specifying the reason.- Parameters:
reason- The reason, if present.- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the role has been deleted. If an error is received, it is emitted through theMono.
-
changePosition
public Flux<discord4j.discordjson.json.RoleData> changePosition(int position)
Requests to change this role's position.- Parameters:
position- The position to change for this role.- Returns:
- A
Fluxthat continually emits all therolesassociated to this role's guild. If an error is received, it is emitted through theFlux.
-
getData
public Mono<discord4j.discordjson.json.RoleData> getData()
Retrieve this role's data upon subscription.- Returns:
- a
Monowhere, upon successful completion, emits theRoleDatabelonging to this role. If an error is received, it is emitted through theMono.
-
-