Search in sources :

Example 6 with ClassifierList

use of com.ibm.watson.natural_language_classifier.v1.model.ClassifierList in project java-sdk by watson-developer-cloud.

the class NaturalLanguageClassifier method listClassifiers.

/**
 * List classifiers.
 *
 * <p>Returns an empty array if no classifiers are available.
 *
 * @param listClassifiersOptions the {@link ListClassifiersOptions} containing the options for the
 *     call
 * @return a {@link ServiceCall} with a result of type {@link ClassifierList}
 */
public ServiceCall<ClassifierList> listClassifiers(ListClassifiersOptions listClassifiersOptions) {
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/classifiers"));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("natural_language_classifier", "v1", "listClassifiers");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    ResponseConverter<ClassifierList> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ClassifierList>() {
    }.getType());
    return createServiceCall(builder.build(), responseConverter);
}
Also used : RequestBuilder(com.ibm.cloud.sdk.core.http.RequestBuilder) ClassifierList(com.ibm.watson.natural_language_classifier.v1.model.ClassifierList)

Aggregations

ClassifierList (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList)3 ClassifierList (com.ibm.watson.natural_language_classifier.v1.model.ClassifierList)3 Test (org.junit.Test)3 ListClassifiersOptions (com.ibm.watson.natural_language_classifier.v1.model.ListClassifiersOptions)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 RequestBuilder (com.ibm.cloud.sdk.core.http.RequestBuilder)1 WatsonServiceTest (com.ibm.watson.common.WatsonServiceTest)1 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)1 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)1 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1 ListClassifiersOptions (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 Test (org.testng.annotations.Test)1