Skip to content

Commit

Permalink
feat(assistant-v1): add new DialogNodeOutputGeneric subclasses & addi…
Browse files Browse the repository at this point in the history
…tional properties in workspace
  • Loading branch information
kevinkowa committed Mar 18, 2022
1 parent e627c4e commit dfeacca
Show file tree
Hide file tree
Showing 6 changed files with 677 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2018, 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -27,7 +27,10 @@
* DialogNodeOutputGenericDialogNodeOutputResponseTypeConnectToAgent -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeChannelTransfer -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeUserDefined
* DialogNodeOutputGenericDialogNodeOutputResponseTypeUserDefined -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio -
* DialogNodeOutputGenericDialogNodeOutputResponseTypeIframe
*/
public class DialogNodeOutputGeneric extends GenericModel {
@SuppressWarnings("unused")
Expand All @@ -37,12 +40,16 @@ public class DialogNodeOutputGeneric extends GenericModel {

static {
discriminatorMapping = new java.util.HashMap<>();
discriminatorMapping.put(
"audio", DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.class);
discriminatorMapping.put(
"channel_transfer",
DialogNodeOutputGenericDialogNodeOutputResponseTypeChannelTransfer.class);
discriminatorMapping.put(
"connect_to_agent",
DialogNodeOutputGenericDialogNodeOutputResponseTypeConnectToAgent.class);
discriminatorMapping.put(
"iframe", DialogNodeOutputGenericDialogNodeOutputResponseTypeIframe.class);
discriminatorMapping.put(
"image", DialogNodeOutputGenericDialogNodeOutputResponseTypeImage.class);
discriminatorMapping.put(
Expand All @@ -54,6 +61,8 @@ public class DialogNodeOutputGeneric extends GenericModel {
discriminatorMapping.put("text", DialogNodeOutputGenericDialogNodeOutputResponseTypeText.class);
discriminatorMapping.put(
"user_defined", DialogNodeOutputGenericDialogNodeOutputResponseTypeUserDefined.class);
discriminatorMapping.put(
"video", DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo.class);
}

/** How a response is selected from the list, if more than one response is specified. */
Expand Down Expand Up @@ -129,6 +138,12 @@ public interface QueryType {
@SerializedName("user_defined")
protected Map<String, Object> userDefined;

@SerializedName("channel_options")
protected Map<String, Object> channelOptions;

@SerializedName("image_url")
protected String imageUrl;

protected DialogNodeOutputGeneric() {}

/**
Expand Down Expand Up @@ -384,4 +399,26 @@ public String messageToUser() {
public Map<String, Object> userDefined() {
return userDefined;
}

/**
* Gets the channelOptions.
*
* <p>For internal use only.
*
* @return the channelOptions
*/
public Map<String, Object> channelOptions() {
return channelOptions;
}

/**
* Gets the imageUrl.
*
* <p>The URL of an image that shows a preview of the embedded content.
*
* @return the imageUrl
*/
public String imageUrl() {
return imageUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.ibm.watson.assistant.v1.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/** DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio. */
public class DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio
extends DialogNodeOutputGeneric {

/** Builder. */
public static class Builder {
private String responseType;
private String source;
private String title;
private String description;
private List<ResponseGenericChannel> channels;
private Map<String, Object> channelOptions;
private String altText;

public Builder(
DialogNodeOutputGeneric dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio) {
this.responseType = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.responseType;
this.source = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.source;
this.title = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.title;
this.description = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.description;
this.channels = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.channels;
this.channelOptions = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.channelOptions;
this.altText = dialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.altText;
}

/** Instantiates a new builder. */
public Builder() {}

/**
* Instantiates a new builder with required properties.
*
* @param responseType the responseType
* @param source the source
*/
public Builder(String responseType, String source) {
this.responseType = responseType;
this.source = source;
}

/**
* Builds a DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio.
*
* @return the new DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio instance
*/
public DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio build() {
return new DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio(this);
}

/**
* Adds an channels to channels.
*
* @param channels the new channels
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder addChannels(ResponseGenericChannel channels) {
com.ibm.cloud.sdk.core.util.Validator.notNull(channels, "channels cannot be null");
if (this.channels == null) {
this.channels = new ArrayList<ResponseGenericChannel>();
}
this.channels.add(channels);
return this;
}

/**
* Set the responseType.
*
* @param responseType the responseType
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder responseType(String responseType) {
this.responseType = responseType;
return this;
}

/**
* Set the source.
*
* @param source the source
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder source(String source) {
this.source = source;
return this;
}

/**
* Set the title.
*
* @param title the title
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder title(String title) {
this.title = title;
return this;
}

/**
* Set the description.
*
* @param description the description
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder description(String description) {
this.description = description;
return this;
}

/**
* Set the channels. Existing channels will be replaced.
*
* @param channels the channels
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder channels(List<ResponseGenericChannel> channels) {
this.channels = channels;
return this;
}

/**
* Set the channelOptions.
*
* @param channelOptions the channelOptions
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder channelOptions(Map<String, Object> channelOptions) {
this.channelOptions = channelOptions;
return this;
}

/**
* Set the altText.
*
* @param altText the altText
* @return the DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder altText(String altText) {
this.altText = altText;
return this;
}
}

protected DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio(Builder builder) {
com.ibm.cloud.sdk.core.util.Validator.notNull(
builder.responseType, "responseType cannot be null");
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.source, "source cannot be null");
responseType = builder.responseType;
source = builder.source;
title = builder.title;
description = builder.description;
channels = builder.channels;
channelOptions = builder.channelOptions;
altText = builder.altText;
}

/**
* New builder.
*
* @return a DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio builder
*/
public Builder newBuilder() {
return new Builder(this);
}
}

0 comments on commit dfeacca

Please sign in to comment.