Class RestRole


  • public class RestRole
    extends Object
    Roles represent a set of permissions, unique per guild, attached to a group of users.
    • Method Detail

      • create

        public static RestRole create​(RestClient restClient,
                                      Snowflake guildId,
                                      Snowflake id)
        Create a RestRole for the given parameters. This method does not perform any API request.
        Parameters:
        restClient - the client to make API requests
        id - the ID of this entity
        Returns:
        a RestRole represented 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 - A RoleModifyRequest to parameterize this request.
        reason - The reason, if present.
        Returns:
        A Mono where, upon successful completion, emits the edited RoleData. If an error is received, it is emitted through the Mono.
      • 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 Mono where, upon successful completion, emits nothing; indicating the role has been deleted. If an error is received, it is emitted through the Mono.
      • 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 Flux that continually emits all the roles associated to this role's guild. If an error is received, it is emitted through the Flux.
      • getData

        public Mono<discord4j.discordjson.json.RoleData> getData()
        Retrieve this role's data upon subscription.
        Returns:
        a Mono where, upon successful completion, emits the RoleData belonging to this role. If an error is received, it is emitted through the Mono.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object