Skip to content

Commit d82a552

Browse files
committed
updated java jersey2 sample
1 parent f8917c7 commit d82a552

File tree

12 files changed

+366
-2
lines changed

12 files changed

+366
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AllPetsResponse
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# OneOfAllPetsResponseItems
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# OneOfSinglePetResponsePet
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------

samples/client/petstore/java/jersey2/docs/PetApi.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Method | HTTP request | Description
88
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
99
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
1010
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
11+
[**getAllPets**](PetApi.md#getAllPets) | **GET** /allPets |
1112
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
13+
[**getRandomPet**](PetApi.md#getRandomPet) | **GET** /randomPet |
1214
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
1315
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
1416
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
@@ -221,6 +223,45 @@ Name | Type | Description | Notes
221223
- **Content-Type**: Not defined
222224
- **Accept**: application/xml, application/json
223225

226+
<a name="getAllPets"></a>
227+
# **getAllPets**
228+
> AllPetsResponse getAllPets()
229+
230+
231+
232+
### Example
233+
```java
234+
// Import classes:
235+
//import io.swagger.client.ApiException;
236+
//import io.swagger.client.api.PetApi;
237+
238+
239+
PetApi apiInstance = new PetApi();
240+
try {
241+
AllPetsResponse result = apiInstance.getAllPets();
242+
System.out.println(result);
243+
} catch (ApiException e) {
244+
System.err.println("Exception when calling PetApi#getAllPets");
245+
e.printStackTrace();
246+
}
247+
```
248+
249+
### Parameters
250+
This endpoint does not need any parameter.
251+
252+
### Return type
253+
254+
[**AllPetsResponse**](AllPetsResponse.md)
255+
256+
### Authorization
257+
258+
No authorization required
259+
260+
### HTTP request headers
261+
262+
- **Content-Type**: Not defined
263+
- **Accept**: application/json
264+
224265
<a name="getPetById"></a>
225266
# **getPetById**
226267
> Pet getPetById(petId)
@@ -276,6 +317,45 @@ Name | Type | Description | Notes
276317
- **Content-Type**: Not defined
277318
- **Accept**: application/xml, application/json
278319

320+
<a name="getRandomPet"></a>
321+
# **getRandomPet**
322+
> SinglePetResponse getRandomPet()
323+
324+
325+
326+
### Example
327+
```java
328+
// Import classes:
329+
//import io.swagger.client.ApiException;
330+
//import io.swagger.client.api.PetApi;
331+
332+
333+
PetApi apiInstance = new PetApi();
334+
try {
335+
SinglePetResponse result = apiInstance.getRandomPet();
336+
System.out.println(result);
337+
} catch (ApiException e) {
338+
System.err.println("Exception when calling PetApi#getRandomPet");
339+
e.printStackTrace();
340+
}
341+
```
342+
343+
### Parameters
344+
This endpoint does not need any parameter.
345+
346+
### Return type
347+
348+
[**SinglePetResponse**](SinglePetResponse.md)
349+
350+
### Authorization
351+
352+
No authorization required
353+
354+
### HTTP request headers
355+
356+
- **Content-Type**: Not defined
357+
- **Accept**: application/json
358+
279359
<a name="updatePet"></a>
280360
# **updatePet**
281361
> updatePet(body)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SinglePetResponse
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**pet** | [**OneOfSinglePetResponsePet**](.md) | | [optional]

samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
import javax.ws.rs.core.GenericType;
99

10+
import io.swagger.client.model.AllPetsResponse;
1011
import java.io.File;
1112
import io.swagger.client.model.ModelApiResponse;
1213
import io.swagger.client.model.Pet;
14+
import io.swagger.client.model.SinglePetResponse;
1315

1416
import java.util.ArrayList;
1517
import java.util.HashMap;
@@ -195,6 +197,40 @@ public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
195197
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
196198
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
197199
}
200+
/**
201+
*
202+
*
203+
* @return AllPetsResponse
204+
* @throws ApiException if fails to make API call
205+
*/
206+
public AllPetsResponse getAllPets() throws ApiException {
207+
Object localVarPostBody = null;
208+
// create path and map variables
209+
String localVarPath = "/allPets";
210+
211+
// query params
212+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
213+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
214+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
215+
216+
217+
218+
219+
final String[] localVarAccepts = {
220+
"application/json"
221+
};
222+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
223+
224+
final String[] localVarContentTypes = {
225+
226+
};
227+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
228+
229+
String[] localVarAuthNames = new String[] { };
230+
231+
GenericType<AllPetsResponse> localVarReturnType = new GenericType<AllPetsResponse>() {};
232+
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
233+
}
198234
/**
199235
* Find pet by ID
200236
* Returns a single pet
@@ -235,6 +271,40 @@ public Pet getPetById(Long petId) throws ApiException {
235271
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
236272
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
237273
}
274+
/**
275+
*
276+
*
277+
* @return SinglePetResponse
278+
* @throws ApiException if fails to make API call
279+
*/
280+
public SinglePetResponse getRandomPet() throws ApiException {
281+
Object localVarPostBody = null;
282+
// create path and map variables
283+
String localVarPath = "/randomPet";
284+
285+
// query params
286+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
287+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
288+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
289+
290+
291+
292+
293+
final String[] localVarAccepts = {
294+
"application/json"
295+
};
296+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
297+
298+
final String[] localVarContentTypes = {
299+
300+
};
301+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
302+
303+
String[] localVarAuthNames = new String[] { };
304+
305+
GenericType<SinglePetResponse> localVarReturnType = new GenericType<SinglePetResponse>() {};
306+
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
307+
}
238308
/**
239309
* Update an existing pet
240310
*
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import io.swagger.client.model.OneOfAllPetsResponseItems;
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
/**
21+
* AllPetsResponse
22+
*/
23+
24+
25+
public class AllPetsResponse extends ArrayList<OneOfAllPetsResponseItems> {
26+
27+
@Override
28+
public boolean equals(java.lang.Object o) {
29+
if (this == o) {
30+
return true;
31+
}
32+
if (o == null || getClass() != o.getClass()) {
33+
return false;
34+
}
35+
return super.equals(o);
36+
}
37+
38+
@Override
39+
public int hashCode() {
40+
return Objects.hash(super.hashCode());
41+
}
42+
43+
44+
@Override
45+
public String toString() {
46+
StringBuilder sb = new StringBuilder();
47+
sb.append("class AllPetsResponse {\n");
48+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
49+
sb.append("}");
50+
return sb.toString();
51+
}
52+
53+
/**
54+
* Convert the given object to string with each line indented by 4 spaces
55+
* (except the first line).
56+
*/
57+
private String toIndentedString(java.lang.Object o) {
58+
if (o == null) {
59+
return "null";
60+
}
61+
return o.toString().replace("\n", "\n ");
62+
}
63+
64+
}

samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626

27-
public class Cat extends Animal {
27+
public class Cat extends Animal implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
2828
@JsonProperty("declawed")
2929
private Boolean declawed = null;
3030

samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626

27-
public class Dog extends Animal {
27+
public class Dog extends Animal implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
2828
@JsonProperty("breed")
2929
private String breed = null;
3030

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
/**
16+
* OneOfAllPetsResponseItems
17+
*/
18+
public interface OneOfAllPetsResponseItems {
19+
20+
}

0 commit comments

Comments
 (0)