Search in sources :

Example 1 with RequestBuilder

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));
}
Also used : VoiceModel(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel) RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) JsonObject(com.google.gson.JsonObject)

Example 2 with RequestBuilder

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));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) Words(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words)

Example 3 with RequestBuilder

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());
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder)

Example 4 with RequestBuilder

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());
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder)

Example 5 with RequestBuilder

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));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) VoiceModels(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModels)

Aggregations

RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)206 JsonObject (com.google.gson.JsonObject)60 MultipartBody (okhttp3.MultipartBody)10 RequestBody (okhttp3.RequestBody)10 Counterexample (com.ibm.watson.developer_cloud.assistant.v1.model.Counterexample)3 DialogNode (com.ibm.watson.developer_cloud.assistant.v1.model.DialogNode)3 Example (com.ibm.watson.developer_cloud.assistant.v1.model.Example)3 Synonym (com.ibm.watson.developer_cloud.assistant.v1.model.Synonym)3 Counterexample (com.ibm.watson.developer_cloud.conversation.v1.model.Counterexample)3 DialogNode (com.ibm.watson.developer_cloud.conversation.v1.model.DialogNode)3 Example (com.ibm.watson.developer_cloud.conversation.v1.model.Example)3 Synonym (com.ibm.watson.developer_cloud.conversation.v1.model.Synonym)3 Collection (com.ibm.watson.developer_cloud.discovery.v1.model.Collection)3 Configuration (com.ibm.watson.developer_cloud.discovery.v1.model.Configuration)3 Environment (com.ibm.watson.developer_cloud.discovery.v1.model.Environment)3 Entity (com.ibm.watson.developer_cloud.assistant.v1.model.Entity)2 Intent (com.ibm.watson.developer_cloud.assistant.v1.model.Intent)2 LogCollection (com.ibm.watson.developer_cloud.assistant.v1.model.LogCollection)2 Value (com.ibm.watson.developer_cloud.assistant.v1.model.Value)2 Workspace (com.ibm.watson.developer_cloud.assistant.v1.model.Workspace)2