Search in sources :

Example 1 with TranslateOptions

use of com.google.cloud.translate.TranslateOptions in project google-cloud-java by GoogleCloudPlatform.

the class RemoteTranslateHelper method create.

/**
   * Creates a {@code RemoteStorageHelper} object.
   */
public static RemoteTranslateHelper create() {
    HttpTransportOptions transportOptions = TranslateOptions.getDefaultHttpTransportOptions();
    transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
    TranslateOptions translateOption = TranslateOptions.newBuilder().setRetrySettings(retryParams()).setTransportOptions(transportOptions).build();
    return new RemoteTranslateHelper(translateOption);
}
Also used : TranslateOptions(com.google.cloud.translate.TranslateOptions) HttpTransportOptions(com.google.cloud.http.HttpTransportOptions)

Example 2 with TranslateOptions

use of com.google.cloud.translate.TranslateOptions in project google-cloud-java by GoogleCloudPlatform.

the class RemoteTranslateHelper method create.

/**
   * Creates a {@code RemoteTranslateHelper} object for the given API key.
   *
   * @param apiKey API key used to issue requests to Google Translation.
   */
public static RemoteTranslateHelper create(String apiKey) {
    HttpTransportOptions transportOptions = TranslateOptions.getDefaultHttpTransportOptions();
    transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
    TranslateOptions translateOptions = TranslateOptions.newBuilder().setApiKey(apiKey).setRetrySettings(retryParams()).setTransportOptions(transportOptions).build();
    return new RemoteTranslateHelper(translateOptions);
}
Also used : TranslateOptions(com.google.cloud.translate.TranslateOptions) HttpTransportOptions(com.google.cloud.http.HttpTransportOptions)

Aggregations

HttpTransportOptions (com.google.cloud.http.HttpTransportOptions)2 TranslateOptions (com.google.cloud.translate.TranslateOptions)2