use of com.ibm.watson.discovery.v1.model.ListCollectionFieldsResponse in project java-sdk by watson-developer-cloud.
the class Discovery method listFields.
/**
* List fields across collections.
*
* <p>Gets a list of the unique fields (and their types) stored in the indexes of the specified
* collections.
*
* @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link ListCollectionFieldsResponse}
*/
public ServiceCall<ListCollectionFieldsResponse> listFields(ListFieldsOptions listFieldsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(listFieldsOptions, "listFieldsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("environment_id", listFieldsOptions.environmentId());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments/{environment_id}/fields", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listFields");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("version", String.valueOf(this.version));
builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ","));
ResponseConverter<ListCollectionFieldsResponse> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ListCollectionFieldsResponse>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations