forked from loafle/openapi-generator-original
* upgrade spring-boot-starter-parent * upgrade springdoc and swagger-ui * upgrade v3 swagger-annotations * generate samples * upgrade jackson * fix spring cloud, remove temp comment Putting "8" instead of "1.8" should be ok, because Spring Boot 3 requires Java 17 anyway, so it should be able to understand that 8 is the same as 1.8. * generate samples * upgrade JUnit 5, remove commons-io dependency, remove outdated samples/client/petstore/java/feign/feign10x/ files, generate samples commons-io dependency was introduced in https://github.com/OpenAPITools/openapi-generator/pull/8484, but I don't see why it would be needed now or back then. * update gson, generate samples * update logback * update feign * update scribejava * generate samples * update httpmime * okhttp-gson: update commons-lang & okhttp & junit-platform, remove mockito; generate samples It seems Mockito is not used at all there. * okhttp-gson: remove unnecessary sample files, generate sample files * upgrade google-api-client & jersey-common, restore ClientTest, generate samples * misc. upgrades in jersey2 and jersey3 jersey 3.1.3 is available already, but IntelliJ reports security problems in 3.1.3 and 3.1.2, so I used 3.1.1 instead. * align some gradle&sbt files with poms, generate samples * whitespace fix
echo-api-feign-json
Requirements
Building the API client library requires Maven to be installed.
Installation & Usage
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your pom.xml:
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>echo-api-feign-json</artifactId>
<version>0.1.0</version>
<scope>compile</scope>
</dependency>
And to use the api you can follow the examples bellow:
//Set bearer token manually
ApiClient apiClient = new ApiClient("petstore_auth_client");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setAccessToken("TOKEN", 10000);
//Use api key
ApiClient apiClient = new ApiClient("api_key", "API KEY");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
//Use http basic authentication
ApiClient apiClient = new ApiClient("basicAuth");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setCredentials("username", "password");
//Oauth password
ApiClient apiClient = new ApiClient("oauth_password");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setOauthPassword("username", "password", "client_id", "client_secret");
//Oauth client credentials flow
ApiClient apiClient = new ApiClient("oauth_client_credentials");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setClientCredentials("client_id", "client_secret");
PetApi petApi = apiClient.buildClient(PetApi.class);
Pet petById = petApi.getPetById(12345L);
System.out.println(petById);
}
Recommendation
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.