Class RestScheduledEvent

java.lang.Object
discord4j.rest.entity.RestScheduledEvent

public class RestScheduledEvent extends Object
Represents a guild scheduled event within Discord.
  • Method Details

    • create

      public static RestScheduledEvent create(RestClient restClient, Snowflake guildId, Snowflake id)
      Create a RestScheduledEvent for the given parameters. This method does not perform any API request.
      Parameters:
      restClient - The client to make API requests.
      guildId - The ID of the guild this entity belongs to.
      id - the ID of this entity.
      Returns:
      A RestGuildScheduledEvent represented by the given parameters.
    • getGuildId

      public Snowflake getGuildId()
      Returns the ID of the guild this scheduled event belongs to.
      Returns:
      The ID of the guild this scheduled event belongs to.
    • getId

      public Snowflake getId()
      Returns the ID of this scheduled event.
      Returns:
      The ID of this scheduled event.
    • guild

      public RestGuild guild()
      Return the guild tied to thi role as a REST operations handle.
      Returns:
      The parent guild for this scheduled event.
    • edit

      public Mono<discord4j.discordjson.json.GuildScheduledEventData> edit(discord4j.discordjson.json.GuildScheduledEventModifyRequest request, @Nullable String reason)
      Requests to edit this event.
      Parameters:
      request - A GuildScheduledEventModifyRequest to parameterize this request.
      reason - The reason, if present
      Returns:
      A Mono where, upon successful completion, emits the edited GuildScheduledEventData. If an error is received, it is emitted through the Mono.
    • delete

      public Mono<Void> delete(@Nullable String reason)
      Requests to delete this event while optionally specifying the reason.
      Parameters:
      reason - The reason, if present.
      Returns:
      A Mono where, upon successful completion, emits nothing; indicating the event was deleted. If an error is received, it is emitted through the Mono.
    • getSubscribedUsersBefore

      public Flux<discord4j.discordjson.json.GuildScheduledEventUserData> getSubscribedUsersBefore(Snowflake userId, @Nullable Boolean withMember)
      Request to retrieve all subscribed users before the specified ID.

      The returned Flux will emit items in reverse-chronological order (newest to oldest). It is recommended to limit the emitted items by invoking either Flux.takeWhile(Predicate) (to retrieve IDs within a specified range) or Flux.take(long) (to retrieve a specific amount of IDs).

      The following example will get all users from userId to myOtherUserId: getSubscribedUsersBefore(userId).takeWhile(user -> user.getId().compareTo(myOtherUserId) >= 0)

      Parameters:
      userId - The ID of the newest user to retrieve.
      withMember - Whether to optionally include the member object in the returned data (if the user is a member).
      Returns:
      A Flux that continually emits all users before the specified ID. If an error is received, it is emitted through the Flux.
      See Also:
    • getSubscribedUsersAfter

      public Flux<discord4j.discordjson.json.GuildScheduledEventUserData> getSubscribedUsersAfter(Snowflake userId, @Nullable Boolean withMember)
      Request to retrieve all subscribed users after the specified ID.

      The returned Flux will emit items in chronological order (older to newest). It is recommended to limit the emitted items by invoking either Flux.takeWhile(Predicate) (to retrieve IDs within a specified range) or Flux.take(long) (to retrieve a specific amount of IDs).

      The following example will get all users from userId to myOtherUserId: getSubscribedUsersAfter(userId).takeWhile(user -> user.getId().compareTo(myOtherUserId) <= 0)

      Parameters:
      userId - The ID of the oldest user to retrieve.
      withMember - Whether to optionally include the member object in the returned data (if the user is a member).
      Returns:
      A Flux that continually emits all users after the specified ID. If an error is received, it is emitted through the Flux.
      See Also:
    • getData

      public Mono<discord4j.discordjson.json.GuildScheduledEventData> getData(@Nullable Boolean withUserCount)
      Retrieve this scheduled event's data upon subscription.
      Parameters:
      withUserCount - Whether to optionally include the subscribed user count in the returned data.
      Returns:
      A Mono where, upon successful completion, emits the GuildScheduledEventData belonging to this scheduled event. If an error is received, it is emitted through the Mono.