// Path: chapter13/restclient/src/main/java/org/mule/modules/TranslateException.java
// public class TranslateException extends RuntimeException {
// 
// 	public TranslateException(){
// 	}
// 	
// 	public TranslateException(String reason){
// 	}
// }


import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.mule.api.annotations.Configurable;
import org.mule.api.annotations.Connector;
import org.mule.api.annotations.Processor;
import org.mule.api.annotations.rest.HttpMethod;
import org.mule.api.annotations.rest.RestCall;
import org.mule.api.annotations.rest.RestExceptionOn;
import org.mule.api.annotations.rest.RestHttpClient;
import org.mule.api.annotations.rest.RestUriParam;
import org.mule.modules.TranslateException;
/**
 * This file was automatically generated by the Mule Development Kit
 */
package org.mule.modules;



/**
 * Cloud Connector
 *
 * @author MuleSoft, Inc.
 */
@Connector(name="restclient", schemaVersion="1.0-SNAPSHOT")
public abstract class RestClientConnector
{

//<start id="lis_13_httpclient"/>
@RestHttpClient 
HttpClient client = new HttpClient();
//<end id="lis_13_httpclient"/> 

//<start id="lis_13_restcall"/>
@Processor @RestCall(uri =
	"https://www.googleapis.com/language/translate/v2" +
	"?key={apiKey}&source={sourceLang}&target={destLang}" +
	"&q={text}", 
	method = HttpMethod.GET, 
	contentType ="application/json")
public abstract Object translate(
	@RestUriParam("apiKey") String apiKey,
	@RestUriParam("sourceLang")	String sourceLang,
	@RestUriParam("destLang") String destLang,
	@RestUriParam("text") String text)
	throws IOException;
//<end id="lis_13_restcall"/> 

//<start id="lis_13_configurable-resturi"/>
@RestUriParam("apiKey")
@Configurable
private String apiKey;
//<end id="lis_13_configurable-resturi"/> 

//<start id="lis_13_configurable-resturi-exception"/>
@Processor
@RestCall(uri =
	"https://www.googleapis.com/language/translate/v2" +
	"?key={apiKey}&source={sourceLang}&target={destLang}" +
	"&q={text}", method = HttpMethod.GET, 
	exceptions=
	@RestExceptionOn(
// Path: chapter13/restclient/src/main/java/org/mule/modules/TranslateException.java
// public class TranslateException extends RuntimeException {
// 
// 	public TranslateException(){
// 	}
// 	
// 	public TranslateException(String reason){
// 	}
// }


// Path: chapter13/restclient/src/main/java/org/mule/modules/RestClientConnector.java
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.mule.api.annotations.Configurable;
import org.mule.api.annotations.Connector;
import org.mule.api.annotations.Processor;
import org.mule.api.annotations.rest.HttpMethod;
import org.mule.api.annotations.rest.RestCall;
import org.mule.api.annotations.rest.RestExceptionOn;
import org.mule.api.annotations.rest.RestHttpClient;
import org.mule.api.annotations.rest.RestUriParam;
import org.mule.modules.TranslateException;

/**
 * This file was automatically generated by the Mule Development Kit
 */
package org.mule.modules;



/**
 * Cloud Connector
 *
 * @author MuleSoft, Inc.
 */
@Connector(name="restclient", schemaVersion="1.0-SNAPSHOT")
public abstract class RestClientConnector
{

//<start id="lis_13_httpclient"/>
@RestHttpClient 
HttpClient client = new HttpClient();
//<end id="lis_13_httpclient"/> 

//<start id="lis_13_restcall"/>
@Processor @RestCall(uri =
	"https://www.googleapis.com/language/translate/v2" +
	"?key={apiKey}&source={sourceLang}&target={destLang}" +
	"&q={text}", 
	method = HttpMethod.GET, 
	contentType ="application/json")
public abstract Object translate(
	@RestUriParam("apiKey") String apiKey,
	@RestUriParam("sourceLang")	String sourceLang,
	@RestUriParam("destLang") String destLang,
	@RestUriParam("text") String text)
	throws IOException;
//<end id="lis_13_restcall"/> 

//<start id="lis_13_configurable-resturi"/>
@RestUriParam("apiKey")
@Configurable
private String apiKey;
//<end id="lis_13_configurable-resturi"/> 

//<start id="lis_13_configurable-resturi-exception"/>
@Processor
@RestCall(uri =
	"https://www.googleapis.com/language/translate/v2" +
	"?key={apiKey}&source={sourceLang}&target={destLang}" +
	"&q={text}", method = HttpMethod.GET, 
	exceptions=
	@RestExceptionOn(
		exception = TranslateException.class,