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 0bddc657e0d3..bf7bc02f9be6 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,6 +2,7 @@ package {{invokerPackage}}; +import {{apiPackage}}.*; {{#dynamicOperations}} import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -1755,4 +1756,15 @@ public class ApiClient { // empty http request body return ""; } + + {{#apiInfo}}{{#apis}} + /** + * Get an instance of {{classname}} + * + * @return An instance of {{classname}} + */ + public {{classname}} get{{classname}}() { + return new {{classname}}(this); + } + {{/apis}}{{/apiInfo}} } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache index b4b5d2cdda60..596edf52a5fd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache @@ -116,7 +116,7 @@ public class Example { {{/authMethods}} {{/hasAuthMethods}} - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{{classname}}} apiInstance = defaultClient.get{{{classname}}}(); {{#allParams}} {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/allParams}} diff --git a/samples/client/others/java/okhttp-gson-streaming/README.md b/samples/client/others/java/okhttp-gson-streaming/README.md index ef1bda7072e2..f0fbd9834265 100644 --- a/samples/client/others/java/okhttp-gson-streaming/README.md +++ b/samples/client/others/java/okhttp-gson-streaming/README.md @@ -90,7 +90,7 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost:8082"); - PingApi apiInstance = new PingApi(defaultClient); + PingApi apiInstance = defaultClient.getPingApi(); SomeObj someObj = new SomeObj(); // SomeObj | try { SomeObj result = apiInstance.postPing(someObj); diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java index 20c24352d3d8..12b1304e8181 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -13,6 +13,7 @@ package org.openapitools.client; +import org.openapitools.client.api.*; import okhttp3.*; import okhttp3.internal.http.HttpMethod; import okhttp3.internal.tls.OkHostnameVerifier; @@ -1479,4 +1480,15 @@ private String requestBodyToString(RequestBody requestBody) throws ApiException // empty http request body return ""; } + + + /** + * Get an instance of PingApi + * + * @return An instance of PingApi + */ + public PingApi getPingApi() { + return new PingApi(this); + } + } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md index 054726451fd9..f9d0303c8649 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md @@ -90,7 +90,7 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + AnotherFakeApi apiInstance = defaultClient.getAnotherFakeApi(); Client body = new Client(); // Client | client model try { Client result = apiInstance.call123testSpecialTags(body); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index c065d7d109fe..62da5ef78d3f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -13,6 +13,7 @@ package org.openapitools.client; +import org.openapitools.client.api.*; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; @@ -1626,4 +1627,60 @@ private String requestBodyToString(RequestBody requestBody) throws ApiException // empty http request body return ""; } + + + /** + * Get an instance of AnotherFakeApi + * + * @return An instance of AnotherFakeApi + */ + public AnotherFakeApi getAnotherFakeApi() { + return new AnotherFakeApi(this); + } + + /** + * Get an instance of FakeApi + * + * @return An instance of FakeApi + */ + public FakeApi getFakeApi() { + return new FakeApi(this); + } + + /** + * Get an instance of FakeClassnameTags123Api + * + * @return An instance of FakeClassnameTags123Api + */ + public FakeClassnameTags123Api getFakeClassnameTags123Api() { + return new FakeClassnameTags123Api(this); + } + + /** + * Get an instance of PetApi + * + * @return An instance of PetApi + */ + public PetApi getPetApi() { + return new PetApi(this); + } + + /** + * Get an instance of StoreApi + * + * @return An instance of StoreApi + */ + public StoreApi getStoreApi() { + return new StoreApi(this); + } + + /** + * Get an instance of UserApi + * + * @return An instance of UserApi + */ + public UserApi getUserApi() { + return new UserApi(this); + } + } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md index b3e111f6884e..41472d596e64 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md @@ -90,7 +90,7 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + AnotherFakeApi apiInstance = defaultClient.getAnotherFakeApi(); Client body = new Client(); // Client | client model try { Client result = apiInstance.call123testSpecialTags(body); 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 8ae5d16c3baf..9b401c0d5c71 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,6 +13,7 @@ package org.openapitools.client; +import org.openapitools.client.api.*; import okhttp3.*; import okhttp3.internal.http.HttpMethod; import okhttp3.internal.tls.OkHostnameVerifier; @@ -1558,4 +1559,60 @@ private String requestBodyToString(RequestBody requestBody) throws ApiException // empty http request body return ""; } + + + /** + * Get an instance of AnotherFakeApi + * + * @return An instance of AnotherFakeApi + */ + public AnotherFakeApi getAnotherFakeApi() { + return new AnotherFakeApi(this); + } + + /** + * Get an instance of FakeApi + * + * @return An instance of FakeApi + */ + public FakeApi getFakeApi() { + return new FakeApi(this); + } + + /** + * Get an instance of FakeClassnameTags123Api + * + * @return An instance of FakeClassnameTags123Api + */ + public FakeClassnameTags123Api getFakeClassnameTags123Api() { + return new FakeClassnameTags123Api(this); + } + + /** + * Get an instance of PetApi + * + * @return An instance of PetApi + */ + public PetApi getPetApi() { + return new PetApi(this); + } + + /** + * Get an instance of StoreApi + * + * @return An instance of StoreApi + */ + public StoreApi getStoreApi() { + return new StoreApi(this); + } + + /** + * Get an instance of UserApi + * + * @return An instance of UserApi + */ + public UserApi getUserApi() { + return new UserApi(this); + } + } diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index d1dbd67d76e4..00a8550496c0 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -90,7 +90,7 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + AnotherFakeApi apiInstance = defaultClient.getAnotherFakeApi(); Client client = new Client(); // Client | client model try { Client result = apiInstance.call123testSpecialTags(client); 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 0e626694f6f9..e1169839a80c 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,6 +13,7 @@ package org.openapitools.client; +import org.openapitools.client.api.*; import okhttp3.*; import okhttp3.internal.http.HttpMethod; import okhttp3.internal.tls.OkHostnameVerifier; @@ -1577,4 +1578,69 @@ private String requestBodyToString(RequestBody requestBody) throws ApiException // empty http request body return ""; } + + + /** + * Get an instance of AnotherFakeApi + * + * @return An instance of AnotherFakeApi + */ + public AnotherFakeApi getAnotherFakeApi() { + return new AnotherFakeApi(this); + } + + /** + * Get an instance of DefaultApi + * + * @return An instance of DefaultApi + */ + public DefaultApi getDefaultApi() { + return new DefaultApi(this); + } + + /** + * Get an instance of FakeApi + * + * @return An instance of FakeApi + */ + public FakeApi getFakeApi() { + return new FakeApi(this); + } + + /** + * Get an instance of FakeClassnameTags123Api + * + * @return An instance of FakeClassnameTags123Api + */ + public FakeClassnameTags123Api getFakeClassnameTags123Api() { + return new FakeClassnameTags123Api(this); + } + + /** + * Get an instance of PetApi + * + * @return An instance of PetApi + */ + public PetApi getPetApi() { + return new PetApi(this); + } + + /** + * Get an instance of StoreApi + * + * @return An instance of StoreApi + */ + public StoreApi getStoreApi() { + return new StoreApi(this); + } + + /** + * Get an instance of UserApi + * + * @return An instance of UserApi + */ + public UserApi getUserApi() { + return new UserApi(this); + } + }