com.azure.resourcemanager.botservice.models.FacebookChannelProperties 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 Facebook channel.
*/
@Fluent
public final class FacebookChannelProperties implements JsonSerializable {
/*
* Verify token. Value only returned through POST to the action Channel List API, otherwise empty.
*/
private String verifyToken;
/*
* The list of Facebook pages
*/
private List pages;
/*
* Facebook application id
*/
private String appId;
/*
* Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty.
*/
private String appSecret;
/*
* Callback Url
*/
private String callbackUrl;
/*
* Whether this channel is enabled for the bot
*/
private boolean isEnabled;
/**
* Creates an instance of FacebookChannelProperties class.
*/
public FacebookChannelProperties() {
}
/**
* Get the verifyToken property: Verify token. Value only returned through POST to the action Channel List API,
* otherwise empty.
*
* @return the verifyToken value.
*/
public String verifyToken() {
return this.verifyToken;
}
/**
* Get the pages property: The list of Facebook pages.
*
* @return the pages value.
*/
public List pages() {
return this.pages;
}
/**
* Set the pages property: The list of Facebook pages.
*
* @param pages the pages value to set.
* @return the FacebookChannelProperties object itself.
*/
public FacebookChannelProperties withPages(List pages) {
this.pages = pages;
return this;
}
/**
* Get the appId property: Facebook application id.
*
* @return the appId value.
*/
public String appId() {
return this.appId;
}
/**
* Set the appId property: Facebook application id.
*
* @param appId the appId value to set.
* @return the FacebookChannelProperties object itself.
*/
public FacebookChannelProperties withAppId(String appId) {
this.appId = appId;
return this;
}
/**
* Get the appSecret property: Facebook application secret. Value only returned through POST to the action Channel
* List API, otherwise empty.
*
* @return the appSecret value.
*/
public String appSecret() {
return this.appSecret;
}
/**
* Set the appSecret property: Facebook application secret. Value only returned through POST to the action Channel
* List API, otherwise empty.
*
* @param appSecret the appSecret value to set.
* @return the FacebookChannelProperties object itself.
*/
public FacebookChannelProperties withAppSecret(String appSecret) {
this.appSecret = appSecret;
return this;
}
/**
* Get the callbackUrl property: Callback Url.
*
* @return the callbackUrl value.
*/
public String callbackUrl() {
return this.callbackUrl;
}
/**
* Get the isEnabled property: Whether this channel is enabled for the bot.
*
* @return the isEnabled value.
*/
public boolean isEnabled() {
return this.isEnabled;
}
/**
* Set the isEnabled property: Whether this channel is enabled for the bot.
*
* @param isEnabled the isEnabled value to set.
* @return the FacebookChannelProperties object itself.
*/
public FacebookChannelProperties withIsEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (pages() != null) {
pages().forEach(e -> e.validate());
}
if (appId() == null) {
throw LOGGER.atError()
.log(
new IllegalArgumentException("Missing required property appId in model FacebookChannelProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(FacebookChannelProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("appId", this.appId);
jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
jsonWriter.writeArrayField("pages", this.pages, (writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("appSecret", this.appSecret);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of FacebookChannelProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of FacebookChannelProperties 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 FacebookChannelProperties.
*/
public static FacebookChannelProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
FacebookChannelProperties deserializedFacebookChannelProperties = new FacebookChannelProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("appId".equals(fieldName)) {
deserializedFacebookChannelProperties.appId = reader.getString();
} else if ("isEnabled".equals(fieldName)) {
deserializedFacebookChannelProperties.isEnabled = reader.getBoolean();
} else if ("verifyToken".equals(fieldName)) {
deserializedFacebookChannelProperties.verifyToken = reader.getString();
} else if ("pages".equals(fieldName)) {
List pages = reader.readArray(reader1 -> FacebookPage.fromJson(reader1));
deserializedFacebookChannelProperties.pages = pages;
} else if ("appSecret".equals(fieldName)) {
deserializedFacebookChannelProperties.appSecret = reader.getString();
} else if ("callbackUrl".equals(fieldName)) {
deserializedFacebookChannelProperties.callbackUrl = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedFacebookChannelProperties;
});
}
}