From 1522069281656d1173494d2b8a488dd9d8d6ab12 Mon Sep 17 00:00:00 2001 From: Rob Blair Date: Mon, 25 Aug 2014 17:31:41 -0700 Subject: [PATCH 1/2] Regenerate the java code before modifying templates --- .../java/com/wordnik/petstore/api/PetApi.java | 92 ++++++------- .../com/wordnik/petstore/api/StoreApi.java | 34 ++--- .../com/wordnik/petstore/api/UserApi.java | 12 +- .../java/com/wordnik/petstore/api/PetApi.java | 58 ++++---- .../com/wordnik/petstore/api/StoreApi.java | 42 +++--- .../com/wordnik/petstore/api/UserApi.java | 126 +++++++++--------- 6 files changed, 182 insertions(+), 182 deletions(-) diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java index 2ee047357a3..d1cb4ed0787 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java @@ -59,8 +59,8 @@ public Pet getPetById (Long petId) throws ApiException { } } } - //error info- code: 400 reason: "Invalid pet value" model: - public void deletePet (String petId) throws ApiException { + //error info- code: 405 reason: "Invalid input" model: + public void updatePetWithForm (String petId, String name, String status) throws ApiException { // verify required params are set if(petId == null ) { throw new ApiException(400, "missing required params"); @@ -75,7 +75,7 @@ public void deletePet (String petId) throws ApiException { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); if(response != null){ return ; } @@ -91,40 +91,8 @@ public void deletePet (String petId) throws ApiException { } } } - //error info- code: 400 reason: "Invalid tag value" model: - public List partialUpdate (String petId, Pet body) throws ApiException { - // verify required params are set - if(petId == null || body == null ) { - throw new ApiException(400, "missing required params"); - } - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, contentType); - if(response != null){ - return (List) ApiInvoker.deserialize(response, "Array", Pet.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return null; - } - else { - throw ex; - } - } - } - //error info- code: 405 reason: "Invalid input" model: - public void updatePetWithForm (String petId, String name, String status) throws ApiException { + //error info- code: 400 reason: "Invalid pet value" model: + public void deletePet (String petId) throws ApiException { // verify required params are set if(petId == null ) { throw new ApiException(400, "missing required params"); @@ -139,7 +107,7 @@ public void updatePetWithForm (String petId, String name, String status) throws String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType); if(response != null){ return ; } @@ -155,9 +123,14 @@ public void updatePetWithForm (String petId, String name, String status) throws } } } - public void uploadFile (String additionalMetadata, File body) throws ApiException { + //error info- code: 400 reason: "Invalid tag value" model: + public List partialUpdate (String petId, Pet body) throws ApiException { + // verify required params are set + if(petId == null || body == null ) { + throw new ApiException(400, "missing required params"); + } // create path and map variables - String path = "/pet/uploadImage".replaceAll("\\{format\\}","json"); + String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); // query params Map queryParams = new HashMap(); @@ -166,16 +139,16 @@ public void uploadFile (String additionalMetadata, File body) throws ApiExceptio String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, contentType); if(response != null){ - return ; + return (List) ApiInvoker.deserialize(response, "List", Pet.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; @@ -268,7 +241,7 @@ public List findPetsByStatus (String status) throws ApiException { try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); if(response != null){ - return (List) ApiInvoker.deserialize(response, "Array", Pet.class); + return (List) ApiInvoker.deserialize(response, "List", Pet.class); } else { return null; @@ -302,7 +275,7 @@ public List findPetsByTags (String tags) throws ApiException { try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); if(response != null){ - return (List) ApiInvoker.deserialize(response, "Array", Pet.class); + return (List) ApiInvoker.deserialize(response, "List", Pet.class); } else { return null; @@ -316,5 +289,32 @@ public List findPetsByTags (String tags) throws ApiException { } } } + public void uploadFile (String additionalMetadata, File file) throws ApiException { + // create path and map variables + String path = "/pet/uploadImage".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/StoreApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/StoreApi.java index 17501e11427..6ec0d4d7e2c 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/StoreApi.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/StoreApi.java @@ -26,15 +26,14 @@ public String getBasePath() { return basePath; } - //error info- code: 400 reason: "Invalid ID supplied" model: - //error info- code: 404 reason: "Order not found" model: - public Order getOrderById (String orderId) throws ApiException { + //error info- code: 400 reason: "Invalid order" model: + public void placeOrder (Order body) throws ApiException { // verify required params are set - if(orderId == null ) { + if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + String path = "/store/order".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -43,16 +42,16 @@ public Order getOrderById (String orderId) throws ApiException { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType); if(response != null){ - return (Order) ApiInvoker.deserialize(response, "", Order.class); + return ; } else { - return null; + return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return null; + return ; } else { throw ex; @@ -92,14 +91,15 @@ public void deleteOrder (String orderId) throws ApiException { } } } - //error info- code: 400 reason: "Invalid order" model: - public void placeOrder (Order body) throws ApiException { + //error info- code: 400 reason: "Invalid ID supplied" model: + //error info- code: 404 reason: "Order not found" model: + public Order getOrderById (String orderId) throws ApiException { // verify required params are set - if(body == null ) { + if(orderId == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/store/order".replaceAll("\\{format\\}","json"); + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); // query params Map queryParams = new HashMap(); @@ -108,16 +108,16 @@ public void placeOrder (Order body) throws ApiException { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); if(response != null){ - return ; + return (Order) ApiInvoker.deserialize(response, "", Order.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/UserApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/UserApi.java index d2ab87c37d9..a489a79836c 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/UserApi.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/UserApi.java @@ -188,13 +188,13 @@ public void logoutUser () throws ApiException { } } } - public void createUser (User body) throws ApiException { + public void createUsersWithArrayInput (List body) throws ApiException { // verify required params are set if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user".replaceAll("\\{format\\}","json"); + String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -219,13 +219,13 @@ public void createUser (User body) throws ApiException { } } } - public void createUsersWithArrayInput (List body) throws ApiException { + public void createUsersWithListInput (List body) throws ApiException { // verify required params are set if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); + String path = "/user/createWithList".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -250,13 +250,13 @@ public void createUsersWithArrayInput (List body) throws ApiException { } } } - public void createUsersWithListInput (List body) throws ApiException { + public void createUser (User body) throws ApiException { // verify required params are set if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/createWithList".replaceAll("\\{format\\}","json"); + String path = "/user".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java index fe712c967c8..5331ebfac9a 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java @@ -74,8 +74,8 @@ public Pet getPetById (Long petId) throws ApiException { } } } - //error info- code: 400 reason: "Invalid pet value" model: - public void deletePet (String petId) throws ApiException { + //error info- code: 405 reason: "Invalid input" model: + public void updatePetWithForm (String petId, String name, String status) throws ApiException { Object postBody = null; // verify required params are set if(petId == null ) { @@ -90,21 +90,25 @@ public void deletePet (String petId) throws ApiException { Map formParams = new HashMap(); String[] contentTypes = { - "application/json"}; + "application/x-www-form-urlencoded"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); + hasFields = true; + mp.field("name", name, MediaType.MULTIPART_FORM_DATA_TYPE); + hasFields = true; + mp.field("status", status, MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) postBody = mp; } else { - } + formParams.put("name", name);formParams.put("status", status);} try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } @@ -120,11 +124,11 @@ public void deletePet (String petId) throws ApiException { } } } - //error info- code: 400 reason: "Invalid tag value" model: - public List partialUpdate (String petId, Pet body) throws ApiException { - Object postBody = body; + //error info- code: 400 reason: "Invalid pet value" model: + public void deletePet (String petId) throws ApiException { + Object postBody = null; // verify required params are set - if(petId == null || body == null ) { + if(petId == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables @@ -136,7 +140,7 @@ public List partialUpdate (String petId, Pet body) throws ApiException { Map formParams = new HashMap(); String[] contentTypes = { - "application/json","application/xml"}; + "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -150,27 +154,27 @@ public List partialUpdate (String petId, Pet body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return (List) ApiInvoker.deserialize(response, "List", Pet.class); + return ; } else { - return null; + return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return null; + return ; } else { throw ex; } } } - //error info- code: 405 reason: "Invalid input" model: - public void updatePetWithForm (String petId, String name, String status) throws ApiException { - Object postBody = null; + //error info- code: 400 reason: "Invalid tag value" model: + public List partialUpdate (String petId, Pet body) throws ApiException { + Object postBody = body; // verify required params are set - if(petId == null ) { + if(petId == null || body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables @@ -182,34 +186,30 @@ public void updatePetWithForm (String petId, String name, String status) throws Map formParams = new HashMap(); String[] contentTypes = { - "application/x-www-form-urlencoded"}; + "application/json","application/xml"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); - hasFields = true; - mp.field("name", "name", MediaType.MULTIPART_FORM_DATA_TYPE); - hasFields = true; - mp.field("status", "status", MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) postBody = mp; } else { - formParams.put("name", name);formParams.put("status", status);} + } try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return ; + return (List) ApiInvoker.deserialize(response, "List", Pet.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; @@ -425,7 +425,7 @@ public void uploadFile (String additionalMetadata, File file) throws ApiExceptio boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); hasFields = true; - mp.field("additionalMetadata", "additionalMetadata", MediaType.MULTIPART_FORM_DATA_TYPE); + mp.field("additionalMetadata", additionalMetadata, MediaType.MULTIPART_FORM_DATA_TYPE); hasFields = true; mp.field("file", file, MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java index 57f0ba6c5f8..6346fd6bd6a 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java @@ -27,16 +27,15 @@ public String getBasePath() { return basePath; } - //error info- code: 400 reason: "Invalid ID supplied" model: - //error info- code: 404 reason: "Order not found" model: - public void deleteOrder (String orderId) throws ApiException { - Object postBody = null; + //error info- code: 400 reason: "Invalid order" model: + public void placeOrder (Order body) throws ApiException { + Object postBody = body; // verify required params are set - if(orderId == null ) { + if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + String path = "/store/order".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -58,7 +57,7 @@ public void deleteOrder (String orderId) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } @@ -76,7 +75,7 @@ public void deleteOrder (String orderId) throws ApiException { } //error info- code: 400 reason: "Invalid ID supplied" model: //error info- code: 404 reason: "Order not found" model: - public Order getOrderById (String orderId) throws ApiException { + public void deleteOrder (String orderId) throws ApiException { Object postBody = null; // verify required params are set if(orderId == null ) { @@ -105,31 +104,32 @@ public Order getOrderById (String orderId) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return (Order) ApiInvoker.deserialize(response, "", Order.class); + return ; } else { - return null; + return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return null; + return ; } else { throw ex; } } } - //error info- code: 400 reason: "Invalid order" model: - public void placeOrder (Order body) throws ApiException { - Object postBody = body; + //error info- code: 400 reason: "Invalid ID supplied" model: + //error info- code: 404 reason: "Order not found" model: + public Order getOrderById (String orderId) throws ApiException { + Object postBody = null; // verify required params are set - if(body == null ) { + if(orderId == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/store/order".replaceAll("\\{format\\}","json"); + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); // query params Map queryParams = new HashMap(); @@ -151,16 +151,16 @@ public void placeOrder (Order body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return ; + return (Order) ApiInvoker.deserialize(response, "", Order.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java index 27ce460f7bb..15c43547461 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java @@ -27,14 +27,16 @@ public String getBasePath() { return basePath; } - public void createUsersWithArrayInput (List body) throws ApiException { + //error info- code: 400 reason: "Invalid username supplied" model: + //error info- code: 404 reason: "User not found" model: + public void updateUser (String username, User body) throws ApiException { Object postBody = body; // verify required params are set - if(body == null ) { + if(username == null || body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); @@ -56,7 +58,7 @@ public void createUsersWithArrayInput (List body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } @@ -72,14 +74,16 @@ public void createUsersWithArrayInput (List body) throws ApiException { } } } - public void createUsersWithListInput (List body) throws ApiException { - Object postBody = body; + //error info- code: 400 reason: "Invalid username supplied" model: + //error info- code: 404 reason: "User not found" model: + public void deleteUser (String username) throws ApiException { + Object postBody = null; // verify required params are set - if(body == null ) { + if(username == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/createWithList".replaceAll("\\{format\\}","json"); + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); @@ -101,7 +105,7 @@ public void createUsersWithListInput (List body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } @@ -117,14 +121,16 @@ public void createUsersWithListInput (List body) throws ApiException { } } } - public void createUser (User body) throws ApiException { - Object postBody = body; + //error info- code: 400 reason: "Invalid username supplied" model: + //error info- code: 404 reason: "User not found" model: + public User getUserByName (String username) throws ApiException { + Object postBody = null; // verify required params are set - if(body == null ) { + if(username == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user".replaceAll("\\{format\\}","json"); + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); @@ -146,38 +152,41 @@ public void createUser (User body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return ; + return (User) ApiInvoker.deserialize(response, "", User.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; } } } - //error info- code: 400 reason: "Invalid username supplied" model: - //error info- code: 404 reason: "User not found" model: - public void updateUser (String username, User body) throws ApiException { - Object postBody = body; + //error info- code: 400 reason: "Invalid username and password combination" model: + public String loginUser (String username, String password) throws ApiException { + Object postBody = null; // verify required params are set - if(username == null || body == null ) { + if(username == null || password == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + String path = "/user/login".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); + if(!"null".equals(String.valueOf(username))) + queryParams.put("username", String.valueOf(username)); + if(!"null".equals(String.valueOf(password))) + queryParams.put("password", String.valueOf(password)); String[] contentTypes = { "application/json"}; @@ -193,32 +202,26 @@ public void updateUser (String username, User body) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return ; + return (String) ApiInvoker.deserialize(response, "", String.class); } else { - return ; + return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return ; + return null; } else { throw ex; } } } - //error info- code: 400 reason: "Invalid username supplied" model: - //error info- code: 404 reason: "User not found" model: - public void deleteUser (String username) throws ApiException { + public void logoutUser () throws ApiException { Object postBody = null; - // verify required params are set - if(username == null ) { - throw new ApiException(400, "missing required params"); - } // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + String path = "/user/logout".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -240,7 +243,7 @@ public void deleteUser (String username) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } @@ -256,16 +259,14 @@ public void deleteUser (String username) throws ApiException { } } } - //error info- code: 400 reason: "Invalid username supplied" model: - //error info- code: 404 reason: "User not found" model: - public User getUserByName (String username) throws ApiException { - Object postBody = null; + public void createUsersWithArrayInput (List body) throws ApiException { + Object postBody = body; // verify required params are set - if(username == null ) { + if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -287,41 +288,36 @@ public User getUserByName (String username) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return (User) ApiInvoker.deserialize(response, "", User.class); + return ; } else { - return null; + return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return null; + return ; } else { throw ex; } } } - //error info- code: 400 reason: "Invalid username and password combination" model: - public String loginUser (String username, String password) throws ApiException { - Object postBody = null; + public void createUsersWithListInput (List body) throws ApiException { + Object postBody = body; // verify required params are set - if(username == null || password == null ) { + if(body == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables - String path = "/user/login".replaceAll("\\{format\\}","json"); + String path = "/user/createWithList".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); - if(!"null".equals(String.valueOf(username))) - queryParams.put("username", String.valueOf(username)); - if(!"null".equals(String.valueOf(password))) - queryParams.put("password", String.valueOf(password)); String[] contentTypes = { "application/json"}; @@ -337,26 +333,30 @@ public String loginUser (String username, String password) throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ - return (String) ApiInvoker.deserialize(response, "", String.class); + return ; } else { - return null; + return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { - return null; + return ; } else { throw ex; } } } - public void logoutUser () throws ApiException { - Object postBody = null; + public void createUser (User body) throws ApiException { + Object postBody = body; + // verify required params are set + if(body == null ) { + throw new ApiException(400, "missing required params"); + } // create path and map variables - String path = "/user/logout".replaceAll("\\{format\\}","json"); + String path = "/user".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); @@ -378,7 +378,7 @@ public void logoutUser () throws ApiException { } try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } From fc77521d49e700152a07a780d609c4aa58379f00 Mon Sep 17 00:00:00 2001 From: Rob Blair Date: Mon, 25 Aug 2014 17:37:36 -0700 Subject: [PATCH 2/2] Simplify java sample poms. * remove scala references from the java client pom template files. * regenerate the petstore sample pom.xml, verify they can build properly. --- samples/client/petstore/android-java/pom.xml | 62 -------------------- samples/client/petstore/java/pom.xml | 62 -------------------- src/main/resources/Java/pom.mustache | 62 -------------------- src/main/resources/android-java/pom.mustache | 62 -------------------- 4 files changed, 248 deletions(-) diff --git a/samples/client/petstore/android-java/pom.xml b/samples/client/petstore/android-java/pom.xml index 17001ba1cd1..8415a2b66cf 100644 --- a/samples/client/petstore/android-java/pom.xml +++ b/samples/client/petstore/android-java/pom.xml @@ -104,55 +104,8 @@ 1.6 - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - - compile - testCompile - - - - - - incremental - - - -Xmx384m - - - -target:jvm-1.5 - -deprecation - - - - run-scalatest - org.scalatest.tools.Runner - - -p - ${project.build.testOutputDirectory} - - - -Xmx512m - - - - - - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - com.fasterxml.jackson.core @@ -180,18 +133,6 @@ - - org.scala-lang - scala-library - ${scala-version} - test - - - org.scalatest - scalatest_2.9.1 - ${scala-test-version} - test - junit junit @@ -202,13 +143,10 @@ 2.1.4 - 2.9.1-1 4.8.1 1.0.0 4.8.1 - 1.6.1 4.0 - 3.1.5 diff --git a/samples/client/petstore/java/pom.xml b/samples/client/petstore/java/pom.xml index 0f35af17f20..2f685c3927b 100644 --- a/samples/client/petstore/java/pom.xml +++ b/samples/client/petstore/java/pom.xml @@ -104,55 +104,8 @@ 1.6 - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - - compile - testCompile - - - - - - incremental - - - -Xmx384m - - - -target:jvm-1.5 - -deprecation - - - - run-scalatest - org.scalatest.tools.Runner - - -p - ${project.build.testOutputDirectory} - - - -Xmx512m - - - - - - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - com.sun.jersey @@ -197,18 +150,6 @@ - - org.scala-lang - scala-library - ${scala-version} - test - - - org.scalatest - scalatest_2.9.1 - ${scala-test-version} - test - junit junit @@ -221,12 +162,9 @@ 1.7 2.1.4 2.3 - 2.9.1-1 4.8.1 1.0.0 4.8.1 - 1.6.1 - 3.1.5 diff --git a/src/main/resources/Java/pom.mustache b/src/main/resources/Java/pom.mustache index 632e9648ed3..1e2dd35d069 100644 --- a/src/main/resources/Java/pom.mustache +++ b/src/main/resources/Java/pom.mustache @@ -104,55 +104,8 @@ 1.6 - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - - compile - testCompile - - - - - - incremental - - - -Xmx384m - - - -target:jvm-1.5 - -deprecation - - - - run-scalatest - org.scalatest.tools.Runner - - -p - ${project.build.testOutputDirectory} - - - -Xmx512m - - - - - - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - com.sun.jersey @@ -197,18 +150,6 @@ - - org.scala-lang - scala-library - ${scala-version} - test - - - org.scalatest - scalatest_2.9.1 - ${scala-test-version} - test - junit junit @@ -221,11 +162,8 @@ 1.7 2.1.4 2.3 - 2.9.1-1 4.8.1 1.0.0 4.8.1 - 1.6.1 - 3.1.5 diff --git a/src/main/resources/android-java/pom.mustache b/src/main/resources/android-java/pom.mustache index c595e16d83a..61caa2dd0f7 100644 --- a/src/main/resources/android-java/pom.mustache +++ b/src/main/resources/android-java/pom.mustache @@ -104,55 +104,8 @@ 1.6 - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - - compile - testCompile - - - - - - incremental - - - -Xmx384m - - - -target:jvm-1.5 - -deprecation - - - - run-scalatest - org.scalatest.tools.Runner - - -p - ${project.build.testOutputDirectory} - - - -Xmx512m - - - - - - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin-version} - - - com.fasterxml.jackson.core @@ -180,18 +133,6 @@ - - org.scala-lang - scala-library - ${scala-version} - test - - - org.scalatest - scalatest_2.9.1 - ${scala-test-version} - test - junit junit @@ -202,12 +143,9 @@ 2.1.4 - 2.9.1-1 4.8.1 1.0.0 4.8.1 - 1.6.1 4.0 - 3.1.5