Package discord4j.core.object
Class Invite
- java.lang.Object
-
- discord4j.core.object.Invite
-
- All Implemented Interfaces:
DiscordObject
- Direct Known Subclasses:
ExtendedInvite
public class Invite extends Object implements DiscordObject
A Discord invite.- See Also:
- Invite Resource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInvite.TypeRepresents the various types of target user for an invite.
-
Constructor Summary
Constructors Constructor Description Invite(GatewayDiscordClient gateway, discord4j.discordjson.json.InviteData data)Constructs aInvitewith an associatedGatewayDiscordClientand Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Mono<Void>delete()Requests to delete this invite.Mono<Void>delete(String reason)Requests to delete this invite while optionally specifying a reason.OptionalIntgetApproximateMemberCount()Gets an approximate count of total members, returned from theRoutes.INVITE_GETendpoint whenwith_countsis true.OptionalIntgetApproximatePresenceCount()Gets an approximate count of online members, returned from theRoutes.INVITE_GETendpoint whenwith_countsis true.Mono<CategorizableChannel>getChannel()Requests to retrieve the channel this invite is associated to.Mono<CategorizableChannel>getChannel(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the channel this invite is associated to, using the given retrieval strategy.SnowflakegetChannelId()Gets the ID of the channel this invite is associated to.GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat created this object.StringgetCode()Gets the invite code (unique ID).Mono<Guild>getGuild()Requests to retrieve the guild this invite is associated to, if present.Mono<Guild>getGuild(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the guild this invite is associated to, if present, using the given retrieval strategy.Optional<Snowflake>getGuildId()Gets the ID of the guild this invite is associated to.Optional<User>getInviter()Gets the user who created the invite, if present.Optional<Snowflake>getInviterId()Gets the ID of the user who created the invite, if present.Optional<Invite.Type>getTargetType()Gets the type of target for this voice channel invite, if present.Optional<User>getTargetUser()Gets the target user this invite is associated to, if present.Optional<Snowflake>getTargetUserId()Gets the ID of the target user this invite is associated to, if present.Optional<Invite.Type>getTargetUserType()Deprecated.UsegetTargetType()StringtoString()
-
-
-
Constructor Detail
-
Invite
public Invite(GatewayDiscordClient gateway, discord4j.discordjson.json.InviteData data)
Constructs aInvitewith an associatedGatewayDiscordClientand Discord data.- Parameters:
gateway- TheGatewayDiscordClientassociated to this object, must be non-null.data- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getClient
public final GatewayDiscordClient getClient()
Description copied from interface:DiscordObjectReturns theGatewayDiscordClientthat created this object. Methods in it are exclusively based on the entity cache orStorein use. Refer to callinggetClient().rest()to access aDiscordClientthat is capable of requesting entities directly from the REST API.- Specified by:
getClientin interfaceDiscordObject- Returns:
- The
GatewayDiscordClientassociated to this object.
-
getCode
public final String getCode()
Gets the invite code (unique ID).- Returns:
- The invite code (unique ID).
-
getGuildId
public final Optional<Snowflake> getGuildId()
Gets the ID of the guild this invite is associated to.- Returns:
- The ID of the guild this invite is associated to.
-
getGuild
public final Mono<Guild> getGuild()
Requests to retrieve the guild this invite is associated to, if present.
-
getGuild
public final Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the guild this invite is associated to, if present, using the given retrieval strategy.
-
getChannelId
public final Snowflake getChannelId()
Gets the ID of the channel this invite is associated to.- Returns:
- The ID of the channel this invite is associated to.
-
getChannel
public final Mono<CategorizableChannel> getChannel()
Requests to retrieve the channel this invite is associated to.
-
getChannel
public final Mono<CategorizableChannel> getChannel(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the channel this invite is associated to, using the given retrieval strategy.
-
getInviterId
public final Optional<Snowflake> getInviterId()
Gets the ID of the user who created the invite, if present.- Returns:
- The ID of the user who created the invite, if present.
-
getInviter
public final Optional<User> getInviter()
Gets the user who created the invite, if present.- Returns:
- The user who created the invite, if present.
-
getTargetUserId
public final Optional<Snowflake> getTargetUserId()
Gets the ID of the target user this invite is associated to, if present.- Returns:
- The ID of the target user this invite is associated to, if present.
-
getTargetUser
public final Optional<User> getTargetUser()
Gets the target user this invite is associated to, if present.- Returns:
- The target user this invite is associated to, if present.
-
getTargetUserType
@Deprecated public final Optional<Invite.Type> getTargetUserType()
Deprecated.UsegetTargetType()Gets the type of target user for this invite, if present.- Returns:
- The type of target user for this invite, if present.
-
getTargetType
public final Optional<Invite.Type> getTargetType()
Gets the type of target for this voice channel invite, if present.- Returns:
- The type of target for this voice channel invite, if present.
-
getApproximatePresenceCount
public final OptionalInt getApproximatePresenceCount()
Gets an approximate count of online members, returned from theRoutes.INVITE_GETendpoint whenwith_countsis true.- Returns:
- An approximate count of online members, returned from the
Routes.INVITE_GETendpoint whenwith_countsis true.
-
getApproximateMemberCount
public final OptionalInt getApproximateMemberCount()
Gets an approximate count of total members, returned from theRoutes.INVITE_GETendpoint whenwith_countsis true.- Returns:
- An approximate count of total members, returned from the
Routes.INVITE_GETendpoint whenwith_countsis true.
-
delete
public final Mono<Void> delete()
Requests to delete this invite.- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the invite has been deleted. If an error is received, it is emitted through theMono.
-
delete
public final Mono<Void> delete(@Nullable String reason)
Requests to delete this invite while optionally specifying a reason.- Parameters:
reason- The reason, if present.- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the invite has been deleted. If an error is received, it is emitted through theMono.
-
-