use of com.ibm.watson.discovery.v1.model.MetricResponse in project java-sdk by watson-developer-cloud.
the class Discovery method getMetricsQueryNoResults.
/**
* Number of queries with no search results over time.
*
* <p>Total number of queries using the **natural_language_query** parameter that have no results
* returned over a specified time window.
*
* @param getMetricsQueryNoResultsOptions the {@link GetMetricsQueryNoResultsOptions} containing
* the options for the call
* @return a {@link ServiceCall} with a result of type {@link MetricResponse}
*/
public ServiceCall<MetricResponse> getMetricsQueryNoResults(GetMetricsQueryNoResultsOptions getMetricsQueryNoResultsOptions) {
if (getMetricsQueryNoResultsOptions == null) {
getMetricsQueryNoResultsOptions = new GetMetricsQueryNoResultsOptions.Builder().build();
}
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/metrics/number_of_queries_with_no_search_results"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryNoResults");
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 (getMetricsQueryNoResultsOptions.startTime() != null) {
builder.query("start_time", DateUtils.formatAsDateTime(getMetricsQueryNoResultsOptions.startTime()));
}
if (getMetricsQueryNoResultsOptions.endTime() != null) {
builder.query("end_time", DateUtils.formatAsDateTime(getMetricsQueryNoResultsOptions.endTime()));
}
if (getMetricsQueryNoResultsOptions.resultType() != null) {
builder.query("result_type", String.valueOf(getMetricsQueryNoResultsOptions.resultType()));
}
ResponseConverter<MetricResponse> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<MetricResponse>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations