Skip to content

Commit 5d7be56

Browse files
feat(wa-v2): add dtmf and end_session response types
1 parent 29d111a commit 5d7be56

File tree

8 files changed

+237
-3
lines changed

8 files changed

+237
-3
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
17+
import java.util.Map;
18+
19+
/** DtmfCommandInfo. */
20+
public class DtmfCommandInfo extends GenericModel {
21+
22+
/** Specifies the type of DTMF command for the phone integration. */
23+
public interface Type {
24+
/** collect. */
25+
String COLLECT = "collect";
26+
/** disable_barge_in. */
27+
String DISABLE_BARGE_IN = "disable_barge_in";
28+
/** enable_barge_in. */
29+
String ENABLE_BARGE_IN = "enable_barge_in";
30+
/** send. */
31+
String SEND = "send";
32+
}
33+
34+
protected String type;
35+
protected Map<String, Object> parameters;
36+
37+
protected DtmfCommandInfo() {}
38+
39+
/**
40+
* Gets the type.
41+
*
42+
* <p>Specifies the type of DTMF command for the phone integration.
43+
*
44+
* @return the type
45+
*/
46+
public String getType() {
47+
return type;
48+
}
49+
50+
/**
51+
* Gets the parameters.
52+
*
53+
* <p>Parameters specified by the command type.
54+
*
55+
* @return the parameters
56+
*/
57+
public Map<String, Object> getParameters() {
58+
return parameters;
59+
}
60+
}

assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2025.
2+
* (C) Copyright IBM Corp. 2019, 2026.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -31,7 +31,9 @@
3131
* RuntimeResponseGenericRuntimeResponseTypeSearch -
3232
* RuntimeResponseGenericRuntimeResponseTypeUserDefined -
3333
* RuntimeResponseGenericRuntimeResponseTypeVideo - RuntimeResponseGenericRuntimeResponseTypeAudio -
34-
* RuntimeResponseGenericRuntimeResponseTypeIframe - RuntimeResponseGenericRuntimeResponseTypeDate
34+
* RuntimeResponseGenericRuntimeResponseTypeIframe - RuntimeResponseGenericRuntimeResponseTypeDate -
35+
* RuntimeResponseGenericRuntimeResponseTypeDtmf -
36+
* RuntimeResponseGenericRuntimeResponseTypeEndSession
3537
*/
3638
public class RuntimeResponseGeneric extends GenericModel {
3739
@SuppressWarnings("unused")
@@ -60,6 +62,9 @@ public class RuntimeResponseGeneric extends GenericModel {
6062
discriminatorMapping.put(
6163
"user_defined", RuntimeResponseGenericRuntimeResponseTypeUserDefined.class);
6264
discriminatorMapping.put("video", RuntimeResponseGenericRuntimeResponseTypeVideo.class);
65+
discriminatorMapping.put("dtmf", RuntimeResponseGenericRuntimeResponseTypeDtmf.class);
66+
discriminatorMapping.put(
67+
"end_session", RuntimeResponseGenericRuntimeResponseTypeEndSession.class);
6368
}
6469
/** The preferred type of control to display. */
6570
public interface Preference {
@@ -134,6 +139,9 @@ public interface Preference {
134139
@SerializedName("image_url")
135140
protected String imageUrl;
136141

142+
@SerializedName("command_info")
143+
protected DtmfCommandInfo commandInfo;
144+
137145
protected RuntimeResponseGeneric() {}
138146

139147
/**
@@ -470,4 +478,13 @@ public Map<String, Object> channelOptions() {
470478
public String imageUrl() {
471479
return imageUrl;
472480
}
481+
482+
/**
483+
* Gets the commandInfo.
484+
*
485+
* @return the commandInfo
486+
*/
487+
public DtmfCommandInfo commandInfo() {
488+
return commandInfo;
489+
}
473490
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
/** RuntimeResponseGenericRuntimeResponseTypeDtmf. */
17+
public class RuntimeResponseGenericRuntimeResponseTypeDtmf extends RuntimeResponseGeneric {
18+
19+
protected RuntimeResponseGenericRuntimeResponseTypeDtmf() {}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
/** RuntimeResponseGenericRuntimeResponseTypeEndSession. */
17+
public class RuntimeResponseGenericRuntimeResponseTypeEndSession extends RuntimeResponseGeneric {
18+
19+
protected RuntimeResponseGenericRuntimeResponseTypeEndSession() {}
20+
}

assistant/src/test/java/com/ibm/watson/assistant/v2/model/CompleteItemTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2024, 2025.
2+
* (C) Copyright IBM Corp. 2024, 2026.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -60,6 +60,7 @@ public void testCompleteItem() throws Throwable {
6060
assertNull(completeItemModel.userDefined());
6161
assertNull(completeItemModel.channelOptions());
6262
assertNull(completeItemModel.imageUrl());
63+
assertNull(completeItemModel.commandInfo());
6364
assertNull(completeItemModel.getStreamingMetadata());
6465
}
6566
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the DtmfCommandInfo model. */
26+
public class DtmfCommandInfoTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testDtmfCommandInfo() throws Throwable {
33+
DtmfCommandInfo dtmfCommandInfoModel = new DtmfCommandInfo();
34+
assertNull(dtmfCommandInfoModel.getType());
35+
assertNull(dtmfCommandInfoModel.getParameters());
36+
}
37+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the RuntimeResponseGenericRuntimeResponseTypeDtmf model. */
26+
public class RuntimeResponseGenericRuntimeResponseTypeDtmfTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testRuntimeResponseGenericRuntimeResponseTypeDtmf() throws Throwable {
33+
RuntimeResponseGenericRuntimeResponseTypeDtmf
34+
runtimeResponseGenericRuntimeResponseTypeDtmfModel =
35+
new RuntimeResponseGenericRuntimeResponseTypeDtmf();
36+
assertNull(runtimeResponseGenericRuntimeResponseTypeDtmfModel.responseType());
37+
assertNull(runtimeResponseGenericRuntimeResponseTypeDtmfModel.commandInfo());
38+
assertNull(runtimeResponseGenericRuntimeResponseTypeDtmfModel.channels());
39+
}
40+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the RuntimeResponseGenericRuntimeResponseTypeEndSession model. */
26+
public class RuntimeResponseGenericRuntimeResponseTypeEndSessionTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testRuntimeResponseGenericRuntimeResponseTypeEndSession() throws Throwable {
33+
RuntimeResponseGenericRuntimeResponseTypeEndSession
34+
runtimeResponseGenericRuntimeResponseTypeEndSessionModel =
35+
new RuntimeResponseGenericRuntimeResponseTypeEndSession();
36+
assertNull(runtimeResponseGenericRuntimeResponseTypeEndSessionModel.responseType());
37+
assertNull(runtimeResponseGenericRuntimeResponseTypeEndSessionModel.channelOptions());
38+
}
39+
}

0 commit comments

Comments
 (0)