Class Invite

    • Constructor Detail

      • Invite

        public Invite​(GatewayDiscordClient gateway,
                      discord4j.discordjson.json.InviteData data)
        Constructs a Invite with an associated GatewayDiscordClient and Discord data.
        Parameters:
        gateway - The GatewayDiscordClient associated to this object, must be non-null.
        data - The raw data as represented by Discord, must be non-null.
    • Method Detail

      • 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.
        Returns:
        A Mono where, upon successful completion, emits the guild this invite is associated to. If an error is received, it is emitted through the Mono.
      • 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.
        Parameters:
        retrievalStrategy - the strategy to use to get the guild
        Returns:
        A Mono where, upon successful completion, emits the guild this invite is associated to. If an error is received, it is emitted through the Mono.
      • 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.
        Returns:
        A Mono where, upon successful completion, emits the channel this invite is associated to. If an error is received, it is emitted through the Mono.
      • getChannel

        public final Mono<CategorizableChannel> getChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel this invite is associated to, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the channel
        Returns:
        A Mono where, upon successful completion, emits the channel this invite is associated to. If an error is received, it is emitted through the Mono.
      • 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.
        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 the Routes.INVITE_GET endpoint when with_counts is true.
        Returns:
        An approximate count of online members, returned from the Routes.INVITE_GET endpoint when with_counts is true.
      • getApproximateMemberCount

        public final OptionalInt getApproximateMemberCount()
        Gets an approximate count of total members, returned from the Routes.INVITE_GET endpoint when with_counts is true.
        Returns:
        An approximate count of total members, returned from the Routes.INVITE_GET endpoint when with_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 the Mono.
      • 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 the Mono.