From 2729070d7fa48b595efdecf6e9163dc79cd472d9 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Sat, 27 Sep 2014 16:59:08 -0700 Subject: [PATCH] updated android sample --- .../AndroidJavaPetstoreCodegen.scala | 50 -- samples/client/petstore/android-java/pom.xml | 13 +- .../java/com/wordnik/client/ApiException.java | 2 +- .../java/com/wordnik/client/ApiInvoker.java | 1 - .../java/com/wordnik/client/HttpPatch.java | 2 +- .../java/com/wordnik/client/JsonUtil.java | 1 - .../java/com/wordnik/client/api/PetApi.java | 245 ++++++++++ .../{petstore => client}/api/StoreApi.java | 112 +++-- .../{petstore => client}/api/UserApi.java | 449 ++++++++++-------- .../{petstore => client}/model/Category.java | 27 +- .../java/com/wordnik/client/model/Order.java | 123 +++++ .../java/com/wordnik/client/model/Orders.java | 23 + .../{petstore => client}/model/Pet.java | 63 ++- .../{petstore => client}/model/Tag.java | 27 +- .../{petstore => client}/model/User.java | 79 ++- .../java/com/wordnik/petstore/api/PetApi.java | 320 ------------- .../com/wordnik/petstore/model/Order.java | 66 --- 17 files changed, 850 insertions(+), 753 deletions(-) delete mode 100644 samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala create mode 100644 samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/PetApi.java rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/api/StoreApi.java (70%) rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/api/UserApi.java (72%) rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/model/Category.java (63%) create mode 100644 samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Order.java create mode 100644 samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Orders.java rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/model/Pet.java (61%) rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/model/Tag.java (64%) rename samples/client/petstore/android-java/src/main/java/com/wordnik/{petstore => client}/model/User.java (72%) delete mode 100644 samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java delete mode 100644 samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Order.java diff --git a/samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala b/samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala deleted file mode 100644 index e3083d662037..000000000000 --- a/samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2014 Wordnik, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.wordnik.swagger.codegen.BasicAndroidJavaGenerator - -object AndroidJavaPetstoreCodegen extends BasicAndroidJavaGenerator { - def main(args: Array[String]) = generateClient(args) - - // location of templates - override def templateDir = "src/main/resources/android-java" - - // where to write generated code - override def destinationDir = "samples/client/petstore/android-java/src/main/java" - - // package for api invoker, error files - override def invokerPackage = Some("com.wordnik.client") - - // package for models - override def modelPackage = Some("com.wordnik.petstore.model") - - // package for api classes - override def apiPackage = Some("com.wordnik.petstore.api") - - additionalParams ++= Map( - "artifactId" -> "swagger-petstore", - "artifactVersion" -> "1.0.0", - "groupId" -> "com.wordnik") - - // supporting classes - override def supportingFiles = List( - ("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"), - ("httpPatch.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "HttpPatch.java"), - ("jsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"), - ("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"), - ("pom.mustache", "samples/client/petstore/android-java", "pom.xml") - ) -} diff --git a/samples/client/petstore/android-java/pom.xml b/samples/client/petstore/android-java/pom.xml index 2e7f6d8c612d..41e811f2112e 100644 --- a/samples/client/petstore/android-java/pom.xml +++ b/samples/client/petstore/android-java/pom.xml @@ -107,6 +107,11 @@ + + com.wordnik + swagger-annotations + ${swagger-annotations-version} + com.fasterxml.jackson.core jackson-core @@ -140,8 +145,14 @@ test - + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + 1.5.0-SNAPSHOT 2.1.4 4.8.1 1.0.0 diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiException.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiException.java index a0131b5cf8c4..9a1f62b3061e 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiException.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiException.java @@ -26,4 +26,4 @@ public class ApiException extends Exception { public void setMessage(String message) { this.message = message; } -} +} \ No newline at end of file diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiInvoker.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiInvoker.java index 1536a1f1c582..2ca01b656781 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiInvoker.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/ApiInvoker.java @@ -281,4 +281,3 @@ public class ApiInvoker { } } } - diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/HttpPatch.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/HttpPatch.java index 07c94381d3b4..3243cc901a7d 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/HttpPatch.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/HttpPatch.java @@ -13,4 +13,4 @@ public class HttpPatch extends HttpPost { public String getMethod() { return METHOD_PATCH; } -} +} \ No newline at end of file diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/JsonUtil.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/JsonUtil.java index 3d96fa3ac71c..b761cc4bf44a 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/JsonUtil.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/JsonUtil.java @@ -18,4 +18,3 @@ public class JsonUtil { return mapper; } } - diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/PetApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/PetApi.java new file mode 100644 index 000000000000..538edecb81cd --- /dev/null +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/PetApi.java @@ -0,0 +1,245 @@ +package com.wordnik.client.api; + +import com.wordnik.client.ApiException; +import com.wordnik.client.ApiInvoker; +import com.wordnik.client.model.Pet; + +import java.util.*; +import java.io.File; + +public class PetApi { + String basePath = ""; + ApiInvoker apiInvoker = ApiInvoker.getInstance(); + + public void addHeader(String key, String value) { + getInvoker().addDefaultHeader(key, value); + } + + public ApiInvoker getInvoker() { + return apiInvoker; + } + + public void setBasePath(String basePath) { + this.basePath = basePath; + } + + public String getBasePath() { + return basePath; + } + + + + public void updatePet (Pet body) throws ApiException { + + + // create path and map variables + String path = "/pet".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, null, headerParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + + + public void addPet (Pet body) throws ApiException { + + + // create path and map variables + String path = "/pet".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; + } + } + } + + + public List findPetsByStatus (List status) throws ApiException { + + + // create path and map variables + String path = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + if(!"null".equals(String.valueOf(status))) + queryParams.put("status", String.valueOf(status)); + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (List) ApiInvoker.deserialize(response, "Pet", Pet.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public List findPetsByTags (List tags) throws ApiException { + + + // create path and map variables + String path = "/pet/findByTags".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + if(!"null".equals(String.valueOf(tags))) + queryParams.put("tags", String.valueOf(tags)); + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (List) ApiInvoker.deserialize(response, "Pet", Pet.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public Pet getPetById (Long petId) throws ApiException { + + + // 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, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (Pet) ApiInvoker.deserialize(response, "", Pet.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public void deletePet (Long petId) throws ApiException { + + + // 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, "DELETE", 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/client/api/StoreApi.java similarity index 70% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/StoreApi.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/StoreApi.java index 6ec0d4d7e2cd..33edba2abd53 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/client/api/StoreApi.java @@ -1,13 +1,14 @@ -package com.wordnik.petstore.api; +package com.wordnik.client.api; import com.wordnik.client.ApiException; import com.wordnik.client.ApiInvoker; -import com.wordnik.petstore.model.Order; +import com.wordnik.client.model.Order; + import java.util.*; import java.io.File; public class StoreApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; + String basePath = ""; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public void addHeader(String key, String value) { @@ -26,12 +27,11 @@ public class StoreApi { return basePath; } - //error info- code: 400 reason: "Invalid order" model: - public void placeOrder (Order body) throws ApiException { - // verify required params are set - if(body == null ) { - throw new ApiException(400, "missing required params"); - } + + + public void placeOrder (Order body) throws ApiException { + + // create path and map variables String path = "/store/order".replaceAll("\\{format\\}","json"); @@ -39,10 +39,14 @@ public class StoreApi { Map queryParams = new HashMap(); Map headerParams = new HashMap(); + + + + String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); if(response != null){ return ; } @@ -58,13 +62,11 @@ public class StoreApi { } } } - //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 { - // verify required params are set - if(orderId == null ) { - throw new ApiException(400, "missing required params"); - } + + + public Order getOrderById (String orderId) throws ApiException { + + // create path and map variables String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); @@ -72,6 +74,45 @@ public class StoreApi { Map queryParams = new HashMap(); Map headerParams = new HashMap(); + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (Order) ApiInvoker.deserialize(response, "", Order.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public void deleteOrder (String orderId) throws ApiException { + + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + + + + String contentType = "application/json"; try { @@ -91,38 +132,5 @@ public class StoreApi { } } } - //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(orderId == 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())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (Order) ApiInvoker.deserialize(response, "", Order.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - 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/client/api/UserApi.java similarity index 72% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/UserApi.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/UserApi.java index a489a79836ca..697455f93274 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/client/api/UserApi.java @@ -1,13 +1,15 @@ -package com.wordnik.petstore.api; +package com.wordnik.client.api; import com.wordnik.client.ApiException; import com.wordnik.client.ApiInvoker; -import com.wordnik.petstore.model.User; +import com.wordnik.client.model.User; +import java.util.*; + import java.util.*; import java.io.File; public class UserApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; + String basePath = ""; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public void addHeader(String key, String value) { @@ -26,24 +28,26 @@ public class UserApi { return basePath; } - //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 { - // verify required params are set - if(username == null || body == null ) { - throw new ApiException(400, "missing required params"); - } + + + public void createUser (User body) throws ApiException { + + // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + String path = "/user".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); + + + + String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); if(response != null){ return ; } @@ -59,13 +63,155 @@ public class UserApi { } } } - //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 { - // verify required params are set - if(username == null ) { - throw new ApiException(400, "missing required params"); + + + public void createUsersWithArrayInput (List body) throws ApiException { + + + // create path and map variables + String path = "/user/createWithArray".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; + } } + } + + + public void createUsersWithListInput (List body) throws ApiException { + + + // create path and map variables + String path = "/user/createWithList".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; + } + } + } + + + public String loginUser (String username, String password) throws ApiException { + + + // create path and map variables + String path = "/user/login".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = 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 contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (String) ApiInvoker.deserialize(response, "", String.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public void logoutUser () throws ApiException { + + + // create path and map variables + String path = "/user/logout".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + + + public User getUserByName (String username) throws ApiException { + + // create path and map variables String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); @@ -73,6 +219,80 @@ public class UserApi { Map queryParams = new HashMap(); Map headerParams = new HashMap(); + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + if(response != null){ + return (User) ApiInvoker.deserialize(response, "", User.class); + } + else { + return null; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return null; + } + else { + throw ex; + } + } + } + + + public void updateUser (String username, User body) throws ApiException { + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + + + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, null, headerParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + + + public void deleteUser (String username) throws ApiException { + + + // create path and map variables + String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + + + + + String contentType = "application/json"; try { @@ -92,194 +312,5 @@ public class UserApi { } } } - //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 { - // 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())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (User) ApiInvoker.deserialize(response, "", User.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return null; - } - else { - throw ex; - } - } - } - //error info- code: 400 reason: "Invalid username and password combination" model: - public String loginUser (String username, String password) throws ApiException { - // verify required params are set - if(username == null || password == null ) { - throw new ApiException(400, "missing required params"); - } - // create path and map variables - String path = "/user/login".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = 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 contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (String) ApiInvoker.deserialize(response, "", String.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return null; - } - else { - throw ex; - } - } - } - public void logoutUser () throws ApiException { - // create path and map variables - String path = "/user/logout".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - 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/createWithArray".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, body, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - 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/createWithList".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, body, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - 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".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, body, 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/model/Category.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Category.java similarity index 63% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Category.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Category.java index a2dc94401c9f..5a0a18d40a5b 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Category.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Category.java @@ -1,12 +1,21 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -import com.fasterxml.jackson.annotation.JsonProperty; -public class Category { - @JsonProperty("id") +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Category { private Long id = null; - @JsonProperty("name") + + //public enum idEnum { }; + private String name = null; + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -14,6 +23,10 @@ public class Category { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getName() { return name; } @@ -21,14 +34,16 @@ public class Category { this.name = name; } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Category {\n"); + sb.append(" id: ").append(id).append("\n"); sb.append(" name: ").append(name).append("\n"); sb.append("}\n"); return sb.toString(); } } - diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Order.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Order.java new file mode 100644 index 000000000000..42bceaade96f --- /dev/null +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Order.java @@ -0,0 +1,123 @@ +package com.wordnik.client.model; + +import java.util.Date; +import java.util.Map; +import java.util.*; + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Order { + private Long id = null; + + //public enum idEnum { }; + + private Long petId = null; + + //public enum petIdEnum { }; + + private Integer quantity = null; + + //public enum quantityEnum { }; + + private Date shipDate = null; + private String status = null; + private Boolean complete = null; + private Map keyValuePairs = new HashMap() ; + + + /** + **/ + @ApiModelProperty(required = true, value = "") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public Long getPetId() { + return petId; + } + public void setPetId(Long petId) { + this.petId = petId; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public Date getShipDate() { + return shipDate; + } + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public Boolean getComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") + public Map getKeyValuePairs() { + return keyValuePairs; + } + public void setKeyValuePairs(Map keyValuePairs) { + this.keyValuePairs = keyValuePairs; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" petId: ").append(petId).append("\n"); + sb.append(" quantity: ").append(quantity).append("\n"); + sb.append(" shipDate: ").append(shipDate).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append(" complete: ").append(complete).append("\n"); + sb.append(" keyValuePairs: ").append(keyValuePairs).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Orders.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Orders.java new file mode 100644 index 000000000000..5100efe8042d --- /dev/null +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Orders.java @@ -0,0 +1,23 @@ +package com.wordnik.client.model; + +import java.util.Map; +import java.util.HashMap; +import com.wordnik.client.model.Orders; + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Orders extends HashMap { + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Orders {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Pet.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java similarity index 61% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Pet.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java index 5f68e4df203f..b98f2c63cc7b 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Pet.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java @@ -1,25 +1,32 @@ -package com.wordnik.petstore.model; - -import com.fasterxml.jackson.annotation.JsonProperty; +package com.wordnik.client.model; +import com.wordnik.client.model.Category; +import com.wordnik.client.model.Tag; import java.util.*; -import com.wordnik.petstore.model.Category; -import com.wordnik.petstore.model.Tag; -public class Pet { - /* unique identifier for the pet */ - @JsonProperty("id") + +import com.wordnik.swagger.annotations.*; + + +/** + * A single pet in the store + **/ +@ApiModel(description = "A single pet in the store") +public class Pet { private Long id = null; - @JsonProperty("category") + + //public enum idEnum { }; + private Category category = null; - @JsonProperty("name") private String name = null; - @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); - @JsonProperty("tags") - private List tags = new ArrayList(); - /* pet status in the store */ - @JsonProperty("status") + private List photoUrls = new ArrayList() ; + private List tags = new ArrayList() ; private String status = null; + + + /** + * the identifier for the pet + **/ + @ApiModelProperty(required = false, value = "the identifier for the pet") public Long getId() { return id; } @@ -27,6 +34,10 @@ public class Pet { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public Category getCategory() { return category; } @@ -34,6 +45,10 @@ public class Pet { this.category = category; } + + /** + **/ + @ApiModelProperty(required = true, value = "") public String getName() { return name; } @@ -41,6 +56,10 @@ public class Pet { this.name = name; } + + /** + **/ + @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; } @@ -48,6 +67,10 @@ public class Pet { this.photoUrls = photoUrls; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public List getTags() { return tags; } @@ -55,6 +78,10 @@ public class Pet { this.tags = tags; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getStatus() { return status; } @@ -62,10 +89,13 @@ public class Pet { this.status = status; } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Pet {\n"); + sb.append(" id: ").append(id).append("\n"); sb.append(" category: ").append(category).append("\n"); sb.append(" name: ").append(name).append("\n"); @@ -76,4 +106,3 @@ public class Pet { return sb.toString(); } } - diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Tag.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java similarity index 64% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Tag.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java index 52407da12671..8c9101e60b00 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Tag.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java @@ -1,12 +1,21 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -import com.fasterxml.jackson.annotation.JsonProperty; -public class Tag { - @JsonProperty("id") +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Tag { private Long id = null; - @JsonProperty("name") + + //public enum idEnum { }; + private String name = null; + + + /** + **/ + @ApiModelProperty(required = true, value = "") public Long getId() { return id; } @@ -14,6 +23,10 @@ public class Tag { this.id = id; } + + /** + **/ + @ApiModelProperty(required = true, value = "") public String getName() { return name; } @@ -21,14 +34,16 @@ public class Tag { this.name = name; } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Tag {\n"); + sb.append(" id: ").append(id).append("\n"); sb.append(" name: ").append(name).append("\n"); sb.append("}\n"); return sb.toString(); } } - diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/User.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java similarity index 72% rename from samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/User.java rename to samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java index 117dd216308d..cf20c0006735 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/User.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java @@ -1,25 +1,30 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -import com.fasterxml.jackson.annotation.JsonProperty; -public class User { - @JsonProperty("id") +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class User { private Long id = null; - @JsonProperty("firstName") - private String firstName = null; - @JsonProperty("username") + + //public enum idEnum { }; + private String username = null; - @JsonProperty("lastName") + private String firstName = null; private String lastName = null; - @JsonProperty("email") private String email = null; - @JsonProperty("password") private String password = null; - @JsonProperty("phone") private String phone = null; - /* User Status */ - @JsonProperty("userStatus") private Integer userStatus = null; + + //public enum userStatusEnum { }; + + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -27,13 +32,10 @@ public class User { this.id = id; } - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getUsername() { return username; } @@ -41,6 +43,21 @@ public class User { this.username = username; } + + /** + **/ + @ApiModelProperty(required = false, value = "") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getLastName() { return lastName; } @@ -48,6 +65,10 @@ public class User { this.lastName = lastName; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getEmail() { return email; } @@ -55,6 +76,10 @@ public class User { this.email = email; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getPassword() { return password; } @@ -62,6 +87,10 @@ public class User { this.password = password; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getPhone() { return phone; } @@ -69,6 +98,10 @@ public class User { this.phone = phone; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public Integer getUserStatus() { return userStatus; } @@ -76,13 +109,16 @@ public class User { this.userStatus = userStatus; } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class User {\n"); + sb.append(" id: ").append(id).append("\n"); - sb.append(" firstName: ").append(firstName).append("\n"); sb.append(" username: ").append(username).append("\n"); + sb.append(" firstName: ").append(firstName).append("\n"); sb.append(" lastName: ").append(lastName).append("\n"); sb.append(" email: ").append(email).append("\n"); sb.append(" password: ").append(password).append("\n"); @@ -92,4 +128,3 @@ public class User { return sb.toString(); } } - 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 deleted file mode 100644 index d1cb4ed07871..000000000000 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/api/PetApi.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.wordnik.petstore.api; - -import com.wordnik.client.ApiException; -import com.wordnik.client.ApiInvoker; -import com.wordnik.petstore.model.Pet; -import java.util.*; -import java.io.File; - -public class PetApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; - ApiInvoker apiInvoker = ApiInvoker.getInstance(); - - public void addHeader(String key, String value) { - getInvoker().addDefaultHeader(key, value); - } - - public ApiInvoker getInvoker() { - return apiInvoker; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public String getBasePath() { - return basePath; - } - - //error info- code: 400 reason: "Invalid ID supplied" model: - //error info- code: 404 reason: "Pet not found" model: - public Pet getPetById (Long petId) throws ApiException { - // verify required params are set - if(petId == 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, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (Pet) ApiInvoker.deserialize(response, "", 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 { - // verify required params are set - if(petId == 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, "POST", queryParams, null, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - //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"); - } - // 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, "DELETE", queryParams, null, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - //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, "List", 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 addPet (Pet 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 = "/pet".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, body, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - //error info- code: 400 reason: "Invalid ID supplied" model: - //error info- code: 404 reason: "Pet not found" model: - //error info- code: 405 reason: "Validation exception" model: - public void updatePet (Pet 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 = "/pet".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - //error info- code: 400 reason: "Invalid status value" model: - public List findPetsByStatus (String status) throws ApiException { - // verify required params are set - if(status == null ) { - throw new ApiException(400, "missing required params"); - } - // create path and map variables - String path = "/pet/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if(!"null".equals(String.valueOf(status))) - queryParams.put("status", String.valueOf(status)); - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (List) ApiInvoker.deserialize(response, "List", Pet.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return null; - } - else { - throw ex; - } - } - } - //error info- code: 400 reason: "Invalid tag value" model: - public List findPetsByTags (String tags) throws ApiException { - // verify required params are set - if(tags == null ) { - throw new ApiException(400, "missing required params"); - } - // create path and map variables - String path = "/pet/findByTags".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - - if(!"null".equals(String.valueOf(tags))) - queryParams.put("tags", String.valueOf(tags)); - String contentType = "application/json"; - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); - if(response != null){ - return (List) ApiInvoker.deserialize(response, "List", Pet.class); - } - else { - return null; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return null; - } - else { - throw ex; - } - } - } - 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/model/Order.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Order.java deleted file mode 100644 index 28e1e74d27a3..000000000000 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/petstore/model/Order.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.wordnik.petstore.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Date; -public class Order { - @JsonProperty("id") - private Long id = null; - @JsonProperty("petId") - private Long petId = null; - @JsonProperty("quantity") - private Integer quantity = null; - /* Order Status */ - @JsonProperty("status") - private String status = null; - @JsonProperty("shipDate") - private Date shipDate = null; - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - - public Date getShipDate() { - return shipDate; - } - public void setShipDate(Date shipDate) { - this.shipDate = shipDate; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - sb.append(" id: ").append(id).append("\n"); - sb.append(" petId: ").append(petId).append("\n"); - sb.append(" quantity: ").append(quantity).append("\n"); - sb.append(" status: ").append(status).append("\n"); - sb.append(" shipDate: ").append(shipDate).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} -