Class AccountUpdater


  • public class AccountUpdater
    extends java.lang.Object
    This class can be used to update the connected account (e.g. username or avatar).
    • Constructor Summary

      Constructors 
      Constructor Description
      AccountUpdater​(DiscordApi api)
      Creates a new account updater.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AccountUpdater setAvatar​(byte[] avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(byte[] avatar, java.lang.String fileType)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.awt.image.BufferedImage avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.awt.image.BufferedImage avatar, java.lang.String fileType)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.io.File avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.io.InputStream avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.io.InputStream avatar, java.lang.String fileType)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(java.net.URL avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setAvatar​(Icon avatar)
      Queues the avatar of the connected account to get updated.
      AccountUpdater setUsername​(java.lang.String username)
      Queues the username of the connected account to get updated.
      java.util.concurrent.CompletableFuture<java.lang.Void> update()
      Performs the queued updates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AccountUpdater

        public AccountUpdater​(DiscordApi api)
        Creates a new account updater.
        Parameters:
        api - The discord api instance.
    • Method Detail

      • setUsername

        public AccountUpdater setUsername​(java.lang.String username)
        Queues the username of the connected account to get updated.
        Parameters:
        username - The username to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.awt.image.BufferedImage avatar)
        Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.awt.image.BufferedImage avatar,
                                        java.lang.String fileType)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.io.File avatar)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(Icon avatar)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.net.URL avatar)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(byte[] avatar)
        Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(byte[] avatar,
                                        java.lang.String fileType)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.io.InputStream avatar)
        Queues the avatar of the connected account to get updated. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public AccountUpdater setAvatar​(java.io.InputStream avatar,
                                        java.lang.String fileType)
        Queues the avatar of the connected account to get updated.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • update

        public java.util.concurrent.CompletableFuture<java.lang.Void> update()
        Performs the queued updates.
        Returns:
        A future to check if the update was successful.