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

com.azure.messaging.eventgrid.systemevents.AcsMessageInteractiveContent Maven / Gradle / Ivy

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.messaging.eventgrid.systemevents;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Message Interactive Content.
 */
@Fluent
public final class AcsMessageInteractiveContent implements JsonSerializable {
    /*
     * The Message interactive reply type
     */
    private AcsInteractiveReplyKind replyKind;

    /*
     * The Message Sent when a customer clicks a button
     */
    private AcsMessageInteractiveButtonReplyContent buttonReply;

    /*
     * The Message Sent when a customer selects an item from a list
     */
    private AcsMessageInteractiveListReplyContent listReply;

    /**
     * Creates an instance of AcsMessageInteractiveContent class.
     */
    public AcsMessageInteractiveContent() {
    }

    /**
     * Get the replyKind property: The Message interactive reply type.
     * 
     * @return the replyKind value.
     */
    public AcsInteractiveReplyKind getReplyKind() {
        return this.replyKind;
    }

    /**
     * Set the replyKind property: The Message interactive reply type.
     * 
     * @param replyKind the replyKind value to set.
     * @return the AcsMessageInteractiveContent object itself.
     */
    public AcsMessageInteractiveContent setReplyKind(AcsInteractiveReplyKind replyKind) {
        this.replyKind = replyKind;
        return this;
    }

    /**
     * Get the buttonReply property: The Message Sent when a customer clicks a button.
     * 
     * @return the buttonReply value.
     */
    public AcsMessageInteractiveButtonReplyContent getButtonReply() {
        return this.buttonReply;
    }

    /**
     * Set the buttonReply property: The Message Sent when a customer clicks a button.
     * 
     * @param buttonReply the buttonReply value to set.
     * @return the AcsMessageInteractiveContent object itself.
     */
    public AcsMessageInteractiveContent setButtonReply(AcsMessageInteractiveButtonReplyContent buttonReply) {
        this.buttonReply = buttonReply;
        return this;
    }

    /**
     * Get the listReply property: The Message Sent when a customer selects an item from a list.
     * 
     * @return the listReply value.
     */
    public AcsMessageInteractiveListReplyContent getListReply() {
        return this.listReply;
    }

    /**
     * Set the listReply property: The Message Sent when a customer selects an item from a list.
     * 
     * @param listReply the listReply value to set.
     * @return the AcsMessageInteractiveContent object itself.
     */
    public AcsMessageInteractiveContent setListReply(AcsMessageInteractiveListReplyContent listReply) {
        this.listReply = listReply;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("type", this.replyKind == null ? null : this.replyKind.toString());
        jsonWriter.writeJsonField("buttonReply", this.buttonReply);
        jsonWriter.writeJsonField("listReply", this.listReply);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AcsMessageInteractiveContent from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AcsMessageInteractiveContent if the JsonReader was pointing to an instance of it, or null
     * if it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the AcsMessageInteractiveContent.
     */
    public static AcsMessageInteractiveContent fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AcsMessageInteractiveContent deserializedAcsMessageInteractiveContent = new AcsMessageInteractiveContent();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("type".equals(fieldName)) {
                    deserializedAcsMessageInteractiveContent.replyKind
                        = AcsInteractiveReplyKind.fromString(reader.getString());
                } else if ("buttonReply".equals(fieldName)) {
                    deserializedAcsMessageInteractiveContent.buttonReply
                        = AcsMessageInteractiveButtonReplyContent.fromJson(reader);
                } else if ("listReply".equals(fieldName)) {
                    deserializedAcsMessageInteractiveContent.listReply
                        = AcsMessageInteractiveListReplyContent.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAcsMessageInteractiveContent;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy