From 519bcf10c20579ab605b15e8240249f25ca3c26d Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 16 Jan 2019 20:30:52 +0800 Subject: [PATCH] [Java] Update okhttp version to the latest (#1897) * update okhttp to latest version * update templates to use okhttp3 * update java samples * fix tests * update tests under CI/samples.ci * add tests to java client * fix bin script to restore test files * fix debugging * add more tests and minor fixes * update samples --- .../okhttp-gson/ApiClientTest.java | 12 +- .../okhttp-gson/api/PetApiTest.java | 358 +++++++++++++++ bin/java-petstore-okhttp-gson.sh | 9 +- .../libraries/okhttp-gson/ApiClient.mustache | 79 ++-- .../GzipRequestInterceptor.mustache | 2 +- .../okhttp-gson/ProgressRequestBody.mustache | 4 +- .../okhttp-gson/ProgressResponseBody.mustache | 8 +- .../Java/libraries/okhttp-gson/api.mustache | 30 +- .../okhttp-gson/auth/HttpBasicAuth.mustache | 2 +- .../auth/OAuthOkHttpClient.mustache | 12 +- .../okhttp-gson/auth/RetryingOAuth.mustache | 12 +- .../okhttp-gson/build.gradle.mustache | 4 +- .../libraries/okhttp-gson/build.sbt.mustache | 4 +- .../Java/libraries/okhttp-gson/pom.mustache | 6 +- .../okhttp-gson-parcelableModel/build.gradle | 4 +- .../okhttp-gson-parcelableModel/build.sbt | 4 +- .../java/okhttp-gson-parcelableModel/pom.xml | 6 +- .../org/openapitools/client/ApiClient.java | 79 ++-- .../client/GzipRequestInterceptor.java | 2 +- .../client/ProgressRequestBody.java | 4 +- .../client/ProgressResponseBody.java | 8 +- .../client/api/AnotherFakeApi.java | 24 +- .../org/openapitools/client/api/FakeApi.java | 292 ++++++------ .../client/api/FakeClassnameTags123Api.java | 24 +- .../org/openapitools/client/api/PetApi.java | 216 ++++----- .../org/openapitools/client/api/StoreApi.java | 96 ++-- .../org/openapitools/client/api/UserApi.java | 192 ++++---- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/OAuthOkHttpClient.java | 10 +- .../client/auth/RetryingOAuth.java | 10 +- .../petstore/java/okhttp-gson/build.gradle | 4 +- .../petstore/java/okhttp-gson/build.sbt | 4 +- .../client/petstore/java/okhttp-gson/pom.xml | 6 +- .../org/openapitools/client/ApiClient.java | 79 ++-- .../client/GzipRequestInterceptor.java | 2 +- .../client/ProgressRequestBody.java | 4 +- .../client/ProgressResponseBody.java | 8 +- .../client/api/AnotherFakeApi.java | 24 +- .../org/openapitools/client/api/FakeApi.java | 292 ++++++------ .../client/api/FakeClassnameTags123Api.java | 24 +- .../org/openapitools/client/api/PetApi.java | 216 ++++----- .../org/openapitools/client/api/StoreApi.java | 96 ++-- .../org/openapitools/client/api/UserApi.java | 192 ++++---- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/OAuthOkHttpClient.java | 10 +- .../client/auth/RetryingOAuth.java | 10 +- .../openapitools/client/ApiClientTest.java | 12 +- .../openapitools/client/api/PetApiTest.java | 420 +++++++++++++----- 48 files changed, 1747 insertions(+), 1173 deletions(-) create mode 100644 CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/api/PetApiTest.java diff --git a/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java index 5167afc326b6..4d8b5d2b38fe 100644 --- a/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java +++ b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java @@ -157,11 +157,11 @@ public void testSetApiKeyAndPrefix() { public void testGetAndSetConnectTimeout() { // connect timeout defaults to 10 seconds assertEquals(10000, apiClient.getConnectTimeout()); - assertEquals(10000, apiClient.getHttpClient().getConnectTimeout()); + assertEquals(10000, apiClient.getHttpClient().connectTimeoutMillis()); apiClient.setConnectTimeout(0); assertEquals(0, apiClient.getConnectTimeout()); - assertEquals(0, apiClient.getHttpClient().getConnectTimeout()); + assertEquals(0, apiClient.getHttpClient().connectTimeoutMillis()); apiClient.setConnectTimeout(10000); } @@ -170,11 +170,11 @@ public void testGetAndSetConnectTimeout() { public void testGetAndSetReadTimeout() { // read timeout defaults to 10 seconds assertEquals(10000, apiClient.getReadTimeout()); - assertEquals(10000, apiClient.getHttpClient().getReadTimeout()); + assertEquals(10000, apiClient.getHttpClient().readTimeoutMillis()); apiClient.setReadTimeout(0); assertEquals(0, apiClient.getReadTimeout()); - assertEquals(0, apiClient.getHttpClient().getReadTimeout()); + assertEquals(0, apiClient.getHttpClient().readTimeoutMillis()); apiClient.setReadTimeout(10000); } @@ -183,11 +183,11 @@ public void testGetAndSetReadTimeout() { public void testGetAndSetWriteTimeout() { // write timeout defaults to 10 seconds assertEquals(10000, apiClient.getWriteTimeout()); - assertEquals(10000, apiClient.getHttpClient().getWriteTimeout()); + assertEquals(10000, apiClient.getHttpClient().writeTimeoutMillis()); apiClient.setWriteTimeout(0); assertEquals(0, apiClient.getWriteTimeout()); - assertEquals(0, apiClient.getHttpClient().getWriteTimeout()); + assertEquals(0, apiClient.getHttpClient().writeTimeoutMillis()); apiClient.setWriteTimeout(10000); } diff --git a/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/api/PetApiTest.java b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/api/PetApiTest.java new file mode 100644 index 000000000000..416b12609e72 --- /dev/null +++ b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/api/PetApiTest.java @@ -0,0 +1,358 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Pet; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.*; + +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; + +import org.junit.*; + +import static org.junit.Assert.*; + +/** + * API tests for PetApi + */ +public class PetApiTest { + + private PetApi api = new PetApi(); + + @Before + public void setup() { + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); + } + + @Test + public void testApiClient() { + // the default api client is used + assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); + + ApiClient oldClient = api.getApiClient(); + + ApiClient newClient = new ApiClient(); + newClient.setBasePath("http://example.com"); + newClient.setDebugging(true); + + // set api client via constructor + api = new PetApi(newClient); + assertNotNull(api.getApiClient()); + assertEquals("http://example.com", api.getApiClient().getBasePath()); + assertTrue(api.getApiClient().isDebugging()); + + // set api client via setter method + api.setApiClient(oldClient); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); + } + + @Test + public void testCreateAndGetPet() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + + @Test + public void testCreateAndGetPetWithHttpInfo() throws Exception { + Pet pet = createPet(); + api.addPetWithHttpInfo(pet); + + ApiResponse resp = api.getPetByIdWithHttpInfo(pet.getId()); + assertEquals(200, resp.getStatusCode()); + assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0)); + Pet fetched = resp.getData(); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + + @Test + public void testCreateAndGetPetAsync() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + // to store returned Pet or error message/exception + final Map result = new HashMap(); + + api.getPetByIdAsync(pet.getId(), new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("error", e.getMessage()); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + // the API call should be executed asynchronously, so result should be empty at the moment + assertTrue(result.isEmpty()); + + // wait for the asynchronous call to finish (at most 10 seconds) + final int maxTry = 10; + int tryCount = 1; + Pet fetched = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("error") != null) fail((String) result.get("error")); + if (result.get("pet") != null) { + fetched = (Pet) result.get("pet"); + break; + } + } while (result.isEmpty()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + + // test getting a nonexistent pet + result.clear(); + api.getPetByIdAsync(-10000L, new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("exception", e); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + + // wait for the asynchronous call to finish (at most 10 seconds) + tryCount = 1; + ApiException exception = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("pet") != null) fail("expected an error"); + if (result.get("exception") != null) { + exception = (ApiException) result.get("exception"); + break; + } + } while (result.isEmpty()); + assertNotNull(exception); + assertEquals(404, exception.getCode()); + assertEquals("Not Found", exception.getMessage()); + assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); + } + + @Test + public void testUpdatePet() throws Exception { + Pet pet = createPet(); + pet.setName("programmer"); + + api.updatePet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + + @Test + public void testFindPetsByStatus() throws Exception { + Pet pet = createPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.PENDING); + + api.updatePet(pet); + + List pets = api.findPetsByStatus(Arrays.asList("pending")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); + + api.deletePet(pet.getId(), null); + } + + @Test + public void testFindPetsByTags() throws Exception { + Pet pet = createPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet); + + List pets = api.findPetsByTags(Arrays.asList("friendly")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + + api.deletePet(pet.getId(), null); + } + + @Test + public void testUpdatePetWithForm() throws Exception { + Pet pet = createPet(); + pet.setName("frank"); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); + } + + @Test + public void testDeletePet() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (ApiException e) { + assertEquals(404, e.getCode()); + } + } + + @Test + public void testUploadFile() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); + } + + @Test + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + + private Pet createPet() { + Pet pet = new Pet(); + pet.setId(1234567L); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2"); + pet.setPhotoUrls(photos); + + return pet; + } + + private String serializeJson(Object o, ApiClient apiClient) { + return apiClient.getJSON().serialize(o); + } + + private T deserializeJson(String json, Type type, ApiClient apiClient) { + return (T) apiClient.getJSON().deserialize(json, type); + } +} diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index 49e97380e413..d8829615f825 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -34,9 +34,9 @@ find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "READM java $JAVA_OPTS -jar $executable $ags # copy additional manually written unit-tests -mkdir samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client -mkdir samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/auth -mkdir samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model +mkdir -p samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client +mkdir -p samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/auth +mkdir -p samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/StringUtilTest.java cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ApiClientTest.java @@ -45,5 +45,6 @@ cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/auth/ApiKeyAuthTes cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/auth/HttpBasicAuthTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/auth/HttpBasicAuthTest.java cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/model/EnumValueTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/EnumValueTest.java cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/model/PetTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/PetTest.java -cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/model/ArrayOfArrayOfNumberOnly.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/model/ArrayOfArrayOfNumberOnlyTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/JSONTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java +cp CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/api/PetApiTest.java samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 14f55484815e..f6f9c774762e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -2,10 +2,10 @@ package {{invokerPackage}}; -import com.squareup.okhttp.*; -import com.squareup.okhttp.internal.http.HttpMethod; -import com.squareup.okhttp.logging.HttpLoggingInterceptor; -import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; {{#joda}} @@ -457,7 +457,7 @@ public class ApiClient { if (debugging) { loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { httpClient.interceptors().remove(loggingInterceptor); loggingInterceptor = null; @@ -496,7 +496,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.getConnectTimeout(); + return httpClient.connectTimeoutMillis(); } /** @@ -508,7 +508,7 @@ public class ApiClient { * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -518,7 +518,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.getReadTimeout(); + return httpClient.readTimeoutMillis(); } /** @@ -530,7 +530,7 @@ public class ApiClient { * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -540,7 +540,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.getWriteTimeout(); + return httpClient.writeTimeoutMillis(); } /** @@ -552,13 +552,14 @@ public class ApiClient { * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); return this; } {{#hasOAuthMethods}} /** * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * * @return Token request builder */ public TokenRequestBuilder getTokenEndPoint() { @@ -693,8 +694,8 @@ public class ApiClient { * @return True if the given MIME is JSON, false otherwise. */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } /** @@ -867,8 +868,8 @@ public class ApiClient { * Prepare file for download * * @param response An instance of the Response object - * @throws IOException If fail to prepare file for download * @return Prepared file for the download + * @throws IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -911,8 +912,8 @@ public class ApiClient { * * @param Type * @param call An instance of the Call object - * @throws ApiException If fail to execute the call * @return ApiResponse<T> + * @throws ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -953,22 +954,22 @@ public class ApiClient { /** * Execute HTTP call asynchronously. * - * @see #execute(Call, Type) * @param Type * @param call The callback to be executed when the API call finishes * @param returnType Return type * @param callback ApiCallback + * @see #execute(Call, Type) */ @SuppressWarnings("unchecked") public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { call.enqueue(new Callback() { @Override - public void onFailure(Request request, IOException e) { + public void onFailure(Call call, IOException e) { callback.onFailure(new ApiException(e), 0, null); } @Override - public void onResponse(Response response) throws IOException { + public void onResponse(Call call, Response response) throws IOException { T result; try { result = (T) handleResponse(response, returnType); @@ -987,9 +988,9 @@ public class ApiClient { * @param Type * @param response Response * @param returnType Return type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -999,7 +1000,7 @@ public class ApiClient { if (response.body() != null) { try { response.body().close(); - } catch (IOException e) { + } catch (Exception e) { throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); } } @@ -1090,7 +1091,7 @@ public class ApiClient { Request request = null; - if(progressRequestListener != null && reqBody != null) { + if (progressRequestListener != null && reqBody != null) { ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { @@ -1190,7 +1191,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1205,7 +1206,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); @@ -1244,16 +1245,23 @@ public class ApiClient { TrustManager[] trustManagers = null; HostnameVerifier hostnameVerifier = null; if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { @@ -1281,11 +1289,12 @@ public class ApiClient { if (keyManagers != null || trustManagers != null) { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + httpClient = httpClient.newBuilder().sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]).build(); } else { - httpClient.setSslSocketFactory(null); + httpClient = httpClient.newBuilder().sslSocketFactory(null, (X509TrustManager) trustManagers[0]).build(); } - httpClient.setHostnameVerifier(hostnameVerifier); + + httpClient = httpClient.newBuilder().hostnameVerifier(hostnameVerifier).build(); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache index 61a5b7b0ba20..b633aa8f5864 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache @@ -2,7 +2,7 @@ package {{invokerPackage}}; -import com.squareup.okhttp.*; +import okhttp3.*; import okio.Buffer; import okio.BufferedSink; import okio.GzipSink; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache index 0f15c1f415d2..d9ceeab12ab3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -2,8 +2,8 @@ package {{invokerPackage}}; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.RequestBody; +import okhttp3.MediaType; +import okhttp3.RequestBody; import java.io.IOException; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache index 3f53133697cd..34713eca1185 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -2,8 +2,8 @@ package {{invokerPackage}}; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.ResponseBody; +import okhttp3.MediaType; +import okhttp3.ResponseBody; import java.io.IOException; @@ -34,12 +34,12 @@ public class ProgressResponseBody extends ResponseBody { } @Override - public long contentLength() throws IOException { + public long contentLength() { return responseBody.contentLength(); } @Override - public BufferedSource source() throws IOException { + public BufferedSource source() { if (bufferedSource == null) { bufferedSource = Okio.buffer(source(responseBody.source())); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 16384f1fd396..3f60a15b45fe 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -81,7 +81,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; // create path and map variables @@ -125,15 +125,15 @@ public class {{classname}} { {{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] {{localVariablePrefix}}localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; @@ -144,7 +144,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { {{^performBeanValidation}} {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -153,7 +153,7 @@ public class {{classname}} { } {{/required}}{{/allParams}} - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); return {{localVariablePrefix}}call; {{/performBeanValidation}} @@ -168,7 +168,7 @@ public class {{classname}} { parameterValues); if (violations.size() == 0) { - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); return {{localVariablePrefix}}call; } else { @@ -227,7 +227,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null, null); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null, null); {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} } @@ -250,7 +250,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} com.squareup.okhttp.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -271,7 +271,7 @@ public class {{classname}} { }; } - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); {{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType, {{localVariablePrefix}}callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}callback);{{/returnType}} return {{localVariablePrefix}}call; @@ -317,7 +317,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { return {{operationId}}Call({{#allParams}}{{localVariablePrefix}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); } @@ -364,7 +364,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public com.squareup.okhttp.Call executeAsync(final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> callback) throws ApiException { + public okhttp3.Call executeAsync(final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> callback) throws ApiException { return {{operationId}}Async({{#allParams}}{{localVariablePrefix}}{{paramName}}, {{/allParams}}callback); } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache index 320903b03193..6356e227a1e8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache @@ -4,7 +4,7 @@ package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; -import com.squareup.okhttp.Credentials; +import okhttp3.Credentials; import java.util.Map; import java.util.List; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache index 5460132cdb17..46b2021c9589 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache @@ -1,11 +1,11 @@ {{#hasOAuthMethods}} package {{invokerPackage}}.auth; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; +import okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; import org.apache.oltu.oauth2.client.HttpClient; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; @@ -67,4 +67,4 @@ public class OAuthOkHttpClient implements HttpClient { // Nothing to do here } } -{{/hasOAuthMethods}} \ No newline at end of file +{{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache index 5cf6fe7e2947..d3f6d90abba3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache @@ -3,10 +3,10 @@ package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; @@ -99,7 +99,7 @@ public class RetryingOAuth extends OAuth implements Interceptor { String requestAccessToken = getAccessToken(); try { oAuthRequest = - new OAuthBearerClientRequest(request.urlString()). + new OAuthBearerClientRequest(request.url().toString()). setAccessToken(requestAccessToken). buildHeaderMessage(); } catch (OAuthSystemException e) { @@ -173,4 +173,4 @@ public class RetryingOAuth extends OAuth implements Interceptor { // No implementation necessary } } -{{/hasOAuthMethods}} \ No newline at end of file +{{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 11919997d615..d4e2dc5f62e6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -120,8 +120,8 @@ if(hasProperty('target') && target == 'android') { dependencies { compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp:okhttp:2.7.5' - compile 'com.squareup.okhttp:logging-interceptor:2.7.5' + compile 'com.squareup.okhttp3:okhttp:3.12.1' + compile 'com.squareup.okhttp3:logging-interceptor:3.12.1' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.0' {{#hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache index 921e4cc875a5..d3c8cd235325 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache @@ -10,8 +10,8 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp" % "okhttp" % "2.7.5", - "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", + "com.squareup.okhttp3" % "okhttp" % "3.12.1", + "com.squareup.okhttp3" % "logging-interceptor" % "3.12.1", "com.google.code.gson" % "gson" % "2.8.5", "org.apache.commons" % "commons-lang3" % "3.8.1", {{#hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index ab8f6b2183d0..0cbdeb29fd80 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -201,12 +201,12 @@ ${swagger-core-version} - com.squareup.okhttp + com.squareup.okhttp3 okhttp ${okhttp-version} - com.squareup.okhttp + com.squareup.okhttp3 logging-interceptor ${okhttp-version} @@ -291,7 +291,7 @@ ${java.version} 1.8.0 1.5.21 - 2.7.5 + 3.12.1 2.8.5 3.8.1 {{#joda}} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 564a89eb4ec6..98aa5a6c249b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -96,8 +96,8 @@ if(hasProperty('target') && target == 'android') { dependencies { compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp:okhttp:2.7.5' - compile 'com.squareup.okhttp:logging-interceptor:2.7.5' + compile 'com.squareup.okhttp3:okhttp:3.12.1' + compile 'com.squareup.okhttp3:logging-interceptor:3.12.1' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.0' compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt index ae3f36687a92..85adca160ba5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt @@ -10,8 +10,8 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp" % "okhttp" % "2.7.5", - "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", + "com.squareup.okhttp3" % "okhttp" % "3.12.1", + "com.squareup.okhttp3" % "logging-interceptor" % "3.12.1", "com.google.code.gson" % "gson" % "2.8.5", "org.apache.commons" % "commons-lang3" % "3.8.1", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index af2cafd6ab5c..5cecd69f7e39 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -194,12 +194,12 @@ ${swagger-core-version} - com.squareup.okhttp + com.squareup.okhttp3 okhttp ${okhttp-version} - com.squareup.okhttp + com.squareup.okhttp3 logging-interceptor ${okhttp-version} @@ -249,7 +249,7 @@ ${java.version} 1.8.0 1.5.21 - 2.7.5 + 3.12.1 2.8.5 3.8.1 1.3.5 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index cd72483a1326..970b2a690c70 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -13,10 +13,10 @@ package org.openapitools.client; -import com.squareup.okhttp.*; -import com.squareup.okhttp.internal.http.HttpMethod; -import com.squareup.okhttp.logging.HttpLoggingInterceptor; -import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; import org.threeten.bp.LocalDate; @@ -425,7 +425,7 @@ public ApiClient setDebugging(boolean debugging) { if (debugging) { loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { httpClient.interceptors().remove(loggingInterceptor); loggingInterceptor = null; @@ -464,7 +464,7 @@ public ApiClient setTempFolderPath(String tempFolderPath) { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.getConnectTimeout(); + return httpClient.connectTimeoutMillis(); } /** @@ -476,7 +476,7 @@ public int getConnectTimeout() { * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -486,7 +486,7 @@ public ApiClient setConnectTimeout(int connectionTimeout) { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.getReadTimeout(); + return httpClient.readTimeoutMillis(); } /** @@ -498,7 +498,7 @@ public int getReadTimeout() { * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -508,7 +508,7 @@ public ApiClient setReadTimeout(int readTimeout) { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.getWriteTimeout(); + return httpClient.writeTimeoutMillis(); } /** @@ -520,12 +520,13 @@ public int getWriteTimeout() { * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); return this; } /** * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * * @return Token request builder */ public TokenRequestBuilder getTokenEndPoint() { @@ -659,8 +660,8 @@ public String sanitizeFilename(String filename) { * @return True if the given MIME is JSON, false otherwise. */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } /** @@ -833,8 +834,8 @@ public File downloadFileFromResponse(Response response) throws ApiException { * Prepare file for download * * @param response An instance of the Response object - * @throws IOException If fail to prepare file for download * @return Prepared file for the download + * @throws IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -877,8 +878,8 @@ public File prepareDownloadFile(Response response) throws IOException { * * @param Type * @param call An instance of the Call object - * @throws ApiException If fail to execute the call * @return ApiResponse<T> + * @throws ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -919,22 +920,22 @@ public void executeAsync(Call call, ApiCallback callback) { /** * Execute HTTP call asynchronously. * - * @see #execute(Call, Type) * @param Type * @param call The callback to be executed when the API call finishes * @param returnType Return type * @param callback ApiCallback + * @see #execute(Call, Type) */ @SuppressWarnings("unchecked") public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { call.enqueue(new Callback() { @Override - public void onFailure(Request request, IOException e) { + public void onFailure(Call call, IOException e) { callback.onFailure(new ApiException(e), 0, null); } @Override - public void onResponse(Response response) throws IOException { + public void onResponse(Call call, Response response) throws IOException { T result; try { result = (T) handleResponse(response, returnType); @@ -953,9 +954,9 @@ public void onResponse(Response response) throws IOException { * @param Type * @param response Response * @param returnType Return type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -965,7 +966,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept if (response.body() != null) { try { response.body().close(); - } catch (IOException e) { + } catch (Exception e) { throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); } } @@ -1056,7 +1057,7 @@ public Request buildRequest(String path, String method, List queryParams, Request request = null; - if(progressRequestListener != null && reqBody != null) { + if (progressRequestListener != null && reqBody != null) { ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { @@ -1156,7 +1157,7 @@ public void updateParamsForAuth(String[] authNames, List queryParams, Map< * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1171,7 +1172,7 @@ public RequestBody buildRequestBodyFormEncoding(Map formParams) * @return RequestBody */ public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); @@ -1210,16 +1211,23 @@ private void applySslSettings() { TrustManager[] trustManagers = null; HostnameVerifier hostnameVerifier = null; if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { @@ -1247,11 +1255,12 @@ public boolean verify(String hostname, SSLSession session) { if (keyManagers != null || trustManagers != null) { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + httpClient = httpClient.newBuilder().sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]).build(); } else { - httpClient.setSslSocketFactory(null); + httpClient = httpClient.newBuilder().sslSocketFactory(null, (X509TrustManager) trustManagers[0]).build(); } - httpClient.setHostnameVerifier(hostnameVerifier); + + httpClient = httpClient.newBuilder().hostnameVerifier(hostnameVerifier).build(); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java index f7ecf09b39ed..8805d31cdbd6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -13,7 +13,7 @@ package org.openapitools.client; -import com.squareup.okhttp.*; +import okhttp3.*; import okio.Buffer; import okio.BufferedSink; import okio.GzipSink; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java index ebba06851d04..f33edde76b87 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -13,8 +13,8 @@ package org.openapitools.client; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.RequestBody; +import okhttp3.MediaType; +import okhttp3.RequestBody; import java.io.IOException; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java index c01bab3b2a2c..258e48eceb49 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -13,8 +13,8 @@ package org.openapitools.client; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.ResponseBody; +import okhttp3.MediaType; +import okhttp3.ResponseBody; import java.io.IOException; @@ -45,12 +45,12 @@ public MediaType contentType() { } @Override - public long contentLength() throws IOException { + public long contentLength() { return responseBody.contentLength(); } @Override - public BufferedSource source() throws IOException { + public BufferedSource source() { if (bufferedSource == null) { bufferedSource = Okio.buffer(source(responseBody.source())); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 1d97d7a5787f..d02dc58bf2d8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call call123testSpecialTagsCall(Client body, final Pr localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call call123testSpecialTagsValidateBeforeCall(Client } - com.squareup.okhttp.Call call = call123testSpecialTagsCall(body, progressListener, progressRequestListener); + okhttp3.Call call = call123testSpecialTagsCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public Client call123testSpecialTags(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = call123testSpecialTagsValidateBeforeCall(body, null, null); + okhttp3.Call call = call123testSpecialTagsValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -149,7 +149,7 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throw * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call call123testSpecialTagsAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call call123testSpecialTagsAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -170,7 +170,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = call123testSpecialTagsValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = call123testSpecialTagsValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java index 5801aa71922d..5e3521d91d7c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java @@ -69,7 +69,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -94,15 +94,15 @@ public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, fina localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -110,10 +110,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -138,7 +138,7 @@ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -151,7 +151,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -172,7 +172,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -185,7 +185,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -210,15 +210,15 @@ public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -226,10 +226,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -254,7 +254,7 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -267,7 +267,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(Outer * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -288,7 +288,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -301,7 +301,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -326,15 +326,15 @@ public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, fi localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -342,10 +342,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -370,7 +370,7 @@ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -383,7 +383,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal b * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -404,7 +404,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -442,15 +442,15 @@ public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -458,10 +458,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -486,7 +486,7 @@ public String fakeOuterStringSerialize(String body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -499,7 +499,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -520,7 +520,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -533,7 +533,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testBodyWithFileSchemaCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testBodyWithFileSchemaCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -558,15 +558,15 @@ public com.squareup.okhttp.Call testBodyWithFileSchemaCall(FileSchemaTestClass b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -574,7 +574,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testBodyWithFileSchemaValidateBeforeCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -582,7 +582,7 @@ private com.squareup.okhttp.Call testBodyWithFileSchemaValidateBeforeCall(FileSc } - com.squareup.okhttp.Call call = testBodyWithFileSchemaCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithFileSchemaCall(body, progressListener, progressRequestListener); return call; } @@ -605,7 +605,7 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { - com.squareup.okhttp.Call call = testBodyWithFileSchemaValidateBeforeCall(body, null, null); + okhttp3.Call call = testBodyWithFileSchemaValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -617,7 +617,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testBodyWithFileSchemaAsync(FileSchemaTestClass body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testBodyWithFileSchemaAsync(FileSchemaTestClass body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -638,7 +638,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testBodyWithFileSchemaValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithFileSchemaValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -651,7 +651,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testBodyWithQueryParamsCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testBodyWithQueryParamsCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -680,15 +680,15 @@ public com.squareup.okhttp.Call testBodyWithQueryParamsCall(String query, User b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -696,7 +696,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'query' is set if (query == null) { @@ -709,7 +709,7 @@ private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(Strin } - com.squareup.okhttp.Call call = testBodyWithQueryParamsCall(query, body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithQueryParamsCall(query, body, progressListener, progressRequestListener); return call; } @@ -734,7 +734,7 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { - com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, null, null); + okhttp3.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, null, null); return apiClient.execute(call); } @@ -747,7 +747,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testBodyWithQueryParamsAsync(String query, User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testBodyWithQueryParamsAsync(String query, User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -768,7 +768,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -780,7 +780,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testClientModelCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testClientModelCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -805,15 +805,15 @@ public com.squareup.okhttp.Call testClientModelCall(Client body, final ProgressR localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -821,7 +821,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testClientModelValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testClientModelValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -829,7 +829,7 @@ private com.squareup.okhttp.Call testClientModelValidateBeforeCall(Client body, } - com.squareup.okhttp.Call call = testClientModelCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClientModelCall(body, progressListener, progressRequestListener); return call; } @@ -854,7 +854,7 @@ public Client testClientModel(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = testClientModelValidateBeforeCall(body, null, null); + okhttp3.Call call = testClientModelValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -867,7 +867,7 @@ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testClientModelAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testClientModelAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -888,7 +888,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testClientModelValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClientModelValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -914,7 +914,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -995,15 +995,15 @@ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Do localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "http_basic_test" }; @@ -1011,7 +1011,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testEndpointParametersValidateBeforeCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testEndpointParametersValidateBeforeCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'number' is set if (number == null) { @@ -1034,7 +1034,7 @@ private com.squareup.okhttp.Call testEndpointParametersValidateBeforeCall(BigDec } - com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); + okhttp3.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); return call; } @@ -1083,7 +1083,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - com.squareup.okhttp.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, null); + okhttp3.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, null); return apiClient.execute(call); } @@ -1108,7 +1108,7 @@ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, D * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ApiCallback callback) throws ApiException { + public okhttp3.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1129,7 +1129,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); + okhttp3.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1148,7 +1148,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1205,15 +1205,15 @@ public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderSt localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1221,10 +1221,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testEnumParametersValidateBeforeCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testEnumParametersValidateBeforeCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); + okhttp3.Call call = testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); return call; } @@ -1261,7 +1261,7 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - com.squareup.okhttp.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null, null); + okhttp3.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null, null); return apiClient.execute(call); } @@ -1280,7 +1280,7 @@ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderS * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testEnumParametersAsync(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback callback) throws ApiException { + public okhttp3.Call testEnumParametersAsync(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1301,11 +1301,11 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); + okhttp3.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } - private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1354,15 +1354,15 @@ private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringG localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1370,7 +1370,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testGroupParametersValidateBeforeCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testGroupParametersValidateBeforeCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { @@ -1388,18 +1388,18 @@ private com.squareup.okhttp.Call testGroupParametersValidateBeforeCall(Integer r } - com.squareup.okhttp.Call call = testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); + okhttp3.Call call = testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); return call; } private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { - com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null); + okhttp3.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null); return apiClient.execute(call); } - private com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback callback) throws ApiException { + private okhttp3.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1420,7 +1420,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); + okhttp3.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1476,7 +1476,7 @@ public APItestGroupParametersRequest int64Group(Long int64Group) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); } @@ -1503,7 +1503,7 @@ public ApiResponse executeWithHttpInfo() throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call executeAsync(final ApiCallback callback) throws ApiException { + public okhttp3.Call executeAsync(final ApiCallback callback) throws ApiException { return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, callback); } } @@ -1527,7 +1527,7 @@ public APItestGroupParametersRequest testGroupParameters(Integer requiredStringG * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = param; // create path and map variables @@ -1552,15 +1552,15 @@ public com.squareup.okhttp.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'param' is set if (param == null) { @@ -1576,7 +1576,7 @@ private com.squareup.okhttp.Call testInlineAdditionalPropertiesValidateBeforeCal } - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesCall(param, progressListener, progressRequestListener); + okhttp3.Call call = testInlineAdditionalPropertiesCall(param, progressListener, progressRequestListener); return call; } @@ -1599,7 +1599,7 @@ public void testInlineAdditionalProperties(Map param) throws Api * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, null, null); + okhttp3.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, null, null); return apiClient.execute(call); } @@ -1611,7 +1611,7 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param, final ApiCallback callback) throws ApiException { + public okhttp3.Call testInlineAdditionalPropertiesAsync(Map param, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1632,7 +1632,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, progressListener, progressRequestListener); + okhttp3.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1645,7 +1645,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1678,15 +1678,15 @@ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2 localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1694,7 +1694,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'param' is set if (param == null) { @@ -1707,7 +1707,7 @@ private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param } - com.squareup.okhttp.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener); + okhttp3.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener); return call; } @@ -1732,7 +1732,7 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null); + okhttp3.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null); return apiClient.execute(call); } @@ -1745,7 +1745,7 @@ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testJsonFormDataAsync(String param, String param2, final ApiCallback callback) throws ApiException { + public okhttp3.Call testJsonFormDataAsync(String param, String param2, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1766,7 +1766,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener); + okhttp3.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 9fe1f2fabf68..787906d9861b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressRes localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key_query" }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, fi } - com.squareup.okhttp.Call call = testClassnameCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClassnameCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public Client testClassname(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, null, null); + okhttp3.Call call = testClassnameValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -149,7 +149,7 @@ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiExce * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -170,7 +170,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java index 4368d7b34e5c..aacd1af92b88 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,7 +64,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -89,15 +89,15 @@ public com.squareup.okhttp.Call addPetCall(Pet body, final ProgressResponseBody. localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -105,7 +105,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -113,7 +113,7 @@ private com.squareup.okhttp.Call addPetValidateBeforeCall(Pet body, final Progre } - com.squareup.okhttp.Call call = addPetCall(body, progressListener, progressRequestListener); + okhttp3.Call call = addPetCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public void addPet(Pet body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - com.squareup.okhttp.Call call = addPetValidateBeforeCall(body, null, null); + okhttp3.Call call = addPetValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -148,7 +148,7 @@ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { + public okhttp3.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -169,7 +169,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = addPetValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = addPetValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -182,7 +182,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -212,15 +212,15 @@ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final P localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -228,7 +228,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -236,7 +236,7 @@ private com.squareup.okhttp.Call deletePetValidateBeforeCall(Long petId, String } - com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); + okhttp3.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); return call; } @@ -261,7 +261,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - com.squareup.okhttp.Call call = deletePetValidateBeforeCall(petId, apiKey, null, null); + okhttp3.Call call = deletePetValidateBeforeCall(petId, apiKey, null, null); return apiClient.execute(call); } @@ -274,7 +274,7 @@ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { + public okhttp3.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deletePetValidateBeforeCall(petId, apiKey, progressListener, progressRequestListener); + okhttp3.Call call = deletePetValidateBeforeCall(petId, apiKey, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -307,7 +307,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -336,15 +336,15 @@ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -352,7 +352,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call findPetsByStatusValidateBeforeCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call findPetsByStatusValidateBeforeCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'status' is set if (status == null) { @@ -360,7 +360,7 @@ private com.squareup.okhttp.Call findPetsByStatusValidateBeforeCall(List } - com.squareup.okhttp.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); return call; } @@ -385,7 +385,7 @@ public List findPetsByStatus(List status) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - com.squareup.okhttp.Call call = findPetsByStatusValidateBeforeCall(status, null, null); + okhttp3.Call call = findPetsByStatusValidateBeforeCall(status, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -398,7 +398,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { + public okhttp3.Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -419,7 +419,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = findPetsByStatusValidateBeforeCall(status, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByStatusValidateBeforeCall(status, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @deprecated */ @Deprecated - public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -463,15 +463,15 @@ public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final Prog localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -480,7 +480,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch @Deprecated @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call findPetsByTagsValidateBeforeCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call findPetsByTagsValidateBeforeCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { @@ -488,7 +488,7 @@ private com.squareup.okhttp.Call findPetsByTagsValidateBeforeCall(List t } - com.squareup.okhttp.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); return call; } @@ -517,7 +517,7 @@ public List findPetsByTags(List tags) throws ApiException { */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - com.squareup.okhttp.Call call = findPetsByTagsValidateBeforeCall(tags, null, null); + okhttp3.Call call = findPetsByTagsValidateBeforeCall(tags, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -532,7 +532,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(List tags) thro * @deprecated */ @Deprecated - public com.squareup.okhttp.Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { + public okhttp3.Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -553,7 +553,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = findPetsByTagsValidateBeforeCall(tags, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByTagsValidateBeforeCall(tags, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -566,7 +566,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -592,15 +592,15 @@ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressRespons localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key" }; @@ -608,7 +608,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -616,7 +616,7 @@ private com.squareup.okhttp.Call getPetByIdValidateBeforeCall(Long petId, final } - com.squareup.okhttp.Call call = getPetByIdCall(petId, progressListener, progressRequestListener); + okhttp3.Call call = getPetByIdCall(petId, progressListener, progressRequestListener); return call; } @@ -641,7 +641,7 @@ public Pet getPetById(Long petId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - com.squareup.okhttp.Call call = getPetByIdValidateBeforeCall(petId, null, null); + okhttp3.Call call = getPetByIdValidateBeforeCall(petId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -654,7 +654,7 @@ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { + public okhttp3.Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -675,7 +675,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getPetByIdValidateBeforeCall(petId, progressListener, progressRequestListener); + okhttp3.Call call = getPetByIdValidateBeforeCall(petId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -688,7 +688,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -713,15 +713,15 @@ public com.squareup.okhttp.Call updatePetCall(Pet body, final ProgressResponseBo localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -729,7 +729,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -737,7 +737,7 @@ private com.squareup.okhttp.Call updatePetValidateBeforeCall(Pet body, final Pro } - com.squareup.okhttp.Call call = updatePetCall(body, progressListener, progressRequestListener); + okhttp3.Call call = updatePetCall(body, progressListener, progressRequestListener); return call; } @@ -760,7 +760,7 @@ public void updatePet(Pet body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - com.squareup.okhttp.Call call = updatePetValidateBeforeCall(body, null, null); + okhttp3.Call call = updatePetValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -772,7 +772,7 @@ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { + public okhttp3.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updatePetValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = updatePetValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -807,7 +807,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -841,15 +841,15 @@ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, S localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -857,7 +857,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -865,7 +865,7 @@ private com.squareup.okhttp.Call updatePetWithFormValidateBeforeCall(Long petId, } - com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); + okhttp3.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); return call; } @@ -892,7 +892,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - com.squareup.okhttp.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, null, null); + okhttp3.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, null, null); return apiClient.execute(call); } @@ -906,7 +906,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { + public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -927,7 +927,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, progressListener, progressRequestListener); + okhttp3.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -941,7 +941,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -975,15 +975,15 @@ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMeta localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -991,7 +991,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -999,7 +999,7 @@ private com.squareup.okhttp.Call uploadFileValidateBeforeCall(Long petId, String } - com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); return call; } @@ -1028,7 +1028,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - com.squareup.okhttp.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null); + okhttp3.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -1043,7 +1043,7 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { + public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1064,7 +1064,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -1079,7 +1079,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1113,15 +1113,15 @@ public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -1129,7 +1129,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -1142,7 +1142,7 @@ private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Lo } - com.squareup.okhttp.Call call = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); return call; } @@ -1171,7 +1171,7 @@ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { - com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null); + okhttp3.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -1186,7 +1186,7 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback callback) throws ApiException { + public okhttp3.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1207,7 +1207,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java index e03b7683588e..0fa806a491f2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -88,15 +88,15 @@ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressRe localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -104,7 +104,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { @@ -112,7 +112,7 @@ private com.squareup.okhttp.Call deleteOrderValidateBeforeCall(String orderId, f } - com.squareup.okhttp.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); return call; } @@ -135,7 +135,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - com.squareup.okhttp.Call call = deleteOrderValidateBeforeCall(orderId, null, null); + okhttp3.Call call = deleteOrderValidateBeforeCall(orderId, null, null); return apiClient.execute(call); } @@ -147,7 +147,7 @@ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { + public okhttp3.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -168,7 +168,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deleteOrderValidateBeforeCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = deleteOrderValidateBeforeCall(orderId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -179,7 +179,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -204,15 +204,15 @@ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.Prog localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key" }; @@ -220,10 +220,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = getInventoryCall(progressListener, progressRequestListener); + okhttp3.Call call = getInventoryCall(progressListener, progressRequestListener); return call; } @@ -246,7 +246,7 @@ public Map getInventory() throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getInventoryValidateBeforeCall(null, null); + okhttp3.Call call = getInventoryValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -258,7 +258,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getInventoryAsync(final ApiCallback> callback) throws ApiException { + public okhttp3.Call getInventoryAsync(final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -279,7 +279,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getInventoryValidateBeforeCall(progressListener, progressRequestListener); + okhttp3.Call call = getInventoryValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -292,7 +292,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -318,15 +318,15 @@ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressRes localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -334,7 +334,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { @@ -342,7 +342,7 @@ private com.squareup.okhttp.Call getOrderByIdValidateBeforeCall(Long orderId, fi } - com.squareup.okhttp.Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); return call; } @@ -367,7 +367,7 @@ public Order getOrderById(Long orderId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - com.squareup.okhttp.Call call = getOrderByIdValidateBeforeCall(orderId, null, null); + okhttp3.Call call = getOrderByIdValidateBeforeCall(orderId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -380,7 +380,7 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { + public okhttp3.Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -401,7 +401,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getOrderByIdValidateBeforeCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = getOrderByIdValidateBeforeCall(orderId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -414,7 +414,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -439,15 +439,15 @@ public com.squareup.okhttp.Call placeOrderCall(Order body, final ProgressRespons localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -455,7 +455,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -463,7 +463,7 @@ private com.squareup.okhttp.Call placeOrderValidateBeforeCall(Order body, final } - com.squareup.okhttp.Call call = placeOrderCall(body, progressListener, progressRequestListener); + okhttp3.Call call = placeOrderCall(body, progressListener, progressRequestListener); return call; } @@ -488,7 +488,7 @@ public Order placeOrder(Order body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - com.squareup.okhttp.Call call = placeOrderValidateBeforeCall(body, null, null); + okhttp3.Call call = placeOrderValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -501,7 +501,7 @@ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { + public okhttp3.Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -522,7 +522,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = placeOrderValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = placeOrderValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java index 82e7c61a83ac..b7d298439a19 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call createUserCall(User body, final ProgressResponse localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call createUserValidateBeforeCall(User body, final P } - com.squareup.okhttp.Call call = createUserCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUserCall(body, progressListener, progressRequestListener); return call; } @@ -134,7 +134,7 @@ public void createUser(User body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, null, null); + okhttp3.Call call = createUserValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -146,7 +146,7 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUserAsync(User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUserAsync(User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -167,7 +167,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUserValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -179,7 +179,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -204,15 +204,15 @@ public com.squareup.okhttp.Call createUsersWithArrayInputCall(List body, f localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -220,7 +220,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUsersWithArrayInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -228,7 +228,7 @@ private com.squareup.okhttp.Call createUsersWithArrayInputValidateBeforeCall(Lis } - com.squareup.okhttp.Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); return call; } @@ -251,7 +251,7 @@ public void createUsersWithArrayInput(List body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - com.squareup.okhttp.Call call = createUsersWithArrayInputValidateBeforeCall(body, null, null); + okhttp3.Call call = createUsersWithArrayInputValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -263,7 +263,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -284,7 +284,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUsersWithArrayInputValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithArrayInputValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -296,7 +296,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -321,15 +321,15 @@ public com.squareup.okhttp.Call createUsersWithListInputCall(List body, fi localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -337,7 +337,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUsersWithListInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUsersWithListInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -345,7 +345,7 @@ private com.squareup.okhttp.Call createUsersWithListInputValidateBeforeCall(List } - com.squareup.okhttp.Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); return call; } @@ -368,7 +368,7 @@ public void createUsersWithListInput(List body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - com.squareup.okhttp.Call call = createUsersWithListInputValidateBeforeCall(body, null, null); + okhttp3.Call call = createUsersWithListInputValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -380,7 +380,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(List body) t * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -401,7 +401,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUsersWithListInputValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithListInputValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -413,7 +413,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -439,15 +439,15 @@ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressRe localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -455,7 +455,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -463,7 +463,7 @@ private com.squareup.okhttp.Call deleteUserValidateBeforeCall(String username, f } - com.squareup.okhttp.Call call = deleteUserCall(username, progressListener, progressRequestListener); + okhttp3.Call call = deleteUserCall(username, progressListener, progressRequestListener); return call; } @@ -486,7 +486,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(username, null, null); + okhttp3.Call call = deleteUserValidateBeforeCall(username, null, null); return apiClient.execute(call); } @@ -498,7 +498,7 @@ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + public okhttp3.Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -519,7 +519,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(username, progressListener, progressRequestListener); + okhttp3.Call call = deleteUserValidateBeforeCall(username, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -531,7 +531,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -557,15 +557,15 @@ public com.squareup.okhttp.Call getUserByNameCall(String username, final Progres localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -573,7 +573,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -581,7 +581,7 @@ private com.squareup.okhttp.Call getUserByNameValidateBeforeCall(String username } - com.squareup.okhttp.Call call = getUserByNameCall(username, progressListener, progressRequestListener); + okhttp3.Call call = getUserByNameCall(username, progressListener, progressRequestListener); return call; } @@ -606,7 +606,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - com.squareup.okhttp.Call call = getUserByNameValidateBeforeCall(username, null, null); + okhttp3.Call call = getUserByNameValidateBeforeCall(username, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -619,7 +619,7 @@ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + public okhttp3.Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -640,7 +640,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getUserByNameValidateBeforeCall(username, progressListener, progressRequestListener); + okhttp3.Call call = getUserByNameValidateBeforeCall(username, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -654,7 +654,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -687,15 +687,15 @@ public com.squareup.okhttp.Call loginUserCall(String username, String password, localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -703,7 +703,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -716,7 +716,7 @@ private com.squareup.okhttp.Call loginUserValidateBeforeCall(String username, St } - com.squareup.okhttp.Call call = loginUserCall(username, password, progressListener, progressRequestListener); + okhttp3.Call call = loginUserCall(username, password, progressListener, progressRequestListener); return call; } @@ -743,7 +743,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - com.squareup.okhttp.Call call = loginUserValidateBeforeCall(username, password, null, null); + okhttp3.Call call = loginUserValidateBeforeCall(username, password, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -757,7 +757,7 @@ public ApiResponse loginUserWithHttpInfo(String username, String passwor * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { + public okhttp3.Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -778,7 +778,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = loginUserValidateBeforeCall(username, password, progressListener, progressRequestListener); + okhttp3.Call call = loginUserValidateBeforeCall(username, password, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -790,7 +790,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -815,15 +815,15 @@ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.Progre localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -831,10 +831,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = logoutUserCall(progressListener, progressRequestListener); + okhttp3.Call call = logoutUserCall(progressListener, progressRequestListener); return call; } @@ -855,7 +855,7 @@ public void logoutUser() throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = logoutUserValidateBeforeCall(null, null); + okhttp3.Call call = logoutUserValidateBeforeCall(null, null); return apiClient.execute(call); } @@ -866,7 +866,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call logoutUserAsync(final ApiCallback callback) throws ApiException { + public okhttp3.Call logoutUserAsync(final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -887,7 +887,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = logoutUserValidateBeforeCall(progressListener, progressRequestListener); + okhttp3.Call call = logoutUserValidateBeforeCall(progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -900,7 +900,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -926,15 +926,15 @@ public com.squareup.okhttp.Call updateUserCall(String username, User body, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -942,7 +942,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -955,7 +955,7 @@ private com.squareup.okhttp.Call updateUserValidateBeforeCall(String username, U } - com.squareup.okhttp.Call call = updateUserCall(username, body, progressListener, progressRequestListener); + okhttp3.Call call = updateUserCall(username, body, progressListener, progressRequestListener); return call; } @@ -980,7 +980,7 @@ public void updateUser(String username, User body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - com.squareup.okhttp.Call call = updateUserValidateBeforeCall(username, body, null, null); + okhttp3.Call call = updateUserValidateBeforeCall(username, body, null, null); return apiClient.execute(call); } @@ -993,7 +993,7 @@ public ApiResponse updateUserWithHttpInfo(String username, User body) thro * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1014,7 +1014,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updateUserValidateBeforeCall(username, body, progressListener, progressRequestListener); + okhttp3.Call call = updateUserValidateBeforeCall(username, body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index e2de10b260a6..fa9aabcadaad 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -15,7 +15,7 @@ import org.openapitools.client.Pair; -import com.squareup.okhttp.Credentials; +import okhttp3.Credentials; import java.util.Map; import java.util.List; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java index 76b4f76af769..215a33f329f0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -1,10 +1,10 @@ package org.openapitools.client.auth; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; +import okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; import org.apache.oltu.oauth2.client.HttpClient; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java index fb57323d09ec..7022c5c8c9e5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -2,10 +2,10 @@ import org.openapitools.client.Pair; -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; @@ -98,7 +98,7 @@ private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAut String requestAccessToken = getAccessToken(); try { oAuthRequest = - new OAuthBearerClientRequest(request.urlString()). + new OAuthBearerClientRequest(request.url().toString()). setAccessToken(requestAccessToken). buildHeaderMessage(); } catch (OAuthSystemException e) { diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index 2de04adf77b2..813a7f1321dd 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -96,8 +96,8 @@ if(hasProperty('target') && target == 'android') { dependencies { compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp:okhttp:2.7.5' - compile 'com.squareup.okhttp:logging-interceptor:2.7.5' + compile 'com.squareup.okhttp3:okhttp:3.12.1' + compile 'com.squareup.okhttp3:logging-interceptor:3.12.1' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.0' compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' diff --git a/samples/client/petstore/java/okhttp-gson/build.sbt b/samples/client/petstore/java/okhttp-gson/build.sbt index 44684339c858..7f2d5f98b2b9 100644 --- a/samples/client/petstore/java/okhttp-gson/build.sbt +++ b/samples/client/petstore/java/okhttp-gson/build.sbt @@ -10,8 +10,8 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp" % "okhttp" % "2.7.5", - "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", + "com.squareup.okhttp3" % "okhttp" % "3.12.1", + "com.squareup.okhttp3" % "logging-interceptor" % "3.12.1", "com.google.code.gson" % "gson" % "2.8.5", "org.apache.commons" % "commons-lang3" % "3.8.1", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 3d6aebe4121e..49698c0cc044 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -194,12 +194,12 @@ ${swagger-core-version} - com.squareup.okhttp + com.squareup.okhttp3 okhttp ${okhttp-version} - com.squareup.okhttp + com.squareup.okhttp3 logging-interceptor ${okhttp-version} @@ -242,7 +242,7 @@ ${java.version} 1.8.0 1.5.21 - 2.7.5 + 3.12.1 2.8.5 3.8.1 1.3.5 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index cd72483a1326..970b2a690c70 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -13,10 +13,10 @@ package org.openapitools.client; -import com.squareup.okhttp.*; -import com.squareup.okhttp.internal.http.HttpMethod; -import com.squareup.okhttp.logging.HttpLoggingInterceptor; -import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; import org.threeten.bp.LocalDate; @@ -425,7 +425,7 @@ public ApiClient setDebugging(boolean debugging) { if (debugging) { loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { httpClient.interceptors().remove(loggingInterceptor); loggingInterceptor = null; @@ -464,7 +464,7 @@ public ApiClient setTempFolderPath(String tempFolderPath) { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.getConnectTimeout(); + return httpClient.connectTimeoutMillis(); } /** @@ -476,7 +476,7 @@ public int getConnectTimeout() { * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -486,7 +486,7 @@ public ApiClient setConnectTimeout(int connectionTimeout) { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.getReadTimeout(); + return httpClient.readTimeoutMillis(); } /** @@ -498,7 +498,7 @@ public int getReadTimeout() { * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -508,7 +508,7 @@ public ApiClient setReadTimeout(int readTimeout) { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.getWriteTimeout(); + return httpClient.writeTimeoutMillis(); } /** @@ -520,12 +520,13 @@ public int getWriteTimeout() { * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); return this; } /** * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * * @return Token request builder */ public TokenRequestBuilder getTokenEndPoint() { @@ -659,8 +660,8 @@ public String sanitizeFilename(String filename) { * @return True if the given MIME is JSON, false otherwise. */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } /** @@ -833,8 +834,8 @@ public File downloadFileFromResponse(Response response) throws ApiException { * Prepare file for download * * @param response An instance of the Response object - * @throws IOException If fail to prepare file for download * @return Prepared file for the download + * @throws IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -877,8 +878,8 @@ public File prepareDownloadFile(Response response) throws IOException { * * @param Type * @param call An instance of the Call object - * @throws ApiException If fail to execute the call * @return ApiResponse<T> + * @throws ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -919,22 +920,22 @@ public void executeAsync(Call call, ApiCallback callback) { /** * Execute HTTP call asynchronously. * - * @see #execute(Call, Type) * @param Type * @param call The callback to be executed when the API call finishes * @param returnType Return type * @param callback ApiCallback + * @see #execute(Call, Type) */ @SuppressWarnings("unchecked") public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { call.enqueue(new Callback() { @Override - public void onFailure(Request request, IOException e) { + public void onFailure(Call call, IOException e) { callback.onFailure(new ApiException(e), 0, null); } @Override - public void onResponse(Response response) throws IOException { + public void onResponse(Call call, Response response) throws IOException { T result; try { result = (T) handleResponse(response, returnType); @@ -953,9 +954,9 @@ public void onResponse(Response response) throws IOException { * @param Type * @param response Response * @param returnType Return type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -965,7 +966,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept if (response.body() != null) { try { response.body().close(); - } catch (IOException e) { + } catch (Exception e) { throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); } } @@ -1056,7 +1057,7 @@ public Request buildRequest(String path, String method, List queryParams, Request request = null; - if(progressRequestListener != null && reqBody != null) { + if (progressRequestListener != null && reqBody != null) { ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { @@ -1156,7 +1157,7 @@ public void updateParamsForAuth(String[] authNames, List queryParams, Map< * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1171,7 +1172,7 @@ public RequestBody buildRequestBodyFormEncoding(Map formParams) * @return RequestBody */ public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); @@ -1210,16 +1211,23 @@ private void applySslSettings() { TrustManager[] trustManagers = null; HostnameVerifier hostnameVerifier = null; if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { @@ -1247,11 +1255,12 @@ public boolean verify(String hostname, SSLSession session) { if (keyManagers != null || trustManagers != null) { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + httpClient = httpClient.newBuilder().sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]).build(); } else { - httpClient.setSslSocketFactory(null); + httpClient = httpClient.newBuilder().sslSocketFactory(null, (X509TrustManager) trustManagers[0]).build(); } - httpClient.setHostnameVerifier(hostnameVerifier); + + httpClient = httpClient.newBuilder().hostnameVerifier(hostnameVerifier).build(); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java index f7ecf09b39ed..8805d31cdbd6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -13,7 +13,7 @@ package org.openapitools.client; -import com.squareup.okhttp.*; +import okhttp3.*; import okio.Buffer; import okio.BufferedSink; import okio.GzipSink; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressRequestBody.java index ebba06851d04..f33edde76b87 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressRequestBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -13,8 +13,8 @@ package org.openapitools.client; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.RequestBody; +import okhttp3.MediaType; +import okhttp3.RequestBody; import java.io.IOException; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressResponseBody.java index c01bab3b2a2c..258e48eceb49 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressResponseBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -13,8 +13,8 @@ package org.openapitools.client; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.ResponseBody; +import okhttp3.MediaType; +import okhttp3.ResponseBody; import java.io.IOException; @@ -45,12 +45,12 @@ public MediaType contentType() { } @Override - public long contentLength() throws IOException { + public long contentLength() { return responseBody.contentLength(); } @Override - public BufferedSource source() throws IOException { + public BufferedSource source() { if (bufferedSource == null) { bufferedSource = Okio.buffer(source(responseBody.source())); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 1d97d7a5787f..d02dc58bf2d8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call call123testSpecialTagsCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call call123testSpecialTagsCall(Client body, final Pr localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call call123testSpecialTagsValidateBeforeCall(Client } - com.squareup.okhttp.Call call = call123testSpecialTagsCall(body, progressListener, progressRequestListener); + okhttp3.Call call = call123testSpecialTagsCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public Client call123testSpecialTags(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = call123testSpecialTagsValidateBeforeCall(body, null, null); + okhttp3.Call call = call123testSpecialTagsValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -149,7 +149,7 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throw * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call call123testSpecialTagsAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call call123testSpecialTagsAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -170,7 +170,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = call123testSpecialTagsValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = call123testSpecialTagsValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 5801aa71922d..5e3521d91d7c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -69,7 +69,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -94,15 +94,15 @@ public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, fina localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -110,10 +110,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -138,7 +138,7 @@ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -151,7 +151,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -172,7 +172,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -185,7 +185,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -210,15 +210,15 @@ public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -226,10 +226,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -254,7 +254,7 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -267,7 +267,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(Outer * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -288,7 +288,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -301,7 +301,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -326,15 +326,15 @@ public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, fi localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -342,10 +342,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -370,7 +370,7 @@ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -383,7 +383,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal b * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -404,7 +404,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -442,15 +442,15 @@ public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -458,10 +458,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); return call; } @@ -486,7 +486,7 @@ public String fakeOuterStringSerialize(String body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { - com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); + okhttp3.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -499,7 +499,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { + public okhttp3.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -520,7 +520,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -533,7 +533,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testBodyWithFileSchemaCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testBodyWithFileSchemaCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -558,15 +558,15 @@ public com.squareup.okhttp.Call testBodyWithFileSchemaCall(FileSchemaTestClass b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -574,7 +574,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testBodyWithFileSchemaValidateBeforeCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(FileSchemaTestClass body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -582,7 +582,7 @@ private com.squareup.okhttp.Call testBodyWithFileSchemaValidateBeforeCall(FileSc } - com.squareup.okhttp.Call call = testBodyWithFileSchemaCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithFileSchemaCall(body, progressListener, progressRequestListener); return call; } @@ -605,7 +605,7 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { - com.squareup.okhttp.Call call = testBodyWithFileSchemaValidateBeforeCall(body, null, null); + okhttp3.Call call = testBodyWithFileSchemaValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -617,7 +617,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testBodyWithFileSchemaAsync(FileSchemaTestClass body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testBodyWithFileSchemaAsync(FileSchemaTestClass body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -638,7 +638,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testBodyWithFileSchemaValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithFileSchemaValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -651,7 +651,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testBodyWithQueryParamsCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testBodyWithQueryParamsCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -680,15 +680,15 @@ public com.squareup.okhttp.Call testBodyWithQueryParamsCall(String query, User b localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -696,7 +696,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(String query, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'query' is set if (query == null) { @@ -709,7 +709,7 @@ private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(Strin } - com.squareup.okhttp.Call call = testBodyWithQueryParamsCall(query, body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithQueryParamsCall(query, body, progressListener, progressRequestListener); return call; } @@ -734,7 +734,7 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { - com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, null, null); + okhttp3.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, null, null); return apiClient.execute(call); } @@ -747,7 +747,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testBodyWithQueryParamsAsync(String query, User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testBodyWithQueryParamsAsync(String query, User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -768,7 +768,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, progressListener, progressRequestListener); + okhttp3.Call call = testBodyWithQueryParamsValidateBeforeCall(query, body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -780,7 +780,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testClientModelCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testClientModelCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -805,15 +805,15 @@ public com.squareup.okhttp.Call testClientModelCall(Client body, final ProgressR localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -821,7 +821,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testClientModelValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testClientModelValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -829,7 +829,7 @@ private com.squareup.okhttp.Call testClientModelValidateBeforeCall(Client body, } - com.squareup.okhttp.Call call = testClientModelCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClientModelCall(body, progressListener, progressRequestListener); return call; } @@ -854,7 +854,7 @@ public Client testClientModel(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = testClientModelValidateBeforeCall(body, null, null); + okhttp3.Call call = testClientModelValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -867,7 +867,7 @@ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testClientModelAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testClientModelAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -888,7 +888,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testClientModelValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClientModelValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -914,7 +914,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -995,15 +995,15 @@ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Do localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "http_basic_test" }; @@ -1011,7 +1011,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testEndpointParametersValidateBeforeCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testEndpointParametersValidateBeforeCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'number' is set if (number == null) { @@ -1034,7 +1034,7 @@ private com.squareup.okhttp.Call testEndpointParametersValidateBeforeCall(BigDec } - com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); + okhttp3.Call call = testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); return call; } @@ -1083,7 +1083,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - com.squareup.okhttp.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, null); + okhttp3.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, null); return apiClient.execute(call); } @@ -1108,7 +1108,7 @@ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, D * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ApiCallback callback) throws ApiException { + public okhttp3.Call testEndpointParametersAsync(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1129,7 +1129,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); + okhttp3.Call call = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1148,7 +1148,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1205,15 +1205,15 @@ public com.squareup.okhttp.Call testEnumParametersCall(List enumHeaderSt localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1221,10 +1221,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testEnumParametersValidateBeforeCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testEnumParametersValidateBeforeCall(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); + okhttp3.Call call = testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); return call; } @@ -1261,7 +1261,7 @@ public void testEnumParameters(List enumHeaderStringArray, String enumHe * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { - com.squareup.okhttp.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null, null); + okhttp3.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null, null); return apiClient.execute(call); } @@ -1280,7 +1280,7 @@ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderS * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testEnumParametersAsync(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback callback) throws ApiException { + public okhttp3.Call testEnumParametersAsync(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1301,11 +1301,11 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); + okhttp3.Call call = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } - private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1354,15 +1354,15 @@ private com.squareup.okhttp.Call testGroupParametersCall(Integer requiredStringG localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1370,7 +1370,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testGroupParametersValidateBeforeCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testGroupParametersValidateBeforeCall(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { @@ -1388,18 +1388,18 @@ private com.squareup.okhttp.Call testGroupParametersValidateBeforeCall(Integer r } - com.squareup.okhttp.Call call = testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); + okhttp3.Call call = testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); return call; } private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { - com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null); + okhttp3.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, null); return apiClient.execute(call); } - private com.squareup.okhttp.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback callback) throws ApiException { + private okhttp3.Call testGroupParametersAsync(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1420,7 +1420,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); + okhttp3.Call call = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1476,7 +1476,7 @@ public APItestGroupParametersRequest int64Group(Long int64Group) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call buildCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, progressListener, progressRequestListener); } @@ -1503,7 +1503,7 @@ public ApiResponse executeWithHttpInfo() throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call executeAsync(final ApiCallback callback) throws ApiException { + public okhttp3.Call executeAsync(final ApiCallback callback) throws ApiException { return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, callback); } } @@ -1527,7 +1527,7 @@ public APItestGroupParametersRequest testGroupParameters(Integer requiredStringG * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = param; // create path and map variables @@ -1552,15 +1552,15 @@ public com.squareup.okhttp.Call testInlineAdditionalPropertiesCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(Map param, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'param' is set if (param == null) { @@ -1576,7 +1576,7 @@ private com.squareup.okhttp.Call testInlineAdditionalPropertiesValidateBeforeCal } - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesCall(param, progressListener, progressRequestListener); + okhttp3.Call call = testInlineAdditionalPropertiesCall(param, progressListener, progressRequestListener); return call; } @@ -1599,7 +1599,7 @@ public void testInlineAdditionalProperties(Map param) throws Api * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, null, null); + okhttp3.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, null, null); return apiClient.execute(call); } @@ -1611,7 +1611,7 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param, final ApiCallback callback) throws ApiException { + public okhttp3.Call testInlineAdditionalPropertiesAsync(Map param, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1632,7 +1632,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, progressListener, progressRequestListener); + okhttp3.Call call = testInlineAdditionalPropertiesValidateBeforeCall(param, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -1645,7 +1645,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1678,15 +1678,15 @@ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2 localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -1694,7 +1694,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'param' is set if (param == null) { @@ -1707,7 +1707,7 @@ private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param } - com.squareup.okhttp.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener); + okhttp3.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener); return call; } @@ -1732,7 +1732,7 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { - com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null); + okhttp3.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null); return apiClient.execute(call); } @@ -1745,7 +1745,7 @@ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testJsonFormDataAsync(String param, String param2, final ApiCallback callback) throws ApiException { + public okhttp3.Call testJsonFormDataAsync(String param, String param2, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1766,7 +1766,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener); + okhttp3.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 9fe1f2fabf68..787906d9861b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressRes localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key_query" }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, fi } - com.squareup.okhttp.Call call = testClassnameCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClassnameCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public Client testClassname(Client body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { - com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, null, null); + okhttp3.Call call = testClassnameValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -149,7 +149,7 @@ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiExce * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { + public okhttp3.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -170,7 +170,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java index 4368d7b34e5c..aacd1af92b88 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java @@ -64,7 +64,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -89,15 +89,15 @@ public com.squareup.okhttp.Call addPetCall(Pet body, final ProgressResponseBody. localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -105,7 +105,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call addPetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -113,7 +113,7 @@ private com.squareup.okhttp.Call addPetValidateBeforeCall(Pet body, final Progre } - com.squareup.okhttp.Call call = addPetCall(body, progressListener, progressRequestListener); + okhttp3.Call call = addPetCall(body, progressListener, progressRequestListener); return call; } @@ -136,7 +136,7 @@ public void addPet(Pet body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - com.squareup.okhttp.Call call = addPetValidateBeforeCall(body, null, null); + okhttp3.Call call = addPetValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -148,7 +148,7 @@ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { + public okhttp3.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -169,7 +169,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = addPetValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = addPetValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -182,7 +182,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -212,15 +212,15 @@ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final P localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -228,7 +228,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -236,7 +236,7 @@ private com.squareup.okhttp.Call deletePetValidateBeforeCall(Long petId, String } - com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); + okhttp3.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); return call; } @@ -261,7 +261,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - com.squareup.okhttp.Call call = deletePetValidateBeforeCall(petId, apiKey, null, null); + okhttp3.Call call = deletePetValidateBeforeCall(petId, apiKey, null, null); return apiClient.execute(call); } @@ -274,7 +274,7 @@ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { + public okhttp3.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deletePetValidateBeforeCall(petId, apiKey, progressListener, progressRequestListener); + okhttp3.Call call = deletePetValidateBeforeCall(petId, apiKey, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -307,7 +307,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -336,15 +336,15 @@ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -352,7 +352,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call findPetsByStatusValidateBeforeCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call findPetsByStatusValidateBeforeCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'status' is set if (status == null) { @@ -360,7 +360,7 @@ private com.squareup.okhttp.Call findPetsByStatusValidateBeforeCall(List } - com.squareup.okhttp.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); return call; } @@ -385,7 +385,7 @@ public List findPetsByStatus(List status) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - com.squareup.okhttp.Call call = findPetsByStatusValidateBeforeCall(status, null, null); + okhttp3.Call call = findPetsByStatusValidateBeforeCall(status, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -398,7 +398,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { + public okhttp3.Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -419,7 +419,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = findPetsByStatusValidateBeforeCall(status, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByStatusValidateBeforeCall(status, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @deprecated */ @Deprecated - public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -463,15 +463,15 @@ public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final Prog localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -480,7 +480,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch @Deprecated @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call findPetsByTagsValidateBeforeCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call findPetsByTagsValidateBeforeCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { @@ -488,7 +488,7 @@ private com.squareup.okhttp.Call findPetsByTagsValidateBeforeCall(List t } - com.squareup.okhttp.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); return call; } @@ -517,7 +517,7 @@ public List findPetsByTags(List tags) throws ApiException { */ @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - com.squareup.okhttp.Call call = findPetsByTagsValidateBeforeCall(tags, null, null); + okhttp3.Call call = findPetsByTagsValidateBeforeCall(tags, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -532,7 +532,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(List tags) thro * @deprecated */ @Deprecated - public com.squareup.okhttp.Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { + public okhttp3.Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -553,7 +553,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = findPetsByTagsValidateBeforeCall(tags, progressListener, progressRequestListener); + okhttp3.Call call = findPetsByTagsValidateBeforeCall(tags, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -566,7 +566,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -592,15 +592,15 @@ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressRespons localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key" }; @@ -608,7 +608,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -616,7 +616,7 @@ private com.squareup.okhttp.Call getPetByIdValidateBeforeCall(Long petId, final } - com.squareup.okhttp.Call call = getPetByIdCall(petId, progressListener, progressRequestListener); + okhttp3.Call call = getPetByIdCall(petId, progressListener, progressRequestListener); return call; } @@ -641,7 +641,7 @@ public Pet getPetById(Long petId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - com.squareup.okhttp.Call call = getPetByIdValidateBeforeCall(petId, null, null); + okhttp3.Call call = getPetByIdValidateBeforeCall(petId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -654,7 +654,7 @@ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { + public okhttp3.Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -675,7 +675,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getPetByIdValidateBeforeCall(petId, progressListener, progressRequestListener); + okhttp3.Call call = getPetByIdValidateBeforeCall(petId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -688,7 +688,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -713,15 +713,15 @@ public com.squareup.okhttp.Call updatePetCall(Pet body, final ProgressResponseBo localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -729,7 +729,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updatePetValidateBeforeCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -737,7 +737,7 @@ private com.squareup.okhttp.Call updatePetValidateBeforeCall(Pet body, final Pro } - com.squareup.okhttp.Call call = updatePetCall(body, progressListener, progressRequestListener); + okhttp3.Call call = updatePetCall(body, progressListener, progressRequestListener); return call; } @@ -760,7 +760,7 @@ public void updatePet(Pet body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - com.squareup.okhttp.Call call = updatePetValidateBeforeCall(body, null, null); + okhttp3.Call call = updatePetValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -772,7 +772,7 @@ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { + public okhttp3.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updatePetValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = updatePetValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -807,7 +807,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -841,15 +841,15 @@ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, S localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -857,7 +857,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -865,7 +865,7 @@ private com.squareup.okhttp.Call updatePetWithFormValidateBeforeCall(Long petId, } - com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); + okhttp3.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); return call; } @@ -892,7 +892,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - com.squareup.okhttp.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, null, null); + okhttp3.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, null, null); return apiClient.execute(call); } @@ -906,7 +906,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { + public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -927,7 +927,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, progressListener, progressRequestListener); + okhttp3.Call call = updatePetWithFormValidateBeforeCall(petId, name, status, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -941,7 +941,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -975,15 +975,15 @@ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMeta localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -991,7 +991,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -999,7 +999,7 @@ private com.squareup.okhttp.Call uploadFileValidateBeforeCall(Long petId, String } - com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); return call; } @@ -1028,7 +1028,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - com.squareup.okhttp.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null); + okhttp3.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -1043,7 +1043,7 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { + public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1064,7 +1064,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileValidateBeforeCall(petId, additionalMetadata, file, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -1079,7 +1079,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call uploadFileWithRequiredFileCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -1113,15 +1113,15 @@ public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "petstore_auth" }; @@ -1129,7 +1129,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File requiredFile, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { @@ -1142,7 +1142,7 @@ private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Lo } - com.squareup.okhttp.Call call = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); return call; } @@ -1171,7 +1171,7 @@ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { - com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null); + okhttp3.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -1186,7 +1186,7 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback callback) throws ApiException { + public okhttp3.Call uploadFileWithRequiredFileAsync(Long petId, File requiredFile, String additionalMetadata, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1207,7 +1207,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); + okhttp3.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java index e03b7683588e..0fa806a491f2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -88,15 +88,15 @@ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressRe localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -104,7 +104,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deleteOrderValidateBeforeCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { @@ -112,7 +112,7 @@ private com.squareup.okhttp.Call deleteOrderValidateBeforeCall(String orderId, f } - com.squareup.okhttp.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); return call; } @@ -135,7 +135,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - com.squareup.okhttp.Call call = deleteOrderValidateBeforeCall(orderId, null, null); + okhttp3.Call call = deleteOrderValidateBeforeCall(orderId, null, null); return apiClient.execute(call); } @@ -147,7 +147,7 @@ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { + public okhttp3.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -168,7 +168,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deleteOrderValidateBeforeCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = deleteOrderValidateBeforeCall(orderId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -179,7 +179,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -204,15 +204,15 @@ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.Prog localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { "api_key" }; @@ -220,10 +220,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getInventoryValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = getInventoryCall(progressListener, progressRequestListener); + okhttp3.Call call = getInventoryCall(progressListener, progressRequestListener); return call; } @@ -246,7 +246,7 @@ public Map getInventory() throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = getInventoryValidateBeforeCall(null, null); + okhttp3.Call call = getInventoryValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -258,7 +258,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getInventoryAsync(final ApiCallback> callback) throws ApiException { + public okhttp3.Call getInventoryAsync(final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -279,7 +279,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getInventoryValidateBeforeCall(progressListener, progressRequestListener); + okhttp3.Call call = getInventoryValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -292,7 +292,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -318,15 +318,15 @@ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressRes localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -334,7 +334,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getOrderByIdValidateBeforeCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { @@ -342,7 +342,7 @@ private com.squareup.okhttp.Call getOrderByIdValidateBeforeCall(Long orderId, fi } - com.squareup.okhttp.Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); return call; } @@ -367,7 +367,7 @@ public Order getOrderById(Long orderId) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - com.squareup.okhttp.Call call = getOrderByIdValidateBeforeCall(orderId, null, null); + okhttp3.Call call = getOrderByIdValidateBeforeCall(orderId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -380,7 +380,7 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { + public okhttp3.Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -401,7 +401,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getOrderByIdValidateBeforeCall(orderId, progressListener, progressRequestListener); + okhttp3.Call call = getOrderByIdValidateBeforeCall(orderId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -414,7 +414,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -439,15 +439,15 @@ public com.squareup.okhttp.Call placeOrderCall(Order body, final ProgressRespons localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -455,7 +455,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call placeOrderValidateBeforeCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -463,7 +463,7 @@ private com.squareup.okhttp.Call placeOrderValidateBeforeCall(Order body, final } - com.squareup.okhttp.Call call = placeOrderCall(body, progressListener, progressRequestListener); + okhttp3.Call call = placeOrderCall(body, progressListener, progressRequestListener); return call; } @@ -488,7 +488,7 @@ public Order placeOrder(Order body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - com.squareup.okhttp.Call call = placeOrderValidateBeforeCall(body, null, null); + okhttp3.Call call = placeOrderValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -501,7 +501,7 @@ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { + public okhttp3.Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -522,7 +522,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = placeOrderValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = placeOrderValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java index 82e7c61a83ac..b7d298439a19 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java @@ -62,7 +62,7 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -87,15 +87,15 @@ public com.squareup.okhttp.Call createUserCall(User body, final ProgressResponse localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -103,7 +103,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUserValidateBeforeCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -111,7 +111,7 @@ private com.squareup.okhttp.Call createUserValidateBeforeCall(User body, final P } - com.squareup.okhttp.Call call = createUserCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUserCall(body, progressListener, progressRequestListener); return call; } @@ -134,7 +134,7 @@ public void createUser(User body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, null, null); + okhttp3.Call call = createUserValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -146,7 +146,7 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUserAsync(User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUserAsync(User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -167,7 +167,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUserValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUserValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -179,7 +179,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -204,15 +204,15 @@ public com.squareup.okhttp.Call createUsersWithArrayInputCall(List body, f localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -220,7 +220,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUsersWithArrayInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -228,7 +228,7 @@ private com.squareup.okhttp.Call createUsersWithArrayInputValidateBeforeCall(Lis } - com.squareup.okhttp.Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); return call; } @@ -251,7 +251,7 @@ public void createUsersWithArrayInput(List body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - com.squareup.okhttp.Call call = createUsersWithArrayInputValidateBeforeCall(body, null, null); + okhttp3.Call call = createUsersWithArrayInputValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -263,7 +263,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -284,7 +284,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUsersWithArrayInputValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithArrayInputValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -296,7 +296,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -321,15 +321,15 @@ public com.squareup.okhttp.Call createUsersWithListInputCall(List body, fi localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -337,7 +337,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createUsersWithListInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call createUsersWithListInputValidateBeforeCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { @@ -345,7 +345,7 @@ private com.squareup.okhttp.Call createUsersWithListInputValidateBeforeCall(List } - com.squareup.okhttp.Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); return call; } @@ -368,7 +368,7 @@ public void createUsersWithListInput(List body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - com.squareup.okhttp.Call call = createUsersWithListInputValidateBeforeCall(body, null, null); + okhttp3.Call call = createUsersWithListInputValidateBeforeCall(body, null, null); return apiClient.execute(call); } @@ -380,7 +380,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(List body) t * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { + public okhttp3.Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -401,7 +401,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = createUsersWithListInputValidateBeforeCall(body, progressListener, progressRequestListener); + okhttp3.Call call = createUsersWithListInputValidateBeforeCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -413,7 +413,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -439,15 +439,15 @@ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressRe localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -455,7 +455,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call deleteUserValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -463,7 +463,7 @@ private com.squareup.okhttp.Call deleteUserValidateBeforeCall(String username, f } - com.squareup.okhttp.Call call = deleteUserCall(username, progressListener, progressRequestListener); + okhttp3.Call call = deleteUserCall(username, progressListener, progressRequestListener); return call; } @@ -486,7 +486,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(username, null, null); + okhttp3.Call call = deleteUserValidateBeforeCall(username, null, null); return apiClient.execute(call); } @@ -498,7 +498,7 @@ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + public okhttp3.Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -519,7 +519,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = deleteUserValidateBeforeCall(username, progressListener, progressRequestListener); + okhttp3.Call call = deleteUserValidateBeforeCall(username, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -531,7 +531,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -557,15 +557,15 @@ public com.squareup.okhttp.Call getUserByNameCall(String username, final Progres localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -573,7 +573,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call getUserByNameValidateBeforeCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -581,7 +581,7 @@ private com.squareup.okhttp.Call getUserByNameValidateBeforeCall(String username } - com.squareup.okhttp.Call call = getUserByNameCall(username, progressListener, progressRequestListener); + okhttp3.Call call = getUserByNameCall(username, progressListener, progressRequestListener); return call; } @@ -606,7 +606,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - com.squareup.okhttp.Call call = getUserByNameValidateBeforeCall(username, null, null); + okhttp3.Call call = getUserByNameValidateBeforeCall(username, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -619,7 +619,7 @@ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + public okhttp3.Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -640,7 +640,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = getUserByNameValidateBeforeCall(username, progressListener, progressRequestListener); + okhttp3.Call call = getUserByNameValidateBeforeCall(username, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -654,7 +654,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -687,15 +687,15 @@ public com.squareup.okhttp.Call loginUserCall(String username, String password, localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -703,7 +703,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call loginUserValidateBeforeCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -716,7 +716,7 @@ private com.squareup.okhttp.Call loginUserValidateBeforeCall(String username, St } - com.squareup.okhttp.Call call = loginUserCall(username, password, progressListener, progressRequestListener); + okhttp3.Call call = loginUserCall(username, password, progressListener, progressRequestListener); return call; } @@ -743,7 +743,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - com.squareup.okhttp.Call call = loginUserValidateBeforeCall(username, password, null, null); + okhttp3.Call call = loginUserValidateBeforeCall(username, password, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -757,7 +757,7 @@ public ApiResponse loginUserWithHttpInfo(String username, String passwor * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { + public okhttp3.Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -778,7 +778,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = loginUserValidateBeforeCall(username, password, progressListener, progressRequestListener); + okhttp3.Call call = loginUserValidateBeforeCall(username, password, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; @@ -790,7 +790,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = new Object(); // create path and map variables @@ -815,15 +815,15 @@ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.Progre localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -831,10 +831,10 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call logoutUserValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - com.squareup.okhttp.Call call = logoutUserCall(progressListener, progressRequestListener); + okhttp3.Call call = logoutUserCall(progressListener, progressRequestListener); return call; } @@ -855,7 +855,7 @@ public void logoutUser() throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = logoutUserValidateBeforeCall(null, null); + okhttp3.Call call = logoutUserValidateBeforeCall(null, null); return apiClient.execute(call); } @@ -866,7 +866,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call logoutUserAsync(final ApiCallback callback) throws ApiException { + public okhttp3.Call logoutUserAsync(final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -887,7 +887,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = logoutUserValidateBeforeCall(progressListener, progressRequestListener); + okhttp3.Call call = logoutUserValidateBeforeCall(progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } @@ -900,7 +900,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public okhttp3.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables @@ -926,15 +926,15 @@ public com.squareup.okhttp.Call updateUserCall(String username, User body, final localVarHeaderParams.put("Content-Type", localVarContentType); if (progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); } - }); + }).build()); } String[] localVarAuthNames = new String[] { }; @@ -942,7 +942,7 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call updateUserValidateBeforeCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'username' is set if (username == null) { @@ -955,7 +955,7 @@ private com.squareup.okhttp.Call updateUserValidateBeforeCall(String username, U } - com.squareup.okhttp.Call call = updateUserCall(username, body, progressListener, progressRequestListener); + okhttp3.Call call = updateUserCall(username, body, progressListener, progressRequestListener); return call; } @@ -980,7 +980,7 @@ public void updateUser(String username, User body) throws ApiException { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - com.squareup.okhttp.Call call = updateUserValidateBeforeCall(username, body, null, null); + okhttp3.Call call = updateUserValidateBeforeCall(username, body, null, null); return apiClient.execute(call); } @@ -993,7 +993,7 @@ public ApiResponse updateUserWithHttpInfo(String username, User body) thro * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { + public okhttp3.Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -1014,7 +1014,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = updateUserValidateBeforeCall(username, body, progressListener, progressRequestListener); + okhttp3.Call call = updateUserValidateBeforeCall(username, body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index e2de10b260a6..fa9aabcadaad 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -15,7 +15,7 @@ import org.openapitools.client.Pair; -import com.squareup.okhttp.Credentials; +import okhttp3.Credentials; import java.util.Map; import java.util.List; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java index 76b4f76af769..215a33f329f0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -1,10 +1,10 @@ package org.openapitools.client.auth; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; +import okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; import org.apache.oltu.oauth2.client.HttpClient; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java index fb57323d09ec..7022c5c8c9e5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -2,10 +2,10 @@ import org.openapitools.client.Pair; -import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; @@ -98,7 +98,7 @@ private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAut String requestAccessToken = getAccessToken(); try { oAuthRequest = - new OAuthBearerClientRequest(request.urlString()). + new OAuthBearerClientRequest(request.url().toString()). setAccessToken(requestAccessToken). buildHeaderMessage(); } catch (OAuthSystemException e) { diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ApiClientTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ApiClientTest.java index 5167afc326b6..4d8b5d2b38fe 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ApiClientTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ApiClientTest.java @@ -157,11 +157,11 @@ public void testSetApiKeyAndPrefix() { public void testGetAndSetConnectTimeout() { // connect timeout defaults to 10 seconds assertEquals(10000, apiClient.getConnectTimeout()); - assertEquals(10000, apiClient.getHttpClient().getConnectTimeout()); + assertEquals(10000, apiClient.getHttpClient().connectTimeoutMillis()); apiClient.setConnectTimeout(0); assertEquals(0, apiClient.getConnectTimeout()); - assertEquals(0, apiClient.getHttpClient().getConnectTimeout()); + assertEquals(0, apiClient.getHttpClient().connectTimeoutMillis()); apiClient.setConnectTimeout(10000); } @@ -170,11 +170,11 @@ public void testGetAndSetConnectTimeout() { public void testGetAndSetReadTimeout() { // read timeout defaults to 10 seconds assertEquals(10000, apiClient.getReadTimeout()); - assertEquals(10000, apiClient.getHttpClient().getReadTimeout()); + assertEquals(10000, apiClient.getHttpClient().readTimeoutMillis()); apiClient.setReadTimeout(0); assertEquals(0, apiClient.getReadTimeout()); - assertEquals(0, apiClient.getHttpClient().getReadTimeout()); + assertEquals(0, apiClient.getHttpClient().readTimeoutMillis()); apiClient.setReadTimeout(10000); } @@ -183,11 +183,11 @@ public void testGetAndSetReadTimeout() { public void testGetAndSetWriteTimeout() { // write timeout defaults to 10 seconds assertEquals(10000, apiClient.getWriteTimeout()); - assertEquals(10000, apiClient.getHttpClient().getWriteTimeout()); + assertEquals(10000, apiClient.getHttpClient().writeTimeoutMillis()); apiClient.setWriteTimeout(0); assertEquals(0, apiClient.getWriteTimeout()); - assertEquals(0, apiClient.getHttpClient().getWriteTimeout()); + assertEquals(0, apiClient.getHttpClient().writeTimeoutMillis()); apiClient.setWriteTimeout(10000); } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java index d3fbe90a5a64..416b12609e72 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -3,7 +3,7 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,157 +14,345 @@ package org.openapitools.client.api; import org.openapitools.client.ApiException; -import java.io.File; -import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import org.junit.Test; -import org.junit.Ignore; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.*; +import java.lang.reflect.Type; +import java.util.Arrays; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; + +import org.junit.*; + +import static org.junit.Assert.*; /** * API tests for PetApi */ -@Ignore public class PetApiTest { - private final PetApi api = new PetApi(); - - - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ + private PetApi api = new PetApi(); + + @Before + public void setup() { + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); + } + + @Test + public void testApiClient() { + // the default api client is used + assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); + + ApiClient oldClient = api.getApiClient(); + + ApiClient newClient = new ApiClient(); + newClient.setBasePath("http://example.com"); + newClient.setDebugging(true); + + // set api client via constructor + api = new PetApi(newClient); + assertNotNull(api.getApiClient()); + assertEquals("http://example.com", api.getApiClient().getBasePath()); + assertTrue(api.getApiClient().isDebugging()); + + // set api client via setter method + api.setApiClient(oldClient); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); + } + @Test - public void addPetTest() throws ApiException { - Pet pet = null; + public void testCreateAndGetPet() throws Exception { + Pet pet = createPet(); api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void deletePetTest() throws ApiException { - Long petId = null; - String apiKey = null; - api.deletePet(petId, apiKey); + public void testCreateAndGetPetWithHttpInfo() throws Exception { + Pet pet = createPet(); + api.addPetWithHttpInfo(pet); - // TODO: test validations + ApiResponse resp = api.getPetByIdWithHttpInfo(pet.getId()); + assertEquals(200, resp.getStatusCode()); + assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0)); + Pet fetched = resp.getData(); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void findPetsByStatusTest() throws ApiException { - List status = null; - List response = api.findPetsByStatus(status); + public void testCreateAndGetPetAsync() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + // to store returned Pet or error message/exception + final Map result = new HashMap(); - // TODO: test validations + api.getPetByIdAsync(pet.getId(), new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("error", e.getMessage()); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + // the API call should be executed asynchronously, so result should be empty at the moment + assertTrue(result.isEmpty()); + + // wait for the asynchronous call to finish (at most 10 seconds) + final int maxTry = 10; + int tryCount = 1; + Pet fetched = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("error") != null) fail((String) result.get("error")); + if (result.get("pet") != null) { + fetched = (Pet) result.get("pet"); + break; + } + } while (result.isEmpty()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + + // test getting a nonexistent pet + result.clear(); + api.getPetByIdAsync(-10000L, new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("exception", e); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + + // wait for the asynchronous call to finish (at most 10 seconds) + tryCount = 1; + ApiException exception = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("pet") != null) fail("expected an error"); + if (result.get("exception") != null) { + exception = (ApiException) result.get("exception"); + break; + } + } while (result.isEmpty()); + assertNotNull(exception); + assertEquals(404, exception.getCode()); + assertEquals("Not Found", exception.getMessage()); + assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void findPetsByTagsTest() throws ApiException { - List tags = null; - List response = api.findPetsByTags(tags); + public void testUpdatePet() throws Exception { + Pet pet = createPet(); + pet.setName("programmer"); + + api.updatePet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void getPetByIdTest() throws ApiException { - Long petId = null; - Pet response = api.getPetById(petId); + public void testFindPetsByStatus() throws Exception { + Pet pet = createPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.PENDING); + + api.updatePet(pet); + + List pets = api.findPetsByStatus(Arrays.asList("pending")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } - // TODO: test validations + assertTrue(found); + + api.deletePet(pet.getId(), null); } - - /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void updatePetTest() throws ApiException { - Pet pet = null; + public void testFindPetsByTags() throws Exception { + Pet pet = createPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + api.updatePet(pet); - // TODO: test validations + List pets = api.findPetsByTags(Arrays.asList("friendly")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + + api.deletePet(pet.getId(), null); + } + + @Test + public void testUpdatePetWithForm() throws Exception { + Pet pet = createPet(); + pet.setName("frank"); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); + } + + @Test + public void testDeletePet() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (ApiException e) { + assertEquals(404, e.getCode()); + } } - - /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void updatePetWithFormTest() throws ApiException { - Long petId = null; - String name = null; - String status = null; - api.updatePetWithForm(petId, name, status); + public void testUploadFile() throws Exception { + Pet pet = createPet(); + api.addPet(pet); + + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); - // TODO: test validations + api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); } - - /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void uploadFileTest() throws ApiException { - Long petId = null; - String additionalMetadata = null; - File file = null; - ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + + private Pet createPet() { + Pet pet = new Pet(); + pet.setId(1234567L); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2"); + pet.setPhotoUrls(photos); + + return pet; + } + + private String serializeJson(Object o, ApiClient apiClient) { + return apiClient.getJSON().serialize(o); + } - // TODO: test validations + private T deserializeJson(String json, Type type, ApiClient apiClient) { + return (T) apiClient.getJSON().deserialize(json, type); } - }