Skip to content

Commit 4353541

Browse files
authored
Merge pull request #988 from watson-developer-cloud/codegen-updates
Release v6.7.0
2 parents 8a98f26 + 467af69 commit 4353541

File tree

68 files changed

+3424
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3424
-266
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 6.6.0
2+
current_version = 6.7.0
33
commit = True
44
message = docs: Update version numbers from {current_version} -> {new_version}
55

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ before_script:
4141
- 'if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then chmod a+x ./appscan/ASOC.sh; fi'
4242

4343
script:
44-
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_b248e84a4806_key -iv $encrypted_b248e84a4806_iv -in config.properties.enc -out core/src/test/resources/config.properties -d || true'
44+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_42d9c68e608d_key -iv $encrypted_42d9c68e608d_iv -in config.properties.enc -out core/src/test/resources/config.properties -d || true'
4545
- 'if [ "${TRAVIS_TAG}" = "${TRAVIS_BRANCH}" ]; then ./appscan/ASOC.sh; fi'
4646
- ./gradlew install -x check
4747
- ./gradlew checkstyleMain

README.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Java client library to use the [Watson APIs][wdc].
3333
* [Tradeoff Analytics](tradeoff-analytics)
3434
* [Visual Recognition](visual-recognition)
3535
* [Android](#android)
36-
* [Using a proxy](#using-a-proxy)
36+
* [Configuring the HTTP client](#configuring-the-http-client)
3737
* [Default headers](#default-headers)
3838
* [Sending request headers](#sending-request-headers)
3939
* [Parsing HTTP response info](#parsing-http-response-info)
@@ -60,7 +60,7 @@ All the services:
6060
<dependency>
6161
<groupId>com.ibm.watson.developer_cloud</groupId>
6262
<artifactId>java-sdk</artifactId>
63-
<version>6.6.0</version>
63+
<version>6.7.0</version>
6464
</dependency>
6565
```
6666

@@ -70,7 +70,7 @@ Only Discovery:
7070
<dependency>
7171
<groupId>com.ibm.watson.developer_cloud</groupId>
7272
<artifactId>discovery</artifactId>
73-
<version>6.6.0</version>
73+
<version>6.7.0</version>
7474
</dependency>
7575
```
7676

@@ -79,13 +79,13 @@ Only Discovery:
7979
All the services:
8080

8181
```gradle
82-
'com.ibm.watson.developer_cloud:java-sdk:6.6.0'
82+
'com.ibm.watson.developer_cloud:java-sdk:6.7.0'
8383
```
8484

8585
Only Assistant:
8686

8787
```gradle
88-
'com.ibm.watson.developer_cloud:assistant:6.6.0'
88+
'com.ibm.watson.developer_cloud:assistant:6.7.0'
8989
```
9090

9191
##### Development snapshots
@@ -108,7 +108,7 @@ And then reference the snapshot version on your app module gradle
108108
Only Speech to Text:
109109

110110
```gradle
111-
'com.ibm.watson.developer_cloud:speech-to-text:6.6.1-SNAPSHOT'
111+
'com.ibm.watson.developer_cloud:speech-to-text:6.7.1-SNAPSHOT'
112112
```
113113

114114
##### JAR
@@ -228,33 +228,24 @@ service.setApiKey("<api_key>");
228228

229229
The Android SDK utilizes the Java SDK while making some Android-specific additions. This repository can be found [here](https://github.com/watson-developer-cloud/android-sdk). It depends on [OkHttp][] and [gson][].
230230

231-
## Using a proxy
231+
## Configuring the HTTP client
232232

233-
Override the `configureHttpClient()` method and add the proxy using the `OkHttpClient.Builder` object.
233+
The HTTP client can be configured by using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. Currently, the following options are supported:
234+
- Disabling SSL verification (only do this if you really mean to!) ⚠️
235+
- Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564))
234236

235-
For example:
237+
Here's an example of setting both of the above:
236238

237239
```java
238-
Assistant service = new Assistant("2018-02-16") {
239-
@Override
240-
protected OkHttpClient configureHttpClient() {
241-
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080));
242-
return super.configureHttpClient().newBuilder().proxy(proxy).build();
243-
}
244-
};
245-
246-
service.setUsernameAndPassword("<username>", "<password>");
247-
248-
WorkspaceCollection workspaces = service.listWorkspaces().execute();
249-
System.out.println(workspaces);
250-
```
240+
Discovery service = new Discovery("2017-11-07");
251241

252-
For more information see: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564)
242+
// setting configuration options
243+
HttpConfigOptions options = new HttpConfigOptions.Builder()
244+
.disableSslVerification(true)
245+
.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)))
246+
.build();
253247

254-
```java
255-
PersonalityInsights service = new PersonalityInsights("2016-10-19");
256-
String apiKey = CredentialUtils.getAPIKey(service.getName(), CredentialUtils.PLAN_STANDARD);
257-
service.setApiKey(apiKey);
248+
service.configureClient(options);
258249
```
259250

260251
## Sending request headers
@@ -375,7 +366,7 @@ Gradle:
375366

376367
```sh
377368
cd java-sdk
378-
gradle jar # build jar file (build/libs/watson-developer-cloud-6.6.0.jar)
369+
gradle jar # build jar file (build/libs/watson-developer-cloud-6.7.0.jar)
379370
gradle test # run tests
380371
gradle check # performs quality checks on source files and generates reports
381372
gradle testReport # run tests and generate the aggregated test report (build/reports/allTests)
@@ -428,4 +419,4 @@ or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
428419
[ibm-cloud-onboarding]: http://console.bluemix.net/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Java
429420

430421

431-
[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.6.0/java-sdk-6.6.0-jar-with-dependencies.jar
422+
[jar]: https://github.com/watson-developer-cloud/java-sdk/releases/download/java-sdk-6.7.0/java-sdk-6.7.0-jar-with-dependencies.jar

assistant/README.md

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
# Assistant
22

3+
## Assistant v2 is now available :tada::tada::tada:
4+
Check it out in the `assistant/v2` folder.
5+
36
## Installation
47

58
##### Maven
69
```xml
710
<dependency>
811
<groupId>com.ibm.watson.developer_cloud</groupId>
912
<artifactId>assistant</artifactId>
10-
<version>6.6.0</version>
13+
<version>6.7.0</version>
1114
</dependency>
1215
```
1316

1417
##### Gradle
1518
```gradle
16-
'com.ibm.watson.developer_cloud:assistant:6.6.0'
19+
'com.ibm.watson.developer_cloud:assistant:6.7.0'
1720
```
1821

1922
## Usage
20-
2123
Use the [Assistant][assistant] service to identify intents, entities, and conduct conversations.
2224

25+
### Using Assistant v1
2326
```java
27+
// make sure to use the Assistant v1 import!
28+
import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
29+
2430
Assistant service = new Assistant("2018-02-16");
2531
service.setUsernameAndPassword("<username>", "<password>");
2632

@@ -32,9 +38,11 @@ MessageResponse response = service.message(options).execute();
3238
System.out.println(response);
3339
```
3440

35-
Moving from Node 1 to Node 2.
36-
41+
Maintaining context across messages:
3742
```java
43+
// make sure to use the Assistant v1 import!
44+
import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
45+
3846
Context context = null;
3947

4048
// first message
@@ -45,17 +53,77 @@ MessageOptions newMessageOptions = new MessageOptions.Builder()
4553
.build();
4654

4755
MessageResponse response = service.message(newMessageOptions).execute();
56+
context = response.getContext();
4857

4958
// second message
5059
newMessageOptions = new MessageOptions.Builder()
5160
.workspaceId("<workspace-id>")
5261
.input(new InputData.Builder("Second message").build())
53-
.context(response.getContext()) // output context from the first message
62+
.context(context) // using context from the first message
5463
.build();
5564

5665
response = service.message(newMessageOptions).execute();
5766

5867
System.out.println(response);
5968
```
6069

70+
---
71+
72+
### Using Assistant v2
73+
```java
74+
// make sure to use the Assistant v2 import!
75+
import com.ibm.watson.developer_cloud.assistant.v2.Assistant;
76+
77+
Assistant service = new Assistant("2018-09-20");
78+
service.setUsernameAndPassword("<username>", "<password>");
79+
80+
MessageInput input = new MessageInput.Builder()
81+
.text("Hi")
82+
.build();
83+
MessageOptions messageOptions = new MessageOptions.Builder()
84+
.assistantId("<assistant_id>")
85+
.sessionId("<session_id>")
86+
.input(input)
87+
.build();
88+
MessageResponse messageResponse = service.message(messageOptions).execute();
89+
90+
System.out.println(messageResponse);
91+
```
92+
93+
Maintaining context across messages:
94+
```java
95+
// make sure to use the Assistant v2 import!
96+
import com.ibm.watson.developer_cloud.assistant.v2.Assistant;
97+
98+
MessageContext context = new MessageContext();
99+
100+
// first message
101+
MessageInput input = new MessageInput.Builder()
102+
.text("First message")
103+
.build();
104+
MessageOptions messageOptions = new MessageOptions.Builder()
105+
.assistantId(assistantId)
106+
.sessionId(sessionId)
107+
.input(input)
108+
.context(context)
109+
.build();
110+
111+
MessageResponse messageResponse = service.message(messageOptions).execute();
112+
context = messageResponse.getContext();
113+
114+
// second message
115+
input = new MessageInput.Builder()
116+
.text("Second message")
117+
.build();
118+
messageOptions = new MessageOptions.Builder()
119+
.assistantId(assistantId)
120+
.sessionId(sessionId)
121+
.input(input)
122+
.context(context) // using context from first message
123+
.build();
124+
125+
messageResponse = service.message(messageOptions).execute();
126+
127+
System.out.println(messageResponse);
128+
```
61129
[assistant]: https://console.bluemix.net/docs/services/assistant/index.html

assistant/src/main/java/com/ibm/watson/developer_cloud/assistant/v1/model/OutputData.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public class OutputData extends DynamicModel {
3434
}.getType();
3535
private Type nodesVisitedDetailsType = new TypeToken<List<DialogNodeVisitedDetails>>() {
3636
}.getType();
37-
private Type actionsType = new TypeToken<List<DialogNodeAction>>() {
38-
}.getType();
3937

4038
/**
4139
* Gets the logMessages.
@@ -83,15 +81,6 @@ public List<DialogNodeVisitedDetails> getNodesVisitedDetails() {
8381
nodesVisitedDetailsType);
8482
}
8583

86-
/**
87-
* Gets the actions.
88-
*
89-
* @return the actions
90-
*/
91-
public List<DialogNodeAction> getActions() {
92-
return GsonSerializationHelper.serializeDynamicModelProperty(this.get("actions"), actionsType);
93-
}
94-
9584
/**
9685
* Sets the logMessages.
9786
*
@@ -136,13 +125,4 @@ public void setNodesVisited(final List<String> nodesVisited) {
136125
public void setNodesVisitedDetails(final List<DialogNodeVisitedDetails> nodesVisitedDetails) {
137126
this.put("nodes_visited_details", nodesVisitedDetails);
138127
}
139-
140-
/**
141-
* Sets the actions.
142-
*
143-
* @param actions the new actions
144-
*/
145-
public void setActions(final List<DialogNodeAction> actions) {
146-
this.put("actions", actions);
147-
}
148128
}

0 commit comments

Comments
 (0)