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

io.apimatic.examples.CompatibilityFactoryImpl Maven / Gradle / Ivy

The newest version!
/*
 * APIMATICCalculatorLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

package io.apimatic.examples;

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 io.apimatic.examples.http.Headers;
import io.apimatic.examples.http.client.HttpContext;
import io.apimatic.examples.http.request.HttpBodyRequest;
import io.apimatic.examples.http.request.HttpMethod;
import io.apimatic.examples.http.request.HttpRequest;
import io.apimatic.examples.http.response.HttpResponse;
import io.apimatic.examples.http.response.HttpStringResponse;
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 null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy