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 class
Invite.Type
Represents the various types of target user for an invite.
-
Constructor Summary
Constructors Constructor Description Invite(GatewayDiscordClient gateway, discord4j.discordjson.json.InviteData data)
Constructs aInvite
with an associatedGatewayDiscordClient
and 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.OptionalInt
getApproximateMemberCount()
Gets an approximate count of total members, returned from theRoutes.INVITE_GET
endpoint whenwith_counts
is true.OptionalInt
getApproximatePresenceCount()
Gets an approximate count of online members, returned from theRoutes.INVITE_GET
endpoint whenwith_counts
is 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.Snowflake
getChannelId()
Gets the ID of the channel this invite is associated to.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.String
getCode()
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()
String
toString()
-
-
-
Constructor Detail
-
Invite
public Invite(GatewayDiscordClient gateway, discord4j.discordjson.json.InviteData data)
Constructs aInvite
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated 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:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated 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_GET
endpoint whenwith_counts
is true.- Returns:
- An approximate count of online members, returned from the
Routes.INVITE_GET
endpoint whenwith_counts
is true.
-
getApproximateMemberCount
public final OptionalInt getApproximateMemberCount()
Gets an approximate count of total members, returned from theRoutes.INVITE_GET
endpoint whenwith_counts
is true.- Returns:
- An approximate count of total members, returned from the
Routes.INVITE_GET
endpoint whenwith_counts
is true.
-
delete
public final Mono<Void> delete()
Requests to delete this invite.- Returns:
- A
Mono
where, 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
Mono
where, upon successful completion, emits nothing; indicating the invite has been deleted. If an error is received, it is emitted through theMono
.
-
-