Class RestScheduledEvent
-
Method Summary
Modifier and TypeMethodDescriptionstatic RestScheduledEvent
create
(RestClient restClient, Snowflake guildId, Snowflake id) Create aRestScheduledEvent
for the given parameters.Requests to delete this event while optionally specifying the reason.Mono<discord4j.discordjson.json.GuildScheduledEventData>
Requests to edit this event.Mono<discord4j.discordjson.json.GuildScheduledEventData>
Retrieve this scheduled event's data upon subscription.Returns the ID of the guild this scheduled event belongs to.getId()
Returns the ID of this scheduled event.Flux<discord4j.discordjson.json.GuildScheduledEventUserData>
getSubscribedUsersAfter
(Snowflake userId, Boolean withMember) Request to retrieve all subscribed users after the specified ID.Flux<discord4j.discordjson.json.GuildScheduledEventUserData>
getSubscribedUsersBefore
(Snowflake userId, Boolean withMember) Request to retrieve all subscribed users before the specified ID.guild()
Return the guild tied to thi role as a REST operations handle.
-
Method Details
-
create
Create aRestScheduledEvent
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
Returns the ID of the guild this scheduled event belongs to.- Returns:
- The ID of the guild this scheduled event belongs to.
-
getId
Returns the ID of this scheduled event.- Returns:
- The ID of this scheduled event.
-
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
- AGuildScheduledEventModifyRequest
to parameterize this request.reason
- The reason, if present- Returns:
- A
Mono
where, upon successful completion, emits the editedGuildScheduledEventData
. If an error is received, it is emitted through theMono
.
-
delete
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 theMono
.
-
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 eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all users from
userId
tomyOtherUserId
: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 allusers
before the specified ID. If an error is received, it is emitted through theFlux
. - 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 eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all users from
userId
tomyOtherUserId
: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 allusers
after the specified ID. If an error is received, it is emitted through theFlux
. - 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 theGuildScheduledEventData
belonging to this scheduled event. If an error is received, it is emitted through theMono
.
-