Class Chat.ChatBuilder

java.lang.Object
it.auties.whatsapp.model.chat.Chat.ChatBuilder
Enclosing class:
Chat

public static class Chat.ChatBuilder extends Object
  • Method Details

    • messages

      public Chat.ChatBuilder messages(List<MessageInfo> messages)
    • participants

      public Chat.ChatBuilder participants(List<GroupParticipant> participants)
    • jid

      public Chat.ChatBuilder jid(@NonNull @NonNull ContactJid jid)
      The non-null unique jid used to identify this chat
      Returns:
      this.
    • newJid

      public Chat.ChatBuilder newJid(ContactJid newJid)
      The nullable new unique jid for this Chat. This field is not null when a contact changes phone number and connects their new phone number with Whatsapp.
      Returns:
      this.
    • oldJid

      public Chat.ChatBuilder oldJid(ContactJid oldJid)
      The nullable old jid for this Chat. This field is not null when a contact changes phone number and connects their new phone number with Whatsapp.
      Returns:
      this.
    • timestamp

      public Chat.ChatBuilder timestamp(long timestamp)
      The timestamp for the creation of this chat in seconds since Instant.EPOCH
      Returns:
      this.
    • unreadMessagesCount

      public Chat.ChatBuilder unreadMessagesCount(int unreadMessagesCount)
      The number of unread messages in this chat. If this field is negative, this chat is marked as unread.
      Returns:
      this.
    • readOnly

      public Chat.ChatBuilder readOnly(boolean readOnly)
      Whether this chat is read only
      Returns:
      this.
    • endOfHistoryTransfer

      public Chat.ChatBuilder endOfHistoryTransfer(boolean endOfHistoryTransfer)
      Whether this chat has been trasfered completely
      Returns:
      this.
    • ephemeralMessageDuration

      public Chat.ChatBuilder ephemeralMessageDuration(ChatEphemeralTimer ephemeralMessageDuration)
      The seconds in seconds before a message is automatically deleted from this chat both locally and from WhatsappWeb's servers. If ephemeral messages aren't enabled, this field has a value of 0
      Returns:
      this.
    • ephemeralMessagesToggleTime

      public Chat.ChatBuilder ephemeralMessagesToggleTime(long ephemeralMessagesToggleTime)
      The seconds in seconds since Instant.EPOCH when ephemeral messages were turned on. If ephemeral messages aren't enabled, this field has a value of 0.
      Returns:
      this.
    • endOfHistoryTransferType

      public Chat.ChatBuilder endOfHistoryTransferType(Chat.EndOfHistoryTransferType endOfHistoryTransferType)
      The history sync status
      Returns:
      this.
    • name

      public Chat.ChatBuilder name(String name)
      The non-null display name of this chat
      Returns:
      this.
    • notSpam

      public Chat.ChatBuilder notSpam(boolean notSpam)
      This field is used to determine whether a chat was marked as being spam or not.
      Returns:
      this.
    • archived

      public Chat.ChatBuilder archived(boolean archived)
      This field is used to determine whether a chat is archived or not.
      Returns:
      this.
    • disappearInitiator

      public Chat.ChatBuilder disappearInitiator(ChatDisappear disappearInitiator)
      The initiator of disappearing chats
      Returns:
      this.
    • markedAsUnread

      public Chat.ChatBuilder markedAsUnread(boolean markedAsUnread)
      Whether this chat was manually marked as unread
      Returns:
      this.
    • pastParticipants

      public Chat.ChatBuilder pastParticipants(List<PastParticipant> pastParticipants)
      The participants that used to be in this chat, if it's a group
      Returns:
      this.
    • token

      public Chat.ChatBuilder token(byte[] token)
      The token of this chat
      Returns:
      this.
    • tokenTimestamp

      public Chat.ChatBuilder tokenTimestamp(long tokenTimestamp)
      The timestamp of the token of this chat
      Returns:
      this.
    • identityKey

      public Chat.ChatBuilder identityKey(byte[] identityKey)
      The public identity key of this chat
      Returns:
      this.
    • pinned

      public Chat.ChatBuilder pinned(long pinned)
      The seconds in seconds since Instant.EPOCH when this chat was pinned to the top. If the chat isn't pinned, this field has a value of 0.
      Returns:
      this.
    • mute

      public Chat.ChatBuilder mute(@NonNull @NonNull ChatMute mute)
      The mute status of this chat
      Returns:
      this.
    • wallpaper

      public Chat.ChatBuilder wallpaper(ChatWallpaper wallpaper)
      The wallpaper of this chat
      Returns:
      this.
    • mediaVisibility

      public Chat.ChatBuilder mediaVisibility(@NonNull @NonNull ChatMediaVisibility mediaVisibility)
      The type of this media visibility set for this chat
      Returns:
      this.
    • tokenSenderTimestamp

      public Chat.ChatBuilder tokenSenderTimestamp(long tokenSenderTimestamp)
      The timestamp of the sender of the token of this chat
      Returns:
      this.
    • suspended

      public Chat.ChatBuilder suspended(boolean suspended)
      Whether this chat was suspended and therefore cannot be accessed anymore
      Returns:
      this.
    • terminated

      public Chat.ChatBuilder terminated(boolean terminated)
      Whether this chat was terminated
      Returns:
      this.
    • createdAt

      public Chat.ChatBuilder createdAt(long createdAt)
      The timestamp at which the chat, if a group, was created
      Returns:
      this.
    • createdBy

      public Chat.ChatBuilder createdBy(ContactJid createdBy)
      The user who created this chat, if a group
      Returns:
      this.
    • description

      public Chat.ChatBuilder description(String description)
      The description of this chat, if a group
      Returns:
      this.
    • support

      public Chat.ChatBuilder support(boolean support)
      Whether this chat is an official support chat from Whatsapp
      Returns:
      this.
    • parentGroup

      public Chat.ChatBuilder parentGroup(boolean parentGroup)
      Whether this chat is a parent group
      Returns:
      this.
    • defaultSubGroup

      public Chat.ChatBuilder defaultSubGroup(boolean defaultSubGroup)
      Whether this chat is a default sub group
      Returns:
      this.
    • parentGroupJid

      public Chat.ChatBuilder parentGroupJid(ContactJid parentGroupJid)
      The parent group's jid in a community
      Returns:
      this.
    • displayName

      public Chat.ChatBuilder displayName(String displayName)
      Experimental
      Returns:
      this.
    • pnJid

      public Chat.ChatBuilder pnJid(String pnJid)
      Experimental
      Returns:
      this.
    • shareOwnPn

      public Chat.ChatBuilder shareOwnPn(boolean shareOwnPn)
      Experimental
      Returns:
      this.
    • pnhDuplicateLidThread

      public Chat.ChatBuilder pnhDuplicateLidThread(boolean pnhDuplicateLidThread)
      Experimental
      Returns:
      this.
    • lidJid

      public Chat.ChatBuilder lidJid(ContactJid lidJid)
      Experimental
      Returns:
      this.
    • presences

      public Chat.ChatBuilder presences(@NonNull @NonNull Map<ContactJid,ContactStatus> presences)
      A map that holds the status of each participant, excluding yourself, for this chat. If the chat is not a group, this map's size will range from 0 to 1. Otherwise, it will range from 0 to the number of participants - 1. It is important to remember that is not guaranteed that every participant will be present as a key. In this case, if this chat is a group, it can be safely assumed that the user is not available. Otherwise, it's recommended to use Whatsapp.subscribeToPresence(ContactJidProvider) to force Whatsapp to send updates regarding the status of the other participant. It's also possible to listen for updates to a contact's presence in a group or in a conversation by implementing Listener.onContactPresence(it.auties.whatsapp.api.Whatsapp, it.auties.whatsapp.model.chat.Chat, it.auties.whatsapp.model.contact.Contact, it.auties.whatsapp.model.contact.ContactStatus). The presence that this map indicates might not line up with Contact.lastKnownPresence() if the contact is composing, recording or paused. This is because a contact can be online on Whatsapp and composing, recording or paused in a specific chat.
      Returns:
      this.
    • participantsPreKeys

      public Chat.ChatBuilder participantsPreKeys(@NonNull @NonNull Set<ContactJid> participantsPreKeys)
      A set that hold all the jids of the participants in this chat that have received pre keys. This set is only used if the chat is a group chat. It's not important for anything other than message ciphering.
      Returns:
      this.
    • build

      public Chat build()
    • toString

      public String toString()
      Overrides:
      toString in class Object