All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.paypal.sdk.CompatibilityFactoryImpl Maven / Gradle / Ivy

/*
 * PaypalServerSDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

package com.paypal.sdk;

import com.paypal.sdk.http.Headers;
import com.paypal.sdk.http.client.HttpContext;
import com.paypal.sdk.http.request.HttpBodyRequest;
import com.paypal.sdk.http.request.HttpMethod;
import com.paypal.sdk.http.request.HttpRequest;
import com.paypal.sdk.http.response.ApiResponse;
import com.paypal.sdk.http.response.HttpResponse;
import com.paypal.sdk.http.response.HttpStringResponse;
import io.apimatic.coreinterfaces.compatibility.CompatibilityFactory;
import io.apimatic.coreinterfaces.http.Context;
import io.apimatic.coreinterfaces.http.HttpHeaders;
import io.apimatic.coreinterfaces.http.Method;
import io.apimatic.coreinterfaces.http.request.Request;
import io.apimatic.coreinterfaces.http.response.ApiResponseType;
import io.apimatic.coreinterfaces.http.response.DynamicType;
import io.apimatic.coreinterfaces.http.response.Response;
import java.io.InputStream;
import java.util.AbstractMap.SimpleEntry;
import java.util.List;
import java.util.Map;

public class CompatibilityFactoryImpl implements CompatibilityFactory {

    @Override
    public Context createHttpContext(Request request, Response response) {
        return new HttpContext((HttpRequest) request, (HttpResponse) response);
    }

    @Override
    public Request createHttpRequest(Method httpMethod,
            StringBuilder queryUrlBuilder, HttpHeaders headers, Map queryParameters,
            List> formParameters) {
        return new HttpRequest(HttpMethod.valueOf(httpMethod.toString()), queryUrlBuilder,
                (Headers) headers, queryParameters, formParameters);
    }

    @Override
    public Request createHttpRequest(Method httpMethod,
            StringBuilder queryUrlBuilder, HttpHeaders headers, Map queryParameters,
            Object body) {
        return new HttpBodyRequest(HttpMethod.valueOf(httpMethod.toString()), queryUrlBuilder,
                (Headers) headers, queryParameters, body);
    }

    @Override
    public Response createHttpResponse(int code, HttpHeaders headers, InputStream rawBody) {
        return new HttpResponse(code, (Headers) headers, rawBody);
    }

    @Override
    public Response createHttpResponse(int code, HttpHeaders headers, InputStream rawBody,
            String body) {
        return new HttpStringResponse(code, (Headers) headers, rawBody, body);
    }

    @Override
    public HttpHeaders createHttpHeaders(Map> headers) {
        return new Headers(headers);
    }

    @Override
    public HttpHeaders createHttpHeaders(HttpHeaders headers) {
        return new Headers((Headers) headers);
    }

    @Override
    public HttpHeaders createHttpHeaders() {
        return new Headers();
    }

    @Override
    public DynamicType createDynamicResponse(Response httpResponse) {
          return null;
    }

    @Override
    public  ApiResponseType createApiResponse(int statusCode, HttpHeaders headers, T result) {
         return new ApiResponse(statusCode, (Headers) headers, result);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy