Record Class TemplateMessage

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

public record TemplateMessage(String id, HydratedFourRowTemplate content, Optional<HighlyStructuredFourRowTemplate> highlyStructuredFourRowTemplateFormat, Optional<HydratedFourRowTemplate> hydratedFourRowTemplateFormat, Optional<InteractiveMessage> interactiveMessageFormat, Optional<ContextInfo> contextInfo) extends Record implements ContextualMessage, ButtonMessage
A model class that represents a message sent in a WhatsappBusiness chat that provides a list of buttons to choose from.
  • Field Details

    • id

      private final String id
      The field for the id record component.
    • content

      private final HydratedFourRowTemplate content
      The field for the content record component.
    • highlyStructuredFourRowTemplateFormat

      private final Optional<HighlyStructuredFourRowTemplate> highlyStructuredFourRowTemplateFormat
      The field for the highlyStructuredFourRowTemplateFormat record component.
    • hydratedFourRowTemplateFormat

      private final Optional<HydratedFourRowTemplate> hydratedFourRowTemplateFormat
      The field for the hydratedFourRowTemplateFormat record component.
    • interactiveMessageFormat

      private final Optional<InteractiveMessage> interactiveMessageFormat
      The field for the interactiveMessageFormat record component.
    • contextInfo

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

    • TemplateMessage

      public TemplateMessage(String id, HydratedFourRowTemplate content, Optional<HighlyStructuredFourRowTemplate> highlyStructuredFourRowTemplateFormat, Optional<HydratedFourRowTemplate> hydratedFourRowTemplateFormat, Optional<InteractiveMessage> interactiveMessageFormat, Optional<ContextInfo> contextInfo)
      Creates an instance of a TemplateMessage record class.
      Parameters:
      id - the value for the id record component
      content - the value for the content record component
      highlyStructuredFourRowTemplateFormat - the value for the highlyStructuredFourRowTemplateFormat record component
      hydratedFourRowTemplateFormat - the value for the hydratedFourRowTemplateFormat record component
      interactiveMessageFormat - the value for the interactiveMessageFormat record component
      contextInfo - the value for the contextInfo record component
  • Method Details

    • customBuilder

      static TemplateMessage customBuilder(String id, HydratedFourRowTemplate content, TemplateFormatter format, ContextInfo contextInfo)
    • formatType

      public TemplateFormatter.Type formatType()
      Returns the type of format of this message
      Returns:
      a non-null TemplateFormatter.Type
    • format

      public Optional<? extends TemplateFormatter> format()
      Returns the formatter of this message
      Returns:
      an optional
    • type

      public MessageType type()
      Description copied from interface: Message
      Return message type
      Specified by:
      type in interface Message
      Returns:
      a non-null message type
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • content

      public HydratedFourRowTemplate content()
      Returns the value of the content record component.
      Returns:
      the value of the content record component
    • highlyStructuredFourRowTemplateFormat

      public Optional<HighlyStructuredFourRowTemplate> highlyStructuredFourRowTemplateFormat()
      Returns the value of the highlyStructuredFourRowTemplateFormat record component.
      Returns:
      the value of the highlyStructuredFourRowTemplateFormat record component
    • hydratedFourRowTemplateFormat

      public Optional<HydratedFourRowTemplate> hydratedFourRowTemplateFormat()
      Returns the value of the hydratedFourRowTemplateFormat record component.
      Returns:
      the value of the hydratedFourRowTemplateFormat record component
    • interactiveMessageFormat

      public Optional<InteractiveMessage> interactiveMessageFormat()
      Returns the value of the interactiveMessageFormat record component.
      Returns:
      the value of the interactiveMessageFormat 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