use of com.ibm.watson.developer_cloud.language_translator.v2.model.TranslationModels in project java-sdk by watson-developer-cloud.
the class LanguageTranslator method listModels.
/**
* List models.
*
* Lists available translation models.
*
* @param listModelsOptions the {@link ListModelsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link TranslationModels}
*/
public ServiceCall<TranslationModels> listModels(ListModelsOptions listModelsOptions) {
String[] pathSegments = { "v2/models" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (listModelsOptions != null) {
if (listModelsOptions.source() != null) {
builder.query("source", listModelsOptions.source());
}
if (listModelsOptions.target() != null) {
builder.query("target", listModelsOptions.target());
}
if (listModelsOptions.defaultModels() != null) {
builder.query("default", String.valueOf(listModelsOptions.defaultModels()));
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TranslationModels.class));
}
Aggregations