Record Class ButtonsMessage

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.message.button.ButtonsMessage
All Implemented Interfaces:
it.auties.protobuf.model.ProtobufMessage, it.auties.protobuf.model.ProtobufObject, ButtonMessage, ContextualMessage, Message

public record ButtonsMessage(Optional<ButtonsMessageHeaderText> headerText, Optional<DocumentMessage> headerDocument, Optional<ImageMessage> headerImage, Optional<VideoOrGifMessage> headerVideo, Optional<LocationMessage> headerLocation, Optional<String> body, Optional<String> footer, Optional<ContextInfo> contextInfo, List<Button> buttons, ButtonsMessageHeader.Type headerType) extends Record implements ButtonMessage, ContextualMessage
A model class that represents a message that contains buttons inside
  • Field Details

    • headerText

      private final Optional<ButtonsMessageHeaderText> headerText
      The field for the headerText record component.
    • headerDocument

      private final Optional<DocumentMessage> headerDocument
      The field for the headerDocument record component.
    • headerImage

      private final Optional<ImageMessage> headerImage
      The field for the headerImage record component.
    • headerVideo

      private final Optional<VideoOrGifMessage> headerVideo
      The field for the headerVideo record component.
    • headerLocation

      private final Optional<LocationMessage> headerLocation
      The field for the headerLocation record component.
    • body

      private final Optional<String> body
      The field for the body record component.
    • contextInfo

      private final Optional<ContextInfo> contextInfo
      The field for the contextInfo record component.
    • buttons

      private final List<Button> buttons
      The field for the buttons record component.
    • headerType

      private final ButtonsMessageHeader.Type headerType
      The field for the headerType record component.
  • Constructor Details

    • ButtonsMessage

      public ButtonsMessage(Optional<ButtonsMessageHeaderText> headerText, Optional<DocumentMessage> headerDocument, Optional<ImageMessage> headerImage, Optional<VideoOrGifMessage> headerVideo, Optional<LocationMessage> headerLocation, Optional<String> body, Optional<String> footer, Optional<ContextInfo> contextInfo, List<Button> buttons, ButtonsMessageHeader.Type headerType)
      Creates an instance of a ButtonsMessage record class.
      Parameters:
      headerText - the value for the headerText record component
      headerDocument - the value for the headerDocument record component
      headerImage - the value for the headerImage record component
      headerVideo - the value for the headerVideo record component
      headerLocation - the value for the headerLocation record component
      body - the value for the body record component
      footer - the value for the footer record component
      contextInfo - the value for the contextInfo record component
      buttons - the value for the buttons record component
      headerType - the value for the headerType record component
  • Method Details

    • customBuilder

      static ButtonsMessage customBuilder(ButtonsMessageHeader header, String body, String footer, ContextInfo contextInfo, List<Button> buttons)
    • type

      public MessageType type()
      Returns the type of this message
      Specified by:
      type in interface Message
      Returns:
      a non-null type
    • header

      public Optional<? extends ButtonsMessageHeader> header()
      Returns the header of this message
      Returns:
      an optional
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • headerText

      public Optional<ButtonsMessageHeaderText> headerText()
      Returns the value of the headerText record component.
      Returns:
      the value of the headerText record component
    • headerDocument

      public Optional<DocumentMessage> headerDocument()
      Returns the value of the headerDocument record component.
      Returns:
      the value of the headerDocument record component
    • headerImage

      public Optional<ImageMessage> headerImage()
      Returns the value of the headerImage record component.
      Returns:
      the value of the headerImage record component
    • headerVideo

      public Optional<VideoOrGifMessage> headerVideo()
      Returns the value of the headerVideo record component.
      Returns:
      the value of the headerVideo record component
    • headerLocation

      public Optional<LocationMessage> headerLocation()
      Returns the value of the headerLocation record component.
      Returns:
      the value of the headerLocation record component
    • body

      public Optional<String> body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • footer

      public Optional<String> footer()
      Returns the value of the footer record component.
      Returns:
      the value of the footer record component
    • contextInfo

      public Optional<ContextInfo> contextInfo()
      Returns the value of the contextInfo record component.
      Specified by:
      contextInfo in interface ContextualMessage
      Returns:
      the value of the contextInfo record component
    • buttons

      public List<Button> buttons()
      Returns the value of the buttons record component.
      Returns:
      the value of the buttons record component
    • headerType

      public ButtonsMessageHeader.Type headerType()
      Returns the value of the headerType record component.
      Returns:
      the value of the headerType record component