forked from loafle/openapi-generator-original
commit c5a0d0f7394aa742fa336fff7e7c1d3049761868 Merge: 8c4991ba3ed f8ff8c87609 Author: William Cheng <wing328hk@gmail.com> Date: Tue Aug 17 18:28:12 2021 +0800 Merge branch 'mustache-linting' of https://github.com/NathanBaulch/openapi-generator into NathanBaulch-mustache-linting commit f8ff8c87609b1ca36fa26fb8474806999638195e Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Thu Aug 5 14:12:47 2021 +1000 Reorder tags that handle missing values commit f5d8a33709d6a3f846a9fe4520b78c3d637051d9 Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Thu Aug 5 14:08:59 2021 +1000 Use dot notation where possible commit 493d14921e2333f3ae19ef6fc89318b7e263a80c Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Thu Aug 5 14:10:49 2021 +1000 Remove empty tags commit 32480dc53f48227d55531b94e307d72671373737 Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Thu Aug 5 10:41:58 2021 +1000 Remove redundant sections commit a8edabd722c34aa094b4aeb11c22664529c3a219 Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Wed Aug 4 22:02:22 2021 +1000 Trim extra EOF new lines commit e89bd7458e3594bf0d30e580bc9408e45b018a57 Author: Nathan Baulch <nathan.baulch@gmail.com> Date: Wed Aug 4 21:59:26 2021 +1000 Trim trailing whitespace
2.2 KiB
2.2 KiB
petstore-feign-no-nullable
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>petstore-feign-no-nullable</artifactId>
<version>1.0.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.