SpeechToText extends BaseService { public ServiceCall<Void> addWord(AddWordOptions addWordOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(addWordOptions, "addWordOptions cannot be null"); String[] pathSegments = {"v1/customizations", "words"}; String[] pathParameters = {addWordOptions.customizationId(), addWordOptions.wordName()}; RequestBuilder builder = RequestBuilder.put( RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addWord"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (addWordOptions.word() != null) { contentJson.addProperty("word", addWordOptions.word()); } if (addWordOptions.soundsLike() != null) { contentJson.add( "sounds_like", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() .toJsonTree(addWordOptions.soundsLike())); } if (addWordOptions.displayAs() != null) { contentJson.addProperty("display_as", addWordOptions.displayAs()); } builder.bodyJson(contentJson); ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } SpeechToText();  SpeechToText(Authenticator authenticator);  SpeechToText(String serviceName);  SpeechToText(String serviceName, Authenticator authenticator); ServiceCall<SpeechModels> listModels(ListModelsOptions listModelsOptions); ServiceCall<SpeechModels> listModels(); ServiceCall<SpeechModel> getModel(GetModelOptions getModelOptions); ServiceCall<SpeechRecognitionResults> recognize(RecognizeOptions recognizeOptions); WebSocket recognizeUsingWebSocket(
      RecognizeOptions recognizeOptions, RecognizeCallback callback); ServiceCall<RegisterStatus> registerCallback(
      RegisterCallbackOptions registerCallbackOptions); ServiceCall<Void> unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions); ServiceCall<RecognitionJob> createJob(CreateJobOptions createJobOptions); ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions); ServiceCall<RecognitionJobs> checkJobs(); ServiceCall<RecognitionJob> checkJob(CheckJobOptions checkJobOptions); ServiceCall<Void> deleteJob(DeleteJobOptions deleteJobOptions); ServiceCall<LanguageModel> createLanguageModel(
      CreateLanguageModelOptions createLanguageModelOptions); ServiceCall<LanguageModels> listLanguageModels(
      ListLanguageModelsOptions listLanguageModelsOptions); ServiceCall<LanguageModels> listLanguageModels(); ServiceCall<LanguageModel> getLanguageModel(
      GetLanguageModelOptions getLanguageModelOptions); ServiceCall<Void> deleteLanguageModel(
      DeleteLanguageModelOptions deleteLanguageModelOptions); ServiceCall<TrainingResponse> trainLanguageModel(
      TrainLanguageModelOptions trainLanguageModelOptions); ServiceCall<Void> resetLanguageModel(ResetLanguageModelOptions resetLanguageModelOptions); ServiceCall<Void> upgradeLanguageModel(
      UpgradeLanguageModelOptions upgradeLanguageModelOptions); ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions); ServiceCall<Void> addCorpus(AddCorpusOptions addCorpusOptions); ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions); ServiceCall<Void> deleteCorpus(DeleteCorpusOptions deleteCorpusOptions); ServiceCall<Words> listWords(ListWordsOptions listWordsOptions); ServiceCall<Void> addWords(AddWordsOptions addWordsOptions); ServiceCall<Void> addWord(AddWordOptions addWordOptions); ServiceCall<Word> getWord(GetWordOptions getWordOptions); ServiceCall<Void> deleteWord(DeleteWordOptions deleteWordOptions); ServiceCall<Grammars> listGrammars(ListGrammarsOptions listGrammarsOptions); ServiceCall<Void> addGrammar(AddGrammarOptions addGrammarOptions); ServiceCall<Grammar> getGrammar(GetGrammarOptions getGrammarOptions); ServiceCall<Void> deleteGrammar(DeleteGrammarOptions deleteGrammarOptions); ServiceCall<AcousticModel> createAcousticModel(
      CreateAcousticModelOptions createAcousticModelOptions); ServiceCall<AcousticModels> listAcousticModels(
      ListAcousticModelsOptions listAcousticModelsOptions); ServiceCall<AcousticModels> listAcousticModels(); ServiceCall<AcousticModel> getAcousticModel(
      GetAcousticModelOptions getAcousticModelOptions); ServiceCall<Void> deleteAcousticModel(
      DeleteAcousticModelOptions deleteAcousticModelOptions); ServiceCall<TrainingResponse> trainAcousticModel(
      TrainAcousticModelOptions trainAcousticModelOptions); ServiceCall<Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions); ServiceCall<Void> upgradeAcousticModel(
      UpgradeAcousticModelOptions upgradeAcousticModelOptions); ServiceCall<AudioResources> listAudio(ListAudioOptions listAudioOptions); ServiceCall<Void> addAudio(AddAudioOptions addAudioOptions); ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions); ServiceCall<Void> deleteAudio(DeleteAudioOptions deleteAudioOptions); ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions);  }
@Test public void testAddWord() throws InterruptedException, FileNotFoundException { String id = "foo"; Word newWord = loadFixture("src/test/resources/speech_to_text/word.json", Word.class); server.enqueue( new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody("{}")); AddWordOptions addOptions = new AddWordOptions.Builder() .wordName(newWord.getWord()) .customizationId(id) .word(newWord.getWord()) .displayAs(newWord.getDisplayAs()) .soundsLike(newWord.getSoundsLike()) .build(); service.addWord(addOptions).execute().getResult(); final RecordedRequest request = server.takeRequest(); assertEquals("PUT", request.getMethod()); assertEquals(String.format(PATH_WORD, id, newWord.getWord()), request.getPath()); Gson testGsonNoNulls = new Gson(); assertEquals(testGsonNoNulls.toJson(newWord), request.getBody().readUtf8()); }