LanguageTranslator extends BaseService { public ServiceCall<TranslationModel> createModel(CreateModelOptions createModelOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull( createModelOptions, "createModelOptions cannot be null"); com.ibm.cloud.sdk.core.util.Validator.isTrue( (createModelOptions.forcedGlossary() != null) || (createModelOptions.parallelCorpus() != null), "At least one of forcedGlossary or parallelCorpus must be supplied."); String[] pathSegments = {"v3/models"}; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("language_translator", "v3", "createModel"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); builder.query("base_model_id", createModelOptions.baseModelId()); if (createModelOptions.name() != null) { builder.query("name", createModelOptions.name()); } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (createModelOptions.forcedGlossary() != null) { okhttp3.RequestBody forcedGlossaryBody = RequestUtils.inputStreamBody( createModelOptions.forcedGlossary(), "application/octet-stream"); multipartBuilder.addFormDataPart("forced_glossary", "filename", forcedGlossaryBody); } if (createModelOptions.parallelCorpus() != null) { okhttp3.RequestBody parallelCorpusBody = RequestUtils.inputStreamBody( createModelOptions.parallelCorpus(), "application/octet-stream"); multipartBuilder.addFormDataPart("parallel_corpus", "filename", parallelCorpusBody); } builder.body(multipartBuilder.build()); ResponseConverter<TranslationModel> responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken<TranslationModel>() {}.getType()); return createServiceCall(builder.build(), responseConverter); } LanguageTranslator(String versionDate);  LanguageTranslator(String versionDate, Authenticator authenticator);  LanguageTranslator(String versionDate, String serviceName);  LanguageTranslator(String versionDate, String serviceName, Authenticator authenticator); ServiceCall<Languages> listLanguages(ListLanguagesOptions listLanguagesOptions); ServiceCall<Languages> listLanguages(); ServiceCall<TranslationResult> translate(TranslateOptions translateOptions); ServiceCall<IdentifiableLanguages> listIdentifiableLanguages(
      ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions); ServiceCall<IdentifiableLanguages> listIdentifiableLanguages(); ServiceCall<IdentifiedLanguages> identify(IdentifyOptions identifyOptions); ServiceCall<TranslationModels> listModels(ListModelsOptions listModelsOptions); ServiceCall<TranslationModels> listModels(); ServiceCall<TranslationModel> createModel(CreateModelOptions createModelOptions); ServiceCall<DeleteModelResult> deleteModel(DeleteModelOptions deleteModelOptions); ServiceCall<TranslationModel> getModel(GetModelOptions getModelOptions); ServiceCall<DocumentList> listDocuments(ListDocumentsOptions listDocumentsOptions); ServiceCall<DocumentList> listDocuments(); ServiceCall<DocumentStatus> translateDocument(
      TranslateDocumentOptions translateDocumentOptions); ServiceCall<DocumentStatus> getDocumentStatus(
      GetDocumentStatusOptions getDocumentStatusOptions); ServiceCall<Void> deleteDocument(DeleteDocumentOptions deleteDocumentOptions); ServiceCall<InputStream> getTranslatedDocument(
      GetTranslatedDocumentOptions getTranslatedDocumentOptions);  }
@Test(expected = IllegalArgumentException.class) public void testcreateModelWithBaseModelNull() throws IOException { InputStream glossary = new FileInputStream(new File(RESOURCE + "glossary.tmx")); final CreateModelOptions options = new CreateModelOptions.Builder().forcedGlossary(glossary).build(); service.createModel(options).execute(); }
@Test(expected = IllegalArgumentException.class) public void testcreateModelWithBaseModelIdNull() { service.createModel(new CreateModelOptions.Builder().build()).execute(); }
@Test(expected = IllegalArgumentException.class) public void testcreateModelWithGlossaryNull() { service.createModel(new CreateModelOptions.Builder(modelId).build()).execute(); }