All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.message.button.ButtonsMessage Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package it.auties.whatsapp.model.message.button;

import com.fasterxml.jackson.annotation.JsonCreator;
import it.auties.protobuf.base.ProtobufMessage;
import it.auties.protobuf.base.ProtobufProperty;
import it.auties.whatsapp.api.Whatsapp;
import it.auties.whatsapp.model.button.base.Button;
import it.auties.whatsapp.model.info.ContextInfo;
import it.auties.whatsapp.model.info.MessageInfo;
import it.auties.whatsapp.model.message.model.ButtonMessage;
import it.auties.whatsapp.model.message.model.ContextualMessage;
import it.auties.whatsapp.model.message.model.MessageType;
import it.auties.whatsapp.model.message.standard.*;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.jackson.Jacksonized;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import static it.auties.protobuf.base.ProtobufType.MESSAGE;
import static it.auties.protobuf.base.ProtobufType.STRING;
import static java.util.Objects.requireNonNullElseGet;

/**
 * A model class that represents a message that contains buttons inside
 */
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@Jacksonized
@Data
@Builder
@Accessors(fluent = true)
public final class ButtonsMessage extends ContextualMessage implements ButtonMessage {
    /**
     * The text attached to this message
     */
    @ProtobufProperty(index = 1, type = STRING)
    private String headerText;

    /**
     * The document message attached to this message
     */
    @ProtobufProperty(index = 2, type = MESSAGE, implementation = DocumentMessage.class)
    private DocumentMessage headerDocument;

    /**
     * The image message attached to this message
     */
    @ProtobufProperty(index = 3, type = MESSAGE, implementation = ImageMessage.class)
    private ImageMessage headerImage;

    /**
     * The video message attached to this message
     */
    @ProtobufProperty(index = 4, type = MESSAGE, implementation = VideoMessage.class)
    private VideoMessage headerVideo;

    /**
     * The location message attached to this message
     */
    @ProtobufProperty(index = 5, type = MESSAGE, implementation = LocationMessage.class)
    private LocationMessage headerLocation;

    /**
     * The body of this message
     */
    @ProtobufProperty(index = 6, type = STRING)
    private String body;

    /**
     * The footer of this message
     */
    @ProtobufProperty(index = 7, type = STRING)
    private String footer;

    /**
     * The context info of this message
     */
    @ProtobufProperty(index = 8, type = MESSAGE, implementation = ContextInfo.class)
    private ContextInfo contextInfo;

    /**
     * The buttons that this message wraps
     */
    @ProtobufProperty(index = 9, type = MESSAGE, implementation = Button.class, repeated = true)
    private List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy