use of com.ibm.watson.developer_cloud.discovery.v1.model.ListCollectionsOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method getCollectionsIsSuccessful.
@Test
public void getCollectionsIsSuccessful() throws InterruptedException {
server.enqueue(jsonResponse(getCollsResp));
ListCollectionsOptions getRequest = new ListCollectionsOptions.Builder(environmentId).build();
ListCollectionsResponse response = discoveryService.listCollections(getRequest).execute();
RecordedRequest request = server.takeRequest();
assertEquals(COLL1_PATH, request.getPath());
assertEquals(GET, request.getMethod());
assertEquals(getCollsResp, response);
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.ListCollectionsOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method listCollectionsIsSuccessful.
// Collections
@Test
public void listCollectionsIsSuccessful() {
createTestCollection();
ListCollectionsOptions listOptions = new ListCollectionsOptions.Builder(environmentId).build();
ListCollectionsResponse listResponse = discovery.listCollections(listOptions).execute();
assertFalse(listResponse.getCollections().isEmpty());
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.ListCollectionsOptions in project java-sdk by watson-developer-cloud.
the class Discovery method listCollections.
/**
* List collections.
*
* Lists existing collections for the service instance.
*
* @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link ListCollectionsResponse}
*/
public ServiceCall<ListCollectionsResponse> listCollections(ListCollectionsOptions listCollectionsOptions) {
Validator.notNull(listCollectionsOptions, "listCollectionsOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections" };
String[] pathParameters = { listCollectionsOptions.environmentId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
if (listCollectionsOptions.name() != null) {
builder.query("name", listCollectionsOptions.name());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ListCollectionsResponse.class));
}
Aggregations