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

com.azure.resourcemanager.botservice.models.TelephonyChannelProperties 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 TelephonyChannelProperties implements JsonSerializable {
    /*
     * The list of Telephony phone numbers
     */
    private List phoneNumbers;

    /*
     * The list of Telephony api configuration
     */
    private List apiConfigurations;

    /*
     * The extensionKey1
     */
    private String cognitiveServiceSubscriptionKey;

    /*
     * The extensionKey2
     */
    private String cognitiveServiceRegion;

    /*
     * The default locale of the channel
     */
    private String defaultLocale;

    /*
     * The premium SKU applied to the channel
     */
    private String premiumSku;

    /*
     * Whether the channel is enabled
     */
    private Boolean isEnabled;

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

    /**
     * Get the phoneNumbers property: The list of Telephony phone numbers.
     * 
     * @return the phoneNumbers value.
     */
    public List phoneNumbers() {
        return this.phoneNumbers;
    }

    /**
     * Set the phoneNumbers property: The list of Telephony phone numbers.
     * 
     * @param phoneNumbers the phoneNumbers value to set.
     * @return the TelephonyChannelProperties object itself.
     */
    public TelephonyChannelProperties withPhoneNumbers(List phoneNumbers) {
        this.phoneNumbers = phoneNumbers;
        return this;
    }

    /**
     * Get the apiConfigurations property: The list of Telephony api configuration.
     * 
     * @return the apiConfigurations value.
     */
    public List apiConfigurations() {
        return this.apiConfigurations;
    }

    /**
     * Set the apiConfigurations property: The list of Telephony api configuration.
     * 
     * @param apiConfigurations the apiConfigurations value to set.
     * @return the TelephonyChannelProperties object itself.
     */
    public TelephonyChannelProperties
        withApiConfigurations(List apiConfigurations) {
        this.apiConfigurations = apiConfigurations;
        return this;
    }

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

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

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

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

    /**
     * Get the defaultLocale property: The default locale of the channel.
     * 
     * @return the defaultLocale value.
     */
    public String defaultLocale() {
        return this.defaultLocale;
    }

    /**
     * Set the defaultLocale property: The default locale of the channel.
     * 
     * @param defaultLocale the defaultLocale value to set.
     * @return the TelephonyChannelProperties object itself.
     */
    public TelephonyChannelProperties withDefaultLocale(String defaultLocale) {
        this.defaultLocale = defaultLocale;
        return this;
    }

    /**
     * Get the premiumSku property: The premium SKU applied to the channel.
     * 
     * @return the premiumSku value.
     */
    public String premiumSku() {
        return this.premiumSku;
    }

    /**
     * Set the premiumSku property: The premium SKU applied to the channel.
     * 
     * @param premiumSku the premiumSku value to set.
     * @return the TelephonyChannelProperties object itself.
     */
    public TelephonyChannelProperties withPremiumSku(String premiumSku) {
        this.premiumSku = premiumSku;
        return this;
    }

    /**
     * Get the isEnabled property: Whether the channel is enabled.
     * 
     * @return the isEnabled value.
     */
    public Boolean isEnabled() {
        return this.isEnabled;
    }

    /**
     * Set the isEnabled property: Whether the channel is enabled.
     * 
     * @param isEnabled the isEnabled value to set.
     * @return the TelephonyChannelProperties object itself.
     */
    public TelephonyChannelProperties withIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("phoneNumbers", this.phoneNumbers, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("apiConfigurations", this.apiConfigurations,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("cognitiveServiceSubscriptionKey", this.cognitiveServiceSubscriptionKey);
        jsonWriter.writeStringField("cognitiveServiceRegion", this.cognitiveServiceRegion);
        jsonWriter.writeStringField("defaultLocale", this.defaultLocale);
        jsonWriter.writeStringField("premiumSKU", this.premiumSku);
        jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
        return jsonWriter.writeEndObject();
    }

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

                if ("phoneNumbers".equals(fieldName)) {
                    List phoneNumbers
                        = reader.readArray(reader1 -> TelephonyPhoneNumbers.fromJson(reader1));
                    deserializedTelephonyChannelProperties.phoneNumbers = phoneNumbers;
                } else if ("apiConfigurations".equals(fieldName)) {
                    List apiConfigurations
                        = reader.readArray(reader1 -> TelephonyChannelResourceApiConfiguration.fromJson(reader1));
                    deserializedTelephonyChannelProperties.apiConfigurations = apiConfigurations;
                } else if ("cognitiveServiceSubscriptionKey".equals(fieldName)) {
                    deserializedTelephonyChannelProperties.cognitiveServiceSubscriptionKey = reader.getString();
                } else if ("cognitiveServiceRegion".equals(fieldName)) {
                    deserializedTelephonyChannelProperties.cognitiveServiceRegion = reader.getString();
                } else if ("defaultLocale".equals(fieldName)) {
                    deserializedTelephonyChannelProperties.defaultLocale = reader.getString();
                } else if ("premiumSKU".equals(fieldName)) {
                    deserializedTelephonyChannelProperties.premiumSku = reader.getString();
                } else if ("isEnabled".equals(fieldName)) {
                    deserializedTelephonyChannelProperties.isEnabled = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTelephonyChannelProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy