Search in sources :

Example 1 with ListFieldsOptions

use of com.ibm.watson.developer_cloud.discovery.v1.model.ListFieldsOptions in project java-sdk by watson-developer-cloud.

the class Discovery method listFields.

/**
 * List fields in specified collections.
 *
 * 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 response type of {@link ListCollectionFieldsResponse}
 */
public ServiceCall<ListCollectionFieldsResponse> listFields(ListFieldsOptions listFieldsOptions) {
    Validator.notNull(listFieldsOptions, "listFieldsOptions cannot be null");
    String[] pathSegments = { "v1/environments", "fields" };
    String[] pathParameters = { listFieldsOptions.environmentId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    builder.query(VERSION, versionDate);
    builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ","));
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ListCollectionFieldsResponse.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) ListCollectionFieldsResponse(com.ibm.watson.developer_cloud.discovery.v1.model.ListCollectionFieldsResponse)

Aggregations

ListCollectionFieldsResponse (com.ibm.watson.developer_cloud.discovery.v1.model.ListCollectionFieldsResponse)1 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1