use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method createVoiceModel.
/**
* Creates a new custom voice model.
*
* Creates a new empty custom voice model. The model is owned by the instance of the service whose credentials are
* used to create it. **Note:** This method is currently a beta release.
*
* @param createVoiceModelOptions the {@link CreateVoiceModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link VoiceModel}
*/
public ServiceCall<VoiceModel> createVoiceModel(CreateVoiceModelOptions createVoiceModelOptions) {
Validator.notNull(createVoiceModelOptions, "createVoiceModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createVoiceModelOptions.name());
if (createVoiceModelOptions.language() != null) {
contentJson.addProperty("language", createVoiceModelOptions.language());
}
if (createVoiceModelOptions.description() != null) {
contentJson.addProperty("description", createVoiceModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(VoiceModel.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method listWords.
/**
* Queries details about the words in a custom voice model.
*
* Lists all of the words and their translations for the custom voice model with the specified `customization_id`. The
* output shows the translations as they are defined in the model. You must use credentials for the instance of the
* service that owns a model to query information about its words. **Note:** This method is currently a beta release.
*
* @param listWordsOptions the {@link ListWordsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Words}
*/
public ServiceCall<Words> listWords(ListWordsOptions listWordsOptions) {
Validator.notNull(listWordsOptions, "listWordsOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { listWordsOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Words.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method deleteWord.
/**
* Deletes a word from a custom voice model.
*
* Deletes a single word from the custom voice model with the specified `customization_id`. You must use credentials
* for the instance of the service that owns a model to delete it. **Note:** This method is currently a beta release.
*
* @param deleteWordOptions the {@link DeleteWordOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteWord(DeleteWordOptions deleteWordOptions) {
Validator.notNull(deleteWordOptions, "deleteWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { deleteWordOptions.customizationId(), deleteWordOptions.word() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method deleteVoiceModel.
/**
* Deletes a custom voice model.
*
* Deletes the custom voice model with the specified `customization_id`. You must use credentials for the instance of
* the service that owns a model to delete it. **Note:** This method is currently a beta release.
*
* @param deleteVoiceModelOptions the {@link DeleteVoiceModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteVoiceModel(DeleteVoiceModelOptions deleteVoiceModelOptions) {
Validator.notNull(deleteVoiceModelOptions, "deleteVoiceModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { deleteVoiceModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method listVoiceModels.
/**
* Lists all available custom voice models for a language or for all languages.
*
* Lists metadata such as the name and description for the custom voice models that you own. Use the `language` query
* parameter to list the voice models that you own for the specified language only. Omit the parameter to see all
* voice models that you own for all languages. To see the words in addition to the metadata for a specific voice
* model, use the `GET /v1/customizations/{customization_id}` method. You must use credentials for the instance of the
* service that owns a model to list information about it. **Note:** This method is currently a beta release.
*
* @param listVoiceModelsOptions the {@link ListVoiceModelsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link VoiceModels}
*/
public ServiceCall<VoiceModels> listVoiceModels(ListVoiceModelsOptions listVoiceModelsOptions) {
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (listVoiceModelsOptions != null) {
if (listVoiceModelsOptions.language() != null) {
builder.query("language", listVoiceModelsOptions.language());
}
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(VoiceModels.class));
}
Aggregations