com.azure.resourcemanager.botservice.models.LineChannelProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-botservice Show documentation
Show all versions of azure-resourcemanager-botservice Show documentation
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.core.util.logging.ClientLogger;
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 Line channel.
*/
@Fluent
public final class LineChannelProperties implements JsonSerializable {
/*
* The list of line channel registrations
*/
private List lineRegistrations;
/*
* Callback Url to enter in line registration.
*/
private String callbackUrl;
/*
* Whether this channel is validated for the bot
*/
private Boolean isValidated;
/**
* Creates an instance of LineChannelProperties class.
*/
public LineChannelProperties() {
}
/**
* Get the lineRegistrations property: The list of line channel registrations.
*
* @return the lineRegistrations value.
*/
public List lineRegistrations() {
return this.lineRegistrations;
}
/**
* Set the lineRegistrations property: The list of line channel registrations.
*
* @param lineRegistrations the lineRegistrations value to set.
* @return the LineChannelProperties object itself.
*/
public LineChannelProperties withLineRegistrations(List lineRegistrations) {
this.lineRegistrations = lineRegistrations;
return this;
}
/**
* Get the callbackUrl property: Callback Url to enter in line registration.
*
* @return the callbackUrl value.
*/
public String callbackUrl() {
return this.callbackUrl;
}
/**
* Get the isValidated property: Whether this channel is validated for the bot.
*
* @return the isValidated value.
*/
public Boolean isValidated() {
return this.isValidated;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (lineRegistrations() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property lineRegistrations in model LineChannelProperties"));
} else {
lineRegistrations().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(LineChannelProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("lineRegistrations", this.lineRegistrations,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LineChannelProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LineChannelProperties if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the LineChannelProperties.
*/
public static LineChannelProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LineChannelProperties deserializedLineChannelProperties = new LineChannelProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("lineRegistrations".equals(fieldName)) {
List lineRegistrations
= reader.readArray(reader1 -> LineRegistration.fromJson(reader1));
deserializedLineChannelProperties.lineRegistrations = lineRegistrations;
} else if ("callbackUrl".equals(fieldName)) {
deserializedLineChannelProperties.callbackUrl = reader.getString();
} else if ("isValidated".equals(fieldName)) {
deserializedLineChannelProperties.isValidated = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedLineChannelProperties;
});
}
}