|
| 1 | +# openapi-java-client |
| 2 | + |
| 3 | +OpenAPI Petstore |
| 4 | +- API version: 1.0.0 |
| 5 | + - Generator version: 7.6.0-SNAPSHOT |
| 6 | + |
| 7 | +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. |
| 8 | + |
| 9 | + |
| 10 | +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* |
| 11 | + |
| 12 | + |
| 13 | +## Requirements |
| 14 | + |
| 15 | +Building the API client library requires: |
| 16 | +1. Java 1.8+ |
| 17 | +2. Maven (3.8.3+)/Gradle (7.2+) |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +To install the API client library to your local Maven repository, simply execute: |
| 22 | + |
| 23 | +```shell |
| 24 | +mvn clean install |
| 25 | +``` |
| 26 | + |
| 27 | +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: |
| 28 | + |
| 29 | +```shell |
| 30 | +mvn clean deploy |
| 31 | +``` |
| 32 | + |
| 33 | +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. |
| 34 | + |
| 35 | +### Maven users |
| 36 | + |
| 37 | +Add this dependency to your project's POM: |
| 38 | + |
| 39 | +```xml |
| 40 | +<dependency> |
| 41 | + <groupId>org.openapitools</groupId> |
| 42 | + <artifactId>openapi-java-client</artifactId> |
| 43 | + <version>1.0.0</version> |
| 44 | + <scope>compile</scope> |
| 45 | +</dependency> |
| 46 | +``` |
| 47 | + |
| 48 | +### Gradle users |
| 49 | + |
| 50 | +Add this dependency to your project's build file: |
| 51 | + |
| 52 | +```groovy |
| 53 | + repositories { |
| 54 | + mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central. |
| 55 | + mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo. |
| 56 | + } |
| 57 | +
|
| 58 | + dependencies { |
| 59 | + implementation "org.openapitools:openapi-java-client:1.0.0" |
| 60 | + } |
| 61 | +``` |
| 62 | + |
| 63 | +### Others |
| 64 | + |
| 65 | +At first generate the JAR by executing: |
| 66 | + |
| 67 | +```shell |
| 68 | +mvn clean package |
| 69 | +``` |
| 70 | + |
| 71 | +Then manually install the following JARs: |
| 72 | + |
| 73 | +* `target/openapi-java-client-1.0.0.jar` |
| 74 | +* `target/lib/*.jar` |
| 75 | + |
| 76 | +## Getting Started |
| 77 | + |
| 78 | +Please follow the [installation](#installation) instruction and execute the following Java code: |
| 79 | + |
| 80 | +```java |
| 81 | + |
| 82 | +// Import classes: |
| 83 | +import org.openapitools.client.ApiClient; |
| 84 | +import org.openapitools.client.ApiException; |
| 85 | +import org.openapitools.client.Configuration; |
| 86 | +import org.openapitools.client.auth.*; |
| 87 | +import org.openapitools.client.models.*; |
| 88 | +import org.openapitools.client.api.PetApi; |
| 89 | + |
| 90 | +public class Example { |
| 91 | + public static void main(String[] args) { |
| 92 | + ApiClient defaultClient = Configuration.getDefaultApiClient(); |
| 93 | + defaultClient.setBasePath("http://petstore.swagger.io/v2"); |
| 94 | + |
| 95 | + // Configure OAuth2 access token for authorization: petstore_auth |
| 96 | + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); |
| 97 | + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); |
| 98 | + |
| 99 | + PetApi apiInstance = new PetApi(defaultClient); |
| 100 | + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store |
| 101 | + try { |
| 102 | + Pet result = apiInstance.addPet(pet); |
| 103 | + System.out.println(result); |
| 104 | + } catch (ApiException e) { |
| 105 | + System.err.println("Exception when calling PetApi#addPet"); |
| 106 | + System.err.println("Status code: " + e.getCode()); |
| 107 | + System.err.println("Reason: " + e.getResponseBody()); |
| 108 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 109 | + e.printStackTrace(); |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +``` |
| 115 | + |
| 116 | +## Documentation for API Endpoints |
| 117 | + |
| 118 | +All URIs are relative to *http://petstore.swagger.io/v2* |
| 119 | + |
| 120 | +Class | Method | HTTP request | Description |
| 121 | +------------ | ------------- | ------------- | ------------- |
| 122 | +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store |
| 123 | +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet |
| 124 | +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status |
| 125 | +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags |
| 126 | +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID |
| 127 | +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet |
| 128 | +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data |
| 129 | +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image |
| 130 | +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID |
| 131 | +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status |
| 132 | +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID |
| 133 | +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet |
| 134 | +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user |
| 135 | +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array |
| 136 | +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array |
| 137 | +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user |
| 138 | +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name |
| 139 | +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system |
| 140 | +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session |
| 141 | +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user |
| 142 | + |
| 143 | + |
| 144 | +## Documentation for Models |
| 145 | + |
| 146 | + - [Category](docs/Category.md) |
| 147 | + - [ModelApiResponse](docs/ModelApiResponse.md) |
| 148 | + - [Order](docs/Order.md) |
| 149 | + - [Pet](docs/Pet.md) |
| 150 | + - [Tag](docs/Tag.md) |
| 151 | + - [User](docs/User.md) |
| 152 | + |
| 153 | + |
| 154 | +<a id="documentation-for-authorization"></a> |
| 155 | +## Documentation for Authorization |
| 156 | + |
| 157 | + |
| 158 | +Authentication schemes defined for the API: |
| 159 | +<a id="petstore_auth"></a> |
| 160 | +### petstore_auth |
| 161 | + |
| 162 | +- **Type**: OAuth |
| 163 | +- **Flow**: implicit |
| 164 | +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog |
| 165 | +- **Scopes**: |
| 166 | + - write:pets: modify pets in your account |
| 167 | + - read:pets: read your pets |
| 168 | + |
| 169 | +<a id="api_key"></a> |
| 170 | +### api_key |
| 171 | + |
| 172 | +- **Type**: API key |
| 173 | +- **API key parameter name**: api_key |
| 174 | +- **Location**: HTTP header |
| 175 | + |
| 176 | + |
| 177 | +## Recommendation |
| 178 | + |
| 179 | +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. |
| 180 | + |
| 181 | +## Author |
| 182 | + |
| 183 | + |
| 184 | + |
0 commit comments