Record Class HighlyStructuredButtonTemplate

java.lang.Object
java.lang.Record
it.auties.whatsapp.model.button.template.hsm.HighlyStructuredButtonTemplate
All Implemented Interfaces:
it.auties.protobuf.model.ProtobufMessage, it.auties.protobuf.model.ProtobufObject

public record HighlyStructuredButtonTemplate(Optional<HighlyStructuredQuickReplyButton> highlyStructuredQuickReplyButton, Optional<HighlyStructuredURLButton> highlyStructuredUrlButton, Optional<HighlyStructuredCallButton> highlyStructuredCallButton, int index) extends Record implements it.auties.protobuf.model.ProtobufMessage
A model class that represents a template for a button
  • Field Details

    • highlyStructuredQuickReplyButton

      private final Optional<HighlyStructuredQuickReplyButton> highlyStructuredQuickReplyButton
      The field for the highlyStructuredQuickReplyButton record component.
    • highlyStructuredUrlButton

      private final Optional<HighlyStructuredURLButton> highlyStructuredUrlButton
      The field for the highlyStructuredUrlButton record component.
    • highlyStructuredCallButton

      private final Optional<HighlyStructuredCallButton> highlyStructuredCallButton
      The field for the highlyStructuredCallButton record component.
    • index

      private final int index
      The field for the index record component.
  • Constructor Details

    • HighlyStructuredButtonTemplate

      public HighlyStructuredButtonTemplate(Optional<HighlyStructuredQuickReplyButton> highlyStructuredQuickReplyButton, Optional<HighlyStructuredURLButton> highlyStructuredUrlButton, Optional<HighlyStructuredCallButton> highlyStructuredCallButton, int index)
      Creates an instance of a HighlyStructuredButtonTemplate record class.
      Parameters:
      highlyStructuredQuickReplyButton - the value for the highlyStructuredQuickReplyButton record component
      highlyStructuredUrlButton - the value for the highlyStructuredUrlButton record component
      highlyStructuredCallButton - the value for the highlyStructuredCallButton record component
      index - the value for the index record component
  • Method Details

    • of

      public static HighlyStructuredButtonTemplate of(HighlyStructuredButton highlyStructuredButton)
      Constructs a new template
      Parameters:
      highlyStructuredButton - the button
      Returns:
      a non-null button template
    • of

      public static HighlyStructuredButtonTemplate of(int index, HighlyStructuredButton highlyStructuredButton)
      Constructs a new template
      Parameters:
      index - the index
      highlyStructuredButton - the button
      Returns:
      a non-null button template
    • button

      public Optional<? extends HighlyStructuredButton> button()
      Returns this button
      Returns:
      a non-null optional
    • buttonType

      public HighlyStructuredButton.Type buttonType()
      Returns the type of button that this message wraps
      Returns:
      a non-null button 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • highlyStructuredQuickReplyButton

      public Optional<HighlyStructuredQuickReplyButton> highlyStructuredQuickReplyButton()
      Returns the value of the highlyStructuredQuickReplyButton record component.
      Returns:
      the value of the highlyStructuredQuickReplyButton record component
    • highlyStructuredUrlButton

      public Optional<HighlyStructuredURLButton> highlyStructuredUrlButton()
      Returns the value of the highlyStructuredUrlButton record component.
      Returns:
      the value of the highlyStructuredUrlButton record component
    • highlyStructuredCallButton

      public Optional<HighlyStructuredCallButton> highlyStructuredCallButton()
      Returns the value of the highlyStructuredCallButton record component.
      Returns:
      the value of the highlyStructuredCallButton record component
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component