package com.kaltura.client.utils.request;

import com.kaltura.client.Client;
import com.kaltura.client.Params;
import com.kaltura.client.types.APIException;

public class ServeRequestBuilder extends RequestBuilder<String> {

    public ServeRequestBuilder() {
    	super(String.class);
    }

    public ServeRequestBuilder(String service, String action, Params params) {
        super(String.class, service, action, params);
    }

	@Override
    public String getMethod() {
    	return "GET";
    }

    @Override
    public String getBody() {
        return null;
    }

	@Override
    public RequestElement build(final Client client, boolean addSignature) {
		Params kParams = prepareParams(client, true);
		prepareHeaders(client.getConnectionConfiguration());

		url = client.getConnectionConfiguration().getEndpoint() + "api_v3";
		url += "/service/" + service + "/action/" + action;
		url += "?" + kParams.toQueryString();
		
		return this;
    }
	
	@Override
    protected Object parse(String response) throws APIException {
    	return response;
    }
}















@@ -149,16 +149,62 @@
 ception;
+%0Aimport com.kaltura.client.utils.APIConstants;
 %0A%0Apublic
@@ -804,22 +804,33 @@
 ion());%0A
-%0A
 %09%09
-url
+String endPoint
  = clien
@@ -877,90 +877,302 @@
 nt()
- + %22api_v3%22;%0A%09%09url += %22/service/%22 + service + %22/action/%22 + action;%0A%09%09url += %22?%22 + 
+.replaceAll(%22/$%22, %22%22);%0A        StringBuilder urlBuilder = new StringBuilder(endPoint)%0A        .append(%22/%22)%0A        .append(APIConstants.UrlApiVersion)%0A        .append(%22/service/%22)%0A        .append(service)%0A        .append(%22/action/%22)%0A        .append(action)%0A        .append(%22?%22)%0A        .append(
 kPar
@@ -1190,16 +1190,17 @@
 String()
+)
 ;%0A%09%09%0A%09%09r

support end points without slash