Skip to content

Commit 5181f41

Browse files
committed
feat(Assistant v2): Add generated code from newest version of service
1 parent 483e5d6 commit 5181f41

18 files changed

+72
-84
lines changed

assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import com.ibm.watson.assistant.v2.model.MessageOptions;
2626
import com.ibm.watson.assistant.v2.model.MessageResponse;
2727
import com.ibm.watson.assistant.v2.model.SessionResponse;
28+
import com.ibm.watson.common.SdkCommon;
29+
import java.util.Map;
30+
import java.util.Map.Entry;
2831

2932
/**
3033
* The IBM Watson™ Assistant service combines machine learning, natural language understanding, and integrated
@@ -102,8 +105,11 @@ public ServiceCall<SessionResponse> createSession(CreateSessionOptions createSes
102105
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
103106
pathParameters));
104107
builder.query("version", versionDate);
105-
builder.header("X-IBMCloud-SDK-Analytics",
106-
"service_name=conversation;service_version=v2;operation_id=createSession");
108+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "createSession");
109+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
110+
builder.header(header.getKey(), header.getValue());
111+
}
112+
builder.header("Accept", "application/json");
107113
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SessionResponse.class));
108114
}
109115

@@ -122,8 +128,11 @@ public ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions
122128
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
123129
pathParameters));
124130
builder.query("version", versionDate);
125-
builder.header("X-IBMCloud-SDK-Analytics",
126-
"service_name=conversation;service_version=v2;operation_id=deleteSession");
131+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "deleteSession");
132+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
133+
builder.header(header.getKey(), header.getValue());
134+
}
135+
builder.header("Accept", "application/json");
127136
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
128137
}
129138

@@ -144,7 +153,11 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
144153
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
145154
pathParameters));
146155
builder.query("version", versionDate);
147-
builder.header("X-IBMCloud-SDK-Analytics", "service_name=conversation;service_version=v2;operation_id=message");
156+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "message");
157+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
158+
builder.header(header.getKey(), header.getValue());
159+
}
160+
builder.header("Accept", "application/json");
148161
final JsonObject contentJson = new JsonObject();
149162
if (messageOptions.input() != null) {
150163
contentJson.add("input", GsonSingleton.getGson().toJsonTree(messageOptions.input()));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
*/
1313
package com.ibm.watson.assistant.v2.model;
1414

15-
import com.ibm.cloud.sdk.core.service.model.GenericModel;
16-
1715
import java.util.List;
1816

17+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
18+
1919
/**
2020
* CaptureGroup.
2121
*/

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class Builder {
2929
private String assistantId;
3030

3131
private Builder(CreateSessionOptions createSessionOptions) {
32-
assistantId = createSessionOptions.assistantId;
32+
this.assistantId = createSessionOptions.assistantId;
3333
}
3434

3535
/**
@@ -87,7 +87,7 @@ public Builder newBuilder() {
8787
*
8888
* Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the
8989
* Watson Assistant tool. For information about creating assistants, see the
90-
* [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
90+
* [documentation](https://console.bluemix.net/docs/services/assistant/assistant-add.html#assistant-add-task).
9191
*
9292
* **Note:** Currently, the v2 API does not support creating assistants.
9393
*

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public static class Builder {
3131
private String sessionId;
3232

3333
private Builder(DeleteSessionOptions deleteSessionOptions) {
34-
assistantId = deleteSessionOptions.assistantId;
35-
sessionId = deleteSessionOptions.sessionId;
34+
this.assistantId = deleteSessionOptions.assistantId;
35+
this.sessionId = deleteSessionOptions.sessionId;
3636
}
3737

3838
/**
@@ -105,7 +105,7 @@ public Builder newBuilder() {
105105
*
106106
* Unique identifier of the assistant. You can find the assistant ID of an assistant on the **Assistants** tab of the
107107
* Watson Assistant tool. For information about creating assistants, see the
108-
* [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
108+
* [documentation](https://console.bluemix.net/docs/services/assistant/assistant-add.html#assistant-add-task).
109109
*
110110
* **Note:** Currently, the v2 API does not support creating assistants.
111111
*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
*/
1313
package com.ibm.watson.assistant.v2.model;
1414

15-
import java.util.Map;
16-
1715
import com.google.gson.annotations.SerializedName;
1816
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1917

18+
import java.util.Map;
19+
2020
/**
2121
* DialogNodeAction.
2222
*/
@@ -39,7 +39,7 @@ public interface ActionType {
3939
private String name;
4040
@SerializedName("type")
4141
private String actionType;
42-
private Map parameters;
42+
private Map<String, Object> parameters;
4343
@SerializedName("result_variable")
4444
private String resultVariable;
4545
private String credentials;
@@ -73,7 +73,7 @@ public String getActionType() {
7373
*
7474
* @return the parameters
7575
*/
76-
public Map getParameters() {
76+
public Map<String, Object> getParameters() {
7777
return parameters;
7878
}
7979

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public String getSource() {
131131
/**
132132
* Gets the title.
133133
*
134-
* The title to show before the response.
134+
* The title or introductory text to show before the response.
135135
*
136136
* @return the title
137137
*/

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
*/
1313
package com.ibm.watson.assistant.v2.model;
1414

15-
import java.util.Map;
16-
1715
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1816

17+
import java.util.Map;
18+
1919
/**
2020
* DialogSuggestion.
2121
*/
2222
public class DialogSuggestion extends GenericModel {
2323

2424
private String label;
2525
private DialogSuggestionValue value;
26-
private Map output;
26+
private Map<String, Object> output;
2727

2828
/**
2929
* Gets the label.
@@ -57,7 +57,7 @@ public DialogSuggestionValue getValue() {
5757
*
5858
* @return the output
5959
*/
60-
public Map getOutput() {
60+
public Map<String, Object> getOutput() {
6161
return output;
6262
}
6363
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1616

1717
/**
18-
* State information for the conversation.
18+
* MessageContext.
1919
*/
2020
public class MessageContext extends GenericModel {
2121

@@ -25,7 +25,7 @@ public class MessageContext extends GenericModel {
2525
/**
2626
* Gets the global.
2727
*
28-
* Contains information that can be shared by all skills within the Assistant.
28+
* Information that is shared by all skills used by the Assistant.
2929
*
3030
* @return the global
3131
*/
@@ -36,7 +36,10 @@ public MessageContextGlobal getGlobal() {
3636
/**
3737
* Gets the skills.
3838
*
39-
* Contains information specific to particular skills within the Assistant.
39+
* Information specific to particular skills used by the Assistant.
40+
*
41+
* **Note:** Currently, only a single property named `main skill` is supported. This object contains variables that
42+
* apply to the dialog skill used by the assistant.
4043
*
4144
* @return the skills
4245
*/

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1616

1717
/**
18-
* Contains information that can be shared by all skills within the Assistant.
18+
* Information that is shared by all skills used by the Assistant.
1919
*/
2020
public class MessageContextGlobal extends GenericModel {
2121

@@ -24,7 +24,7 @@ public class MessageContextGlobal extends GenericModel {
2424
/**
2525
* Gets the system.
2626
*
27-
* Properties that are shared by all skills used by the assistant.
27+
* Built-in system properties that apply to all skills used by the assistant.
2828
*
2929
* @return the system
3030
*/

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1717

1818
/**
19-
* Properties that are shared by all skills used by the assistant.
19+
* Built-in system properties that apply to all skills used by the assistant.
2020
*/
2121
public class MessageContextGlobalSystem extends GenericModel {
2222

@@ -55,7 +55,8 @@ public String getUserId() {
5555
* Gets the turnCount.
5656
*
5757
* A counter that is automatically incremented with each turn of the conversation. A value of 1 indicates that this is
58-
* the the first turn of a new conversation, which can affect the behavior of some skills.
58+
* the the first turn of a new conversation, which can affect the behavior of some skills (for example, triggering the
59+
* start node of a dialog).
5960
*
6061
* @return the turnCount
6162
*/

0 commit comments

Comments
 (0)