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

com.azure.resourcemanager.botservice.models.DirectLineChannelProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for BotService Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Bot Service is a platform for creating smart conversational agents. Package tag package-2021-03-01.

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.resourcemanager.botservice.models;

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;
import java.util.List;

/**
 * The parameters to provide for the Direct Line channel.
 */
@Fluent
public final class DirectLineChannelProperties implements JsonSerializable {
    /*
     * The list of Direct Line sites
     */
    private List sites;

    /*
     * The extensionKey1
     */
    private String extensionKey1;

    /*
     * The extensionKey2
     */
    private String extensionKey2;

    /*
     * Direct Line embed code of the resource
     */
    private String directLineEmbedCode;

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

    /**
     * Get the sites property: The list of Direct Line sites.
     * 
     * @return the sites value.
     */
    public List sites() {
        return this.sites;
    }

    /**
     * Set the sites property: The list of Direct Line sites.
     * 
     * @param sites the sites value to set.
     * @return the DirectLineChannelProperties object itself.
     */
    public DirectLineChannelProperties withSites(List sites) {
        this.sites = sites;
        return this;
    }

    /**
     * Get the extensionKey1 property: The extensionKey1.
     * 
     * @return the extensionKey1 value.
     */
    public String extensionKey1() {
        return this.extensionKey1;
    }

    /**
     * Set the extensionKey1 property: The extensionKey1.
     * 
     * @param extensionKey1 the extensionKey1 value to set.
     * @return the DirectLineChannelProperties object itself.
     */
    public DirectLineChannelProperties withExtensionKey1(String extensionKey1) {
        this.extensionKey1 = extensionKey1;
        return this;
    }

    /**
     * Get the extensionKey2 property: The extensionKey2.
     * 
     * @return the extensionKey2 value.
     */
    public String extensionKey2() {
        return this.extensionKey2;
    }

    /**
     * Set the extensionKey2 property: The extensionKey2.
     * 
     * @param extensionKey2 the extensionKey2 value to set.
     * @return the DirectLineChannelProperties object itself.
     */
    public DirectLineChannelProperties withExtensionKey2(String extensionKey2) {
        this.extensionKey2 = extensionKey2;
        return this;
    }

    /**
     * Get the directLineEmbedCode property: Direct Line embed code of the resource.
     * 
     * @return the directLineEmbedCode value.
     */
    public String directLineEmbedCode() {
        return this.directLineEmbedCode;
    }

    /**
     * Set the directLineEmbedCode property: Direct Line embed code of the resource.
     * 
     * @param directLineEmbedCode the directLineEmbedCode value to set.
     * @return the DirectLineChannelProperties object itself.
     */
    public DirectLineChannelProperties withDirectLineEmbedCode(String directLineEmbedCode) {
        this.directLineEmbedCode = directLineEmbedCode;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sites() != null) {
            sites().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("sites", this.sites, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("extensionKey1", this.extensionKey1);
        jsonWriter.writeStringField("extensionKey2", this.extensionKey2);
        jsonWriter.writeStringField("DirectLineEmbedCode", this.directLineEmbedCode);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DirectLineChannelProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DirectLineChannelProperties 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 DirectLineChannelProperties.
     */
    public static DirectLineChannelProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DirectLineChannelProperties deserializedDirectLineChannelProperties = new DirectLineChannelProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("sites".equals(fieldName)) {
                    List sites = reader.readArray(reader1 -> DirectLineSite.fromJson(reader1));
                    deserializedDirectLineChannelProperties.sites = sites;
                } else if ("extensionKey1".equals(fieldName)) {
                    deserializedDirectLineChannelProperties.extensionKey1 = reader.getString();
                } else if ("extensionKey2".equals(fieldName)) {
                    deserializedDirectLineChannelProperties.extensionKey2 = reader.getString();
                } else if ("DirectLineEmbedCode".equals(fieldName)) {
                    deserializedDirectLineChannelProperties.directLineEmbedCode = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDirectLineChannelProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy