com.ibm.g11n.pipeline.client.package-info Maven / Gradle / Ivy
Show all versions of gp-java-client Show documentation
/**
* Provides Java APIs for accessing
* IBM
* Globalization Pipeline's REST endpoints which allow you to create, read, modify
* and delete translation bundles, resource strings and users.
*
* {@link com.ibm.g11n.pipeline.client.ServiceClient ServiceClient} is the class providing methods
* to do CRUD operations on resource maintained by Globalization Pipeline service.
*
* When an application running on Bluemix may use
* {@link com.ibm.g11n.pipeline.client.ServiceClient#getInstance() ServiceClient.getInstance()}
* to create an instance of ServiceClient
initialized with an instance
* of Globalization Pipeline service bound to the application. When an application
* is running out of Bluemix, you may need to create
* {@link com.ibm.g11n.pipeline.client.ServiceAccount ServiceAccount} instance by manually specifying
* service credentials, or set these credentials in environment. variables. For more details,
* please refer {@link com.ibm.g11n.pipeline.client.ServiceAccount ServiceAccount} API documentation.
*
* Below is a coding example creating a new bundle.
*
* // Service URL and credentials
* final String url = "https://gp-rest.ng.bluemix.net/translate/rest";
* final String instanceId = "b3a927cd691f34f89aee6c70cd065e73";
* final String userId = "4ef946c2ab709c595a948cf3dc0c5729";
* final String password = "CtMzbSNEZA20IP6h5ckrGMrTC5g0wYad";
*
* ServiceAccount account = ServiceAccount.getInstance(url, instanceId, userId, password);
* ServiceClient client = ServiceClient.getInstance(account);
*
* // New bundle ID
* final String bundleId = "com.acme.myapp.Messages";
*
* // Creates a new bundle configuration with English ("en") as source language
* NewBundleData newBundleData = new NewBundleData("en");
*
* // Sets target languages
* Set<String> targetLanguages = new HashSet<String>();
* targetLanguages.add("fr"); // Add French
* targetLanguages.add("zh-Hans"); // Add Simplified Chinese
*
* newBundleData.setTargetLanguages(targetLanguages);
*
* try {
* // Creates a new bundle
* client.createBundle(bundleId, newBundleData);
* System.out.println("Bundle: " + bundleId + " was successfully created.");
* } catch (ServiceException e) {
* System.out.println("Failed to create a new bundle" + bundleId + ": " + e.getMessage());
* }
*
*/
package com.ibm.g11n.pipeline.client;