use of com.ibm.watson.discovery.v1.model.ListEnvironmentsResponse in project java-sdk by watson-developer-cloud.
the class Discovery method listEnvironments.
/**
* List environments.
*
* <p>List existing environments for the service instance.
*
* @param listEnvironmentsOptions the {@link ListEnvironmentsOptions} containing the options for
* the call
* @return a {@link ServiceCall} with a result of type {@link ListEnvironmentsResponse}
*/
public ServiceCall<ListEnvironmentsResponse> listEnvironments(ListEnvironmentsOptions listEnvironmentsOptions) {
if (listEnvironmentsOptions == null) {
listEnvironmentsOptions = new ListEnvironmentsOptions.Builder().build();
}
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listEnvironments");
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));
if (listEnvironmentsOptions.name() != null) {
builder.query("name", String.valueOf(listEnvironmentsOptions.name()));
}
ResponseConverter<ListEnvironmentsResponse> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ListEnvironmentsResponse>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations