Skip to content

Commit bb57cc7

Browse files
committed
chore(Personality Insights): Apply manual changes
1 parent 624277b commit bb57cc7

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
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;
1517
import com.ibm.watson.developer_cloud.http.RequestBuilder;
1618
import com.ibm.watson.developer_cloud.http.ServiceCall;
1719
import com.ibm.watson.developer_cloud.personality_insights.v3.model.Profile;
@@ -135,9 +137,6 @@ public ServiceCall<Profile> profile(ProfileOptions profileOptions) {
135137
if (profileOptions.rawScores() != null) {
136138
builder.query("raw_scores", String.valueOf(profileOptions.rawScores()));
137139
}
138-
if (profileOptions.csvHeaders() != null) {
139-
builder.query("csv_headers", String.valueOf(profileOptions.csvHeaders()));
140-
}
141140
if (profileOptions.consumptionPreferences() != null) {
142141
builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences()));
143142
}
@@ -171,9 +170,10 @@ public ServiceCall<Profile> profile(ProfileOptions profileOptions) {
171170
* profile](https://console.bluemix.net/docs/services/personality-insights/output-csv.html).
172171
*
173172
* @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) {
176+
public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions, boolean includeHeaders) {
177177
Validator.notNull(profileOptions, "profileOptions cannot be null");
178178
String[] pathSegments = { "v3/profile" };
179179
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
@@ -188,9 +188,6 @@ public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions) {
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-
}
194191
if (profileOptions.consumptionPreferences() != null) {
195192
builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences()));
196193
}
@@ -199,6 +196,10 @@ public ServiceCall<InputStream> profileAsCsv(ProfileOptions profileOptions) {
199196
} else {
200197
builder.bodyContent(profileOptions.body(), profileOptions.contentType());
201198
}
199+
200+
builder.header(HttpHeaders.ACCEPT, HttpMediaType.TEXT_CSV);
201+
builder.query("csv_headers", includeHeaders);
202+
202203
return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream());
203204
}
204205

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

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

9998
/**
@@ -106,7 +105,6 @@ public static class Builder {
106105
private String contentLanguage;
107106
private String acceptLanguage;
108107
private Boolean rawScores;
109-
private Boolean csvHeaders;
110108
private Boolean consumptionPreferences;
111109

112110
private Builder(ProfileOptions profileOptions) {
@@ -116,7 +114,6 @@ private Builder(ProfileOptions profileOptions) {
116114
contentLanguage = profileOptions.contentLanguage;
117115
acceptLanguage = profileOptions.acceptLanguage;
118116
rawScores = profileOptions.rawScores;
119-
csvHeaders = profileOptions.csvHeaders;
120117
consumptionPreferences = profileOptions.consumptionPreferences;
121118
}
122119

@@ -168,17 +165,6 @@ public Builder rawScores(Boolean rawScores) {
168165
return this;
169166
}
170167

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-
182168
/**
183169
* Set the consumptionPreferences.
184170
*
@@ -235,7 +221,6 @@ private ProfileOptions(Builder builder) {
235221
contentLanguage = builder.contentLanguage;
236222
acceptLanguage = builder.acceptLanguage;
237223
rawScores = builder.rawScores;
238-
csvHeaders = builder.csvHeaders;
239224
consumptionPreferences = builder.consumptionPreferences;
240225
}
241226

@@ -330,18 +315,6 @@ public Boolean rawScores() {
330315
return rawScores;
331316
}
332317

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-
345318
/**
346319
* Gets the consumptionPreferences.
347320
*

0 commit comments

Comments
 (0)