Skip to content

Commit 624277b

Browse files
committed
chore(Personality Insights): Add generated updates
1 parent c207261 commit 624277b

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
*/
1313
package com.ibm.watson.developer_cloud.personality_insights.v3;
1414

15-
import com.ibm.watson.developer_cloud.http.HttpHeaders;
16-
import com.ibm.watson.developer_cloud.http.HttpMediaType;
1715
import com.ibm.watson.developer_cloud.http.RequestBuilder;
1816
import com.ibm.watson.developer_cloud.http.ServiceCall;
1917
import com.ibm.watson.developer_cloud.personality_insights.v3.model.Profile;
@@ -137,6 +135,9 @@ public ServiceCall<Profile> profile(ProfileOptions profileOptions) {
137135
if (profileOptions.rawScores() != null) {
138136
builder.query("raw_scores", String.valueOf(profileOptions.rawScores()));
139137
}
138+
if (profileOptions.csvHeaders() != null) {
139+
builder.query("csv_headers", String.valueOf(profileOptions.csvHeaders()));
140+
}
140141
if (profileOptions.consumptionPreferences() != null) {
141142
builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences()));
142143
}
@@ -170,10 +171,9 @@ public ServiceCall<Profile> profile(ProfileOptions profileOptions) {
170171
* profile](https://console.bluemix.net/docs/services/personality-insights/output-csv.html).
171172
*
172173
* @param profileOptions the {@link ProfileOptions} containing the options for the call
173-
* @param includeHeaders the boolean saying whether or not to include headers in the response
174174
* @return a {@link ServiceCall} with a response type of {@link InputStream}
175175
*/
176-
public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions, boolean includeHeaders) {
176+
public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions) {
177177
Validator.notNull(profileOptions, "profileOptions cannot be null");
178178
String[] pathSegments = { "v3/profile" };
179179
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
@@ -188,6 +188,9 @@ public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions, bool
188188
if (profileOptions.rawScores() != null) {
189189
builder.query("raw_scores", String.valueOf(profileOptions.rawScores()));
190190
}
191+
if (profileOptions.csvHeaders() != null) {
192+
builder.query("csv_headers", String.valueOf(profileOptions.csvHeaders()));
193+
}
191194
if (profileOptions.consumptionPreferences() != null) {
192195
builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences()));
193196
}
@@ -196,10 +199,6 @@ public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions, bool
196199
} else {
197200
builder.bodyContent(profileOptions.body(), profileOptions.contentType());
198201
}
199-
200-
builder.header(HttpHeaders.ACCEPT, HttpMediaType.TEXT_CSV);
201-
builder.query("csv_headers", includeHeaders);
202-
203202
return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream());
204203
}
205204

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ProfileOptions.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public interface AcceptLanguage {
9393
private String contentLanguage;
9494
private String acceptLanguage;
9595
private Boolean rawScores;
96+
private Boolean csvHeaders;
9697
private Boolean consumptionPreferences;
9798

9899
/**
@@ -105,6 +106,7 @@ public static class Builder {
105106
private String contentLanguage;
106107
private String acceptLanguage;
107108
private Boolean rawScores;
109+
private Boolean csvHeaders;
108110
private Boolean consumptionPreferences;
109111

110112
private Builder(ProfileOptions profileOptions) {
@@ -114,6 +116,7 @@ private Builder(ProfileOptions profileOptions) {
114116
contentLanguage = profileOptions.contentLanguage;
115117
acceptLanguage = profileOptions.acceptLanguage;
116118
rawScores = profileOptions.rawScores;
119+
csvHeaders = profileOptions.csvHeaders;
117120
consumptionPreferences = profileOptions.consumptionPreferences;
118121
}
119122

@@ -165,6 +168,17 @@ public Builder rawScores(Boolean rawScores) {
165168
return this;
166169
}
167170

171+
/**
172+
* Set the csvHeaders.
173+
*
174+
* @param csvHeaders the csvHeaders
175+
* @return the ProfileOptions builder
176+
*/
177+
public Builder csvHeaders(Boolean csvHeaders) {
178+
this.csvHeaders = csvHeaders;
179+
return this;
180+
}
181+
168182
/**
169183
* Set the consumptionPreferences.
170184
*
@@ -221,6 +235,7 @@ private ProfileOptions(Builder builder) {
221235
contentLanguage = builder.contentLanguage;
222236
acceptLanguage = builder.acceptLanguage;
223237
rawScores = builder.rawScores;
238+
csvHeaders = builder.csvHeaders;
224239
consumptionPreferences = builder.consumptionPreferences;
225240
}
226241

@@ -315,6 +330,18 @@ public Boolean rawScores() {
315330
return rawScores;
316331
}
317332

333+
/**
334+
* Gets the csvHeaders.
335+
*
336+
* Indicates whether column labels are returned with a CSV response. By default, no column labels are returned.
337+
* Applies only when the **Accept** parameter is set to `text/csv`.
338+
*
339+
* @return the csvHeaders
340+
*/
341+
public Boolean csvHeaders() {
342+
return csvHeaders;
343+
}
344+
318345
/**
319346
* Gets the consumptionPreferences.
320347
*

0 commit comments

Comments
 (0)