use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class TextToSpeech method getVoice.
/**
* Retrieves a specific voice available for speech synthesis.
*
* Lists information about the voice specified with the `voice` path parameter. Specify the `customization_id` query
* parameter to obtain information for that custom voice model of the specified voice. Use the `GET /v1/voices` method
* to see a list of all available voices.
*
* @param getVoiceOptions the {@link GetVoiceOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Voice}
*/
public ServiceCall<Voice> getVoice(GetVoiceOptions getVoiceOptions) {
Validator.notNull(getVoiceOptions, "getVoiceOptions cannot be null");
String[] pathSegments = { "v1/voices" };
String[] pathParameters = { getVoiceOptions.voice() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
if (getVoiceOptions.customizationId() != null) {
builder.query("customization_id", getVoiceOptions.customizationId());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Voice.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method listAudio.
/**
* Lists information about all audio resources for a custom acoustic model.
*
* Lists information about all audio resources from a custom acoustic model. The information includes the name of the
* resource and information about its audio data, such as its duration. It also includes the status of the audio
* resource, which is important for checking the service's analysis of the resource in response to a request to add it
* to the custom acoustic model. You must use credentials for the instance of the service that owns a model to list
* its audio resources.
*
* @param listAudioOptions the {@link ListAudioOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link AudioResources}
*/
public ServiceCall<AudioResources> listAudio(ListAudioOptions listAudioOptions) {
Validator.notNull(listAudioOptions, "listAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { listAudioOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioResources.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method checkJobs.
/**
* Checks the status of all asynchronous jobs.
*
* Returns the ID and status of the latest 100 outstanding jobs associated with the service credentials with which it
* is called. The method also returns the creation and update times of each job, and, if a job was created with a
* callback URL and a user token, the user token for the job. To obtain the results for a job whose status is
* `completed` or not one of the latest 100 outstanding jobs, use the `GET /v1/recognitions/{id}` method. A job and
* its results remain available until you delete them with the `DELETE /v1/recognitions/{id}` method or until the
* job's time to live expires, whichever comes first.
*
* @param checkJobsOptions the {@link CheckJobsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link RecognitionJobs}
*/
public ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions) {
String[] pathSegments = { "v1/recognitions" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (checkJobsOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJobs.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method upgradeLanguageModel.
/**
* Upgrades a custom language model.
*
* Initiates the upgrade of a custom language model to the latest version of its base language model. The upgrade
* method is asynchronous. It can take on the order of minutes to complete depending on the amount of data in the
* custom model and the current load on the service. A custom model must be in the `ready` or `available` state to be
* upgraded. You must use credentials for the instance of the service that owns a model to upgrade it. The method
* returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can monitor the
* status of the upgrade by using the `GET /v1/customizations/{customization_id}` method to poll the model's status.
* Use a loop to check the status every 10 seconds. While it is being upgraded, the custom model has the status
* `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service
* cannot accept subsequent requests for the model until the upgrade completes. For more information, see [Upgrading
* custom models](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html).
*
* @param upgradeLanguageModelOptions the {@link UpgradeLanguageModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> upgradeLanguageModel(UpgradeLanguageModelOptions upgradeLanguageModelOptions) {
Validator.notNull(upgradeLanguageModelOptions, "upgradeLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations", "upgrade_model" };
String[] pathParameters = { upgradeLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(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 SpeechToText method deleteWord.
/**
* Deletes a custom word from a custom language model.
*
* Deletes a custom word from a custom language model. You can remove any word that you added to the custom model's
* words resource via any means. However, if the word also exists in the service's base vocabulary, the service
* removes only the custom pronunciation for the word; the word remains in the base vocabulary. Removing a custom word
* does not affect the custom model until you train the model with the `POST
* /v1/customizations/{customization_id}/train` method. You must use credentials for the instance of the service that
* owns a model to delete its words.
*
* @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.wordName() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
Aggregations