private < RequestType extends ConversationsDisplayRequest, ResponseType extends ConversationsDisplayResponse> LoadCallDisplay<RequestType, ResponseType> createCall( Class<ResponseType> responseTypeClass, RequestType request) { String fullUrl = String.format( "%s%s?%s", conversationsBaseUrl, request.getEndPoint(), request.getUrlQueryString()); Logger.d("url", fullUrl); Request okRequest = new Request.Builder() .addHeader("User-Agent", BVSDK.getInstance().getBvsdkUserAgent()) .url(fullUrl) .build(); return new LoadCallDisplay<RequestType, ResponseType>( request, responseTypeClass, okHttpClient.newCall(okRequest)); }
static < RequestType extends ConversationsSubmissionRequest, ResponseType extends ConversationsResponse> LoadCallSubmission<RequestType, ResponseType> loadCallFromSubmission( Class<ResponseType> responseTypeClass, RequestType submission) { String fullUrl = String.format("%s%s", conversationsBaseUrl, submission.getEndPoint()); Log.d("url", fullUrl); String json = submission.getUrlQueryString(); RequestBody body = RequestBody.create(URL_ENCODED, json); Request okRequest = new Request.Builder() .post(body) .addHeader("Content-type", "application/x-www-form-urlencoded") .addHeader("User-Agent", BVSDK.getInstance().getBvsdkUserAgent()) .url(fullUrl) .build(); return new LoadCallSubmission<RequestType, ResponseType>( submission, responseTypeClass, okHttpClient.newCall(okRequest)); }