Skip to content

Commit 1fb2a97

Browse files
committed
Revert "Regenerate Android-Java sample"
This reverts commit 15f5eae.
1 parent 15f5eae commit 1fb2a97

File tree

12 files changed

+27
-196
lines changed

12 files changed

+27
-196
lines changed

samples/client/petstore/android-java/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
21
group = 'io.swagger'
32
project.version = '1.0.0'
43

5-
64
buildscript {
75
repositories {
86
jcenter()
@@ -23,10 +21,8 @@ allprojects {
2321

2422

2523
apply plugin: 'com.android.library'
26-
2724
apply plugin: 'com.github.dcendents.android-maven'
2825

29-
3026
android {
3127
compileSdkVersion 22
3228
buildToolsVersion '22.0.0'
@@ -85,7 +81,6 @@ afterEvaluate {
8581
}
8682
}
8783

88-
8984
task sourcesJar(type: Jar) {
9085
from android.sourceSets.main.java.srcDirs
9186
classifier = 'sources'
@@ -94,4 +89,3 @@ task sourcesJar(type: Jar) {
9489
artifacts {
9590
archives sourcesJar
9691
}
97-

samples/client/petstore/android-java/src/main/java/io/swagger/client/ApiInvoker.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,8 @@ else if ("PATCH".equals(method)) {
365365

366366
int code = response.getStatusLine().getStatusCode();
367367
String responseString = null;
368-
if(code == 204) {
368+
if(code == 204)
369369
responseString = "";
370-
return responseString;
371-
}
372370
else if(code >= 200 && code < 300) {
373371
if(response.getEntity() != null) {
374372
HttpEntity resEntity = response.getEntity();

samples/client/petstore/android-java/src/main/java/io/swagger/client/JsonUtil.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public static <T> T deserializeToObject(String jsonString, Class cls){
3535
public static Type getListTypeForDeserialization(Class cls) {
3636
String className = cls.getSimpleName();
3737

38-
if ("Order".equalsIgnoreCase(className)) {
39-
return new TypeToken<List<Order>>(){}.getType();
40-
}
41-
4238
if ("User".equalsIgnoreCase(className)) {
4339
return new TypeToken<List<User>>(){}.getType();
4440
}
@@ -47,16 +43,16 @@ public static Type getListTypeForDeserialization(Class cls) {
4743
return new TypeToken<List<Category>>(){}.getType();
4844
}
4945

50-
if ("Tag".equalsIgnoreCase(className)) {
51-
return new TypeToken<List<Tag>>(){}.getType();
52-
}
53-
5446
if ("Pet".equalsIgnoreCase(className)) {
5547
return new TypeToken<List<Pet>>(){}.getType();
5648
}
5749

58-
if ("ApiResponse".equalsIgnoreCase(className)) {
59-
return new TypeToken<List<ApiResponse>>(){}.getType();
50+
if ("Tag".equalsIgnoreCase(className)) {
51+
return new TypeToken<List<Tag>>(){}.getType();
52+
}
53+
54+
if ("Order".equalsIgnoreCase(className)) {
55+
return new TypeToken<List<Order>>(){}.getType();
6056
}
6157

6258
return new TypeToken<List<Object>>(){}.getType();
@@ -65,10 +61,6 @@ public static Type getListTypeForDeserialization(Class cls) {
6561
public static Type getTypeForDeserialization(Class cls) {
6662
String className = cls.getSimpleName();
6763

68-
if ("Order".equalsIgnoreCase(className)) {
69-
return new TypeToken<Order>(){}.getType();
70-
}
71-
7264
if ("User".equalsIgnoreCase(className)) {
7365
return new TypeToken<User>(){}.getType();
7466
}
@@ -77,16 +69,16 @@ public static Type getTypeForDeserialization(Class cls) {
7769
return new TypeToken<Category>(){}.getType();
7870
}
7971

80-
if ("Tag".equalsIgnoreCase(className)) {
81-
return new TypeToken<Tag>(){}.getType();
82-
}
83-
8472
if ("Pet".equalsIgnoreCase(className)) {
8573
return new TypeToken<Pet>(){}.getType();
8674
}
8775

88-
if ("ApiResponse".equalsIgnoreCase(className)) {
89-
return new TypeToken<ApiResponse>(){}.getType();
76+
if ("Tag".equalsIgnoreCase(className)) {
77+
return new TypeToken<Tag>(){}.getType();
78+
}
79+
80+
if ("Order".equalsIgnoreCase(className)) {
81+
return new TypeToken<Order>(){}.getType();
9082
}
9183

9284
return new TypeToken<Object>(){}.getType();

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

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
import io.swagger.client.model.Pet;
1212
import java.io.File;
13-
import io.swagger.client.model.ApiResponse;
14-
1513

1614
import org.apache.http.HttpEntity;
1715
import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -20,7 +18,6 @@
2018
import java.util.HashMap;
2119
import java.io.File;
2220

23-
2421
public class PetApi {
2522
String basePath = "http://petstore.swagger.io/v2";
2623
ApiInvoker apiInvoker = ApiInvoker.getInstance();
@@ -51,11 +48,6 @@ public String getBasePath() {
5148
public void updatePet (Pet body) throws ApiException {
5249
Object postBody = body;
5350

54-
// verify the required parameter 'body' is set
55-
if (body == null) {
56-
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet");
57-
}
58-
5951

6052
// create path and map variables
6153
String path = "/pet".replaceAll("\\{format\\}","json");
@@ -110,11 +102,6 @@ public void updatePet (Pet body) throws ApiException {
110102
public void addPet (Pet body) throws ApiException {
111103
Object postBody = body;
112104

113-
// verify the required parameter 'body' is set
114-
if (body == null) {
115-
throw new ApiException(400, "Missing the required parameter 'body' when calling addPet");
116-
}
117-
118105

119106
// create path and map variables
120107
String path = "/pet".replaceAll("\\{format\\}","json");
@@ -169,11 +156,6 @@ public void addPet (Pet body) throws ApiException {
169156
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
170157
Object postBody = null;
171158

172-
// verify the required parameter 'status' is set
173-
if (status == null) {
174-
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
175-
}
176-
177159

178160
// create path and map variables
179161
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
@@ -186,7 +168,7 @@ public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
186168
Map<String, String> formParams = new HashMap<String, String>();
187169

188170

189-
queryParams.addAll(ApiInvoker.parameterToPairs("csv", "status", status));
171+
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
190172

191173

192174

@@ -230,11 +212,6 @@ public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
230212
public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
231213
Object postBody = null;
232214

233-
// verify the required parameter 'tags' is set
234-
if (tags == null) {
235-
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
236-
}
237-
238215

239216
// create path and map variables
240217
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
@@ -247,7 +224,7 @@ public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
247224
Map<String, String> formParams = new HashMap<String, String>();
248225

249226

250-
queryParams.addAll(ApiInvoker.parameterToPairs("csv", "tags", tags));
227+
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
251228

252229

253230

@@ -284,8 +261,8 @@ public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
284261

285262
/**
286263
* Find pet by ID
287-
* Returns a single pet
288-
* @param petId ID of pet to return
264+
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
265+
* @param petId ID of pet that needs to be fetched
289266
* @return Pet
290267
*/
291268
public Pet getPetById (Long petId) throws ApiException {
@@ -349,7 +326,7 @@ public Pet getPetById (Long petId) throws ApiException {
349326
* @param status Updated status of the pet
350327
* @return void
351328
*/
352-
public void updatePetWithForm (Long petId, String name, String status) throws ApiException {
329+
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
353330
Object postBody = null;
354331

355332
// verify the required parameter 'petId' is set
@@ -480,9 +457,9 @@ public void deletePet (Long petId, String apiKey) throws ApiException {
480457
* @param petId ID of pet to update
481458
* @param additionalMetadata Additional data to pass to server
482459
* @param file file to upload
483-
* @return ApiResponse
460+
* @return void
484461
*/
485-
public ApiResponse uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
462+
public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
486463
Object postBody = null;
487464

488465
// verify the required parameter 'petId' is set
@@ -535,15 +512,14 @@ public ApiResponse uploadFile (Long petId, String additionalMetadata, File file
535512
try {
536513
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
537514
if(response != null){
538-
return (ApiResponse) ApiInvoker.deserialize(response, "", ApiResponse.class);
515+
return ;
539516
}
540517
else {
541-
return null;
518+
return ;
542519
}
543520
} catch (ApiException ex) {
544521
throw ex;
545522
}
546523
}
547524

548525
}
549-

samples/client/petstore/android-java/src/main/java/io/swagger/client/api/StoreApi.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
import java.util.Map;
1212
import io.swagger.client.model.Order;
1313

14-
1514
import org.apache.http.HttpEntity;
1615
import org.apache.http.entity.mime.MultipartEntityBuilder;
1716

1817
import java.util.Map;
1918
import java.util.HashMap;
2019
import java.io.File;
2120

22-
2321
public class StoreApi {
2422
String basePath = "http://petstore.swagger.io/v2";
2523
ApiInvoker apiInvoker = ApiInvoker.getInstance();
@@ -103,11 +101,6 @@ public Map<String, Integer> getInventory () throws ApiException {
103101
public Order placeOrder (Order body) throws ApiException {
104102
Object postBody = body;
105103

106-
// verify the required parameter 'body' is set
107-
if (body == null) {
108-
throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder");
109-
}
110-
111104

112105
// create path and map variables
113106
String path = "/store/order".replaceAll("\\{format\\}","json");
@@ -159,7 +152,7 @@ public Order placeOrder (Order body) throws ApiException {
159152
* @param orderId ID of pet that needs to be fetched
160153
* @return Order
161154
*/
162-
public Order getOrderById (Long orderId) throws ApiException {
155+
public Order getOrderById (String orderId) throws ApiException {
163156
Object postBody = null;
164157

165158
// verify the required parameter 'orderId' is set
@@ -272,4 +265,3 @@ public void deleteOrder (String orderId) throws ApiException {
272265
}
273266

274267
}
275-

samples/client/petstore/android-java/src/main/java/io/swagger/client/api/UserApi.java

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
import io.swagger.client.model.User;
1212
import java.util.*;
1313

14-
1514
import org.apache.http.HttpEntity;
1615
import org.apache.http.entity.mime.MultipartEntityBuilder;
1716

1817
import java.util.Map;
1918
import java.util.HashMap;
2019
import java.io.File;
2120

22-
2321
public class UserApi {
2422
String basePath = "http://petstore.swagger.io/v2";
2523
ApiInvoker apiInvoker = ApiInvoker.getInstance();
@@ -50,11 +48,6 @@ public String getBasePath() {
5048
public void createUser (User body) throws ApiException {
5149
Object postBody = body;
5250

53-
// verify the required parameter 'body' is set
54-
if (body == null) {
55-
throw new ApiException(400, "Missing the required parameter 'body' when calling createUser");
56-
}
57-
5851

5952
// create path and map variables
6053
String path = "/user".replaceAll("\\{format\\}","json");
@@ -109,11 +102,6 @@ public void createUser (User body) throws ApiException {
109102
public void createUsersWithArrayInput (List<User> body) throws ApiException {
110103
Object postBody = body;
111104

112-
// verify the required parameter 'body' is set
113-
if (body == null) {
114-
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput");
115-
}
116-
117105

118106
// create path and map variables
119107
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
@@ -168,11 +156,6 @@ public void createUsersWithArrayInput (List<User> body) throws ApiException {
168156
public void createUsersWithListInput (List<User> body) throws ApiException {
169157
Object postBody = body;
170158

171-
// verify the required parameter 'body' is set
172-
if (body == null) {
173-
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput");
174-
}
175-
176159

177160
// create path and map variables
178161
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
@@ -228,16 +211,6 @@ public void createUsersWithListInput (List<User> body) throws ApiException {
228211
public String loginUser (String username, String password) throws ApiException {
229212
Object postBody = null;
230213

231-
// verify the required parameter 'username' is set
232-
if (username == null) {
233-
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
234-
}
235-
236-
// verify the required parameter 'password' is set
237-
if (password == null) {
238-
throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");
239-
}
240-
241214

242215
// create path and map variables
243216
String path = "/user/login".replaceAll("\\{format\\}","json");
@@ -343,7 +316,7 @@ public void logoutUser () throws ApiException {
343316
/**
344317
* Get user by user name
345318
*
346-
* @param username The name that needs to be fetched. Use user1 for testing.
319+
* @param username The name that needs to be fetched. Use user1 for testing.
347320
* @return User
348321
*/
349322
public User getUserByName (String username) throws ApiException {
@@ -414,11 +387,6 @@ public void updateUser (String username, User body) throws ApiException {
414387
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
415388
}
416389

417-
// verify the required parameter 'body' is set
418-
if (body == null) {
419-
throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser");
420-
}
421-
422390

423391
// create path and map variables
424392
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
@@ -524,4 +492,3 @@ public void deleteUser (String username) throws ApiException {
524492
}
525493

526494
}
527-

0 commit comments

Comments
 (0)