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 index 538edecb81..5aa488c757 100644 --- 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 @@ -2,13 +2,19 @@ package com.wordnik.client.api; import com.wordnik.client.ApiException; import com.wordnik.client.ApiInvoker; -import com.wordnik.client.model.Pet; + +import com.wordnik.client.model.*; import java.util.*; + +import com.wordnik.client.model.Pet; + +import java.util.Map; +import java.util.HashMap; import java.io.File; public class PetApi { - String basePath = ""; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public void addHeader(String key, String value) { @@ -30,6 +36,8 @@ public class PetApi { public void updatePet (Pet body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -46,7 +54,7 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -64,7 +72,9 @@ public class PetApi { } - public void addPet (Pet body) throws ApiException { + public void addPet (Pet pet) throws ApiException { + Object postBody = pet; + // create path and map variables @@ -81,7 +91,7 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -100,6 +110,8 @@ public class PetApi { public List findPetsByStatus (List status) throws ApiException { + Object postBody = null; + // create path and map variables @@ -118,7 +130,7 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (List) ApiInvoker.deserialize(response, "Pet", Pet.class); } @@ -137,6 +149,8 @@ public class PetApi { public List findPetsByTags (List tags) throws ApiException { + Object postBody = null; + // create path and map variables @@ -155,7 +169,7 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (List) ApiInvoker.deserialize(response, "Pet", Pet.class); } @@ -174,6 +188,8 @@ public class PetApi { public Pet getPetById (Long petId) throws ApiException { + Object postBody = null; + // create path and map variables @@ -190,7 +206,7 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (Pet) ApiInvoker.deserialize(response, "", Pet.class); } @@ -208,7 +224,9 @@ public class PetApi { } - public void deletePet (Long petId) throws ApiException { + public void updatePetWithForm (String petId, String name, String status) throws ApiException { + Object postBody = null; + // create path and map variables @@ -225,7 +243,45 @@ public class PetApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + + + public void deletePet (String api_key, Long petId) throws ApiException { + Object postBody = null; + + + + // 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(); + + + + headerParams.put("api_key", api_key); + + + String contentType = "application/json"; + + try { + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/StoreApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/StoreApi.java index 33edba2abd..c8f85660f7 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/StoreApi.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/StoreApi.java @@ -2,13 +2,19 @@ package com.wordnik.client.api; import com.wordnik.client.ApiException; import com.wordnik.client.ApiInvoker; -import com.wordnik.client.model.Order; + +import com.wordnik.client.model.*; import java.util.*; + +import com.wordnik.client.model.Order; + +import java.util.Map; +import java.util.HashMap; import java.io.File; public class StoreApi { - String basePath = ""; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public void addHeader(String key, String value) { @@ -29,7 +35,9 @@ public class StoreApi { - public void placeOrder (Order body) throws ApiException { + public Order placeOrder (Order body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -46,16 +54,16 @@ public class StoreApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, 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; @@ -65,6 +73,8 @@ public class StoreApi { public Order getOrderById (String orderId) throws ApiException { + Object postBody = null; + // create path and map variables @@ -81,7 +91,7 @@ public class StoreApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (Order) ApiInvoker.deserialize(response, "", Order.class); } @@ -100,6 +110,8 @@ public class StoreApi { public void deleteOrder (String orderId) throws ApiException { + Object postBody = null; + // create path and map variables @@ -116,7 +128,7 @@ public class StoreApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/UserApi.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/UserApi.java index 697455f932..5c9db1f37a 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/UserApi.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/api/UserApi.java @@ -2,14 +2,20 @@ package com.wordnik.client.api; import com.wordnik.client.ApiException; import com.wordnik.client.ApiInvoker; + +import com.wordnik.client.model.*; + +import java.util.*; + import com.wordnik.client.model.User; import java.util.*; -import java.util.*; +import java.util.Map; +import java.util.HashMap; import java.io.File; public class UserApi { - String basePath = ""; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public void addHeader(String key, String value) { @@ -31,6 +37,8 @@ public class UserApi { public void createUser (User body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -47,7 +55,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -66,6 +74,8 @@ public class UserApi { public void createUsersWithArrayInput (List body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -82,7 +92,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -101,6 +111,8 @@ public class UserApi { public void createUsersWithListInput (List body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -117,7 +129,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -136,6 +148,8 @@ public class UserApi { public String loginUser (String username, String password) throws ApiException { + Object postBody = null; + // create path and map variables @@ -156,7 +170,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (String) ApiInvoker.deserialize(response, "", String.class); } @@ -175,6 +189,8 @@ public class UserApi { public void logoutUser () throws ApiException { + Object postBody = null; + // create path and map variables @@ -191,7 +207,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -210,6 +226,8 @@ public class UserApi { public User getUserByName (String username) throws ApiException { + Object postBody = null; + // create path and map variables @@ -226,7 +244,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType); if(response != null){ return (User) ApiInvoker.deserialize(response, "", User.class); } @@ -245,6 +263,8 @@ public class UserApi { public void updateUser (String username, User body) throws ApiException { + Object postBody = body; + // create path and map variables @@ -261,7 +281,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } @@ -280,6 +300,8 @@ public class UserApi { public void deleteUser (String username) throws ApiException { + Object postBody = null; + // create path and map variables @@ -296,7 +318,7 @@ public class UserApi { String contentType = "application/json"; try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType); + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType); if(response != null){ return ; } 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 index 084eae46fd..65af51c2f6 100644 --- 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 @@ -21,11 +21,12 @@ public class Order { private Date shipDate = null; private String status = null; + private Boolean complete = null; /** **/ - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -68,8 +69,9 @@ public class Order { /** + * Order Status **/ - @ApiModelProperty(required = false, value = "") + @ApiModelProperty(required = false, value = "Order Status") public String getStatus() { return status; } @@ -78,6 +80,17 @@ public class Order { } + /** + **/ + @ApiModelProperty(required = false, value = "") + public Boolean getComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + @Override public String toString() { @@ -89,6 +102,7 @@ public class Order { 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("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java index b98f2c63cc..f84c1d0d92 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Pet.java @@ -7,10 +7,7 @@ import java.util.*; import com.wordnik.swagger.annotations.*; -/** - * A single pet in the store - **/ -@ApiModel(description = "A single pet in the store") +@ApiModel(description = "") public class Pet { private Long id = null; @@ -24,9 +21,8 @@ public class Pet { /** - * the identifier for the pet **/ - @ApiModelProperty(required = false, value = "the identifier for the pet") + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -80,8 +76,9 @@ public class Pet { /** + * pet status in the store **/ - @ApiModelProperty(required = false, value = "") + @ApiModelProperty(required = false, value = "pet status in the store") public String getStatus() { return status; } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java index 8c9101e60b..6fdc13bb04 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/Tag.java @@ -15,7 +15,7 @@ public class Tag { /** **/ - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -26,7 +26,7 @@ public class Tag { /** **/ - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(required = false, value = "") public String getName() { return name; } diff --git a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java index cf20c00067..3e1d8d032e 100644 --- a/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java +++ b/samples/client/petstore/android-java/src/main/java/com/wordnik/client/model/User.java @@ -100,8 +100,9 @@ public class User { /** + * User Status **/ - @ApiModelProperty(required = false, value = "") + @ApiModelProperty(required = false, value = "User Status") public Integer getUserStatus() { return userStatus; } diff --git a/samples/client/petstore/java/pom.xml b/samples/client/petstore/java/pom.xml index 4561705d08..76a7f69b47 100644 --- a/samples/client/petstore/java/pom.xml +++ b/samples/client/petstore/java/pom.xml @@ -107,35 +107,35 @@ + + com.wordnik + swagger-annotations + ${swagger-annotations-version} + com.sun.jersey jersey-client ${jersey-version} - compile com.sun.jersey.contribs jersey-multipart ${jersey-version} - compile com.fasterxml.jackson.core jackson-core ${jackson-version} - compile com.fasterxml.jackson.core jackson-annotations ${jackson-version} - compile com.fasterxml.jackson.core jackson-databind ${jackson-version} - compile com.fasterxml.jackson.datatype @@ -146,7 +146,6 @@ joda-time joda-time ${jodatime-version} - compile @@ -157,8 +156,14 @@ test - + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + 1.5.0-SNAPSHOT 1.7 2.1.4 2.3 diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiException.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiException.java index a0131b5cf8..9a1f62b306 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiException.java +++ b/samples/client/petstore/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/java/src/main/java/com/wordnik/client/ApiInvoker.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java index 7843d0a512..cd6a73937b 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java @@ -185,4 +185,3 @@ public class ApiInvoker { return hostMap.get(host); } } - diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/client/JsonUtil.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/JsonUtil.java index da0fca7816..a650c968f4 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/client/JsonUtil.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/JsonUtil.java @@ -21,4 +21,3 @@ public class JsonUtil { return mapper; } } - 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/client/api/PetApi.java similarity index 58% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/api/PetApi.java index 5331ebfac9..2f42f96fb9 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/client/api/PetApi.java @@ -1,276 +1,44 @@ -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.Pet; +import com.wordnik.client.model.*; + +import java.util.*; + +import com.wordnik.client.model.Pet; + import com.sun.jersey.multipart.FormDataMultiPart; import javax.ws.rs.core.MediaType; import java.io.File; -import java.util.*; +import java.util.Map; +import java.util.HashMap; public class PetApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); 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 { - Object postBody = null; - // 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(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // 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(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "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, "POST", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // 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(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = body; - // 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(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "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(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, postBody, headerParams, formParams, 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 { - 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 = "/pet".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "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(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { 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 = "/pet".replaceAll("\\{format\\}","json"); @@ -279,19 +47,26 @@ public class PetApi { Map headerParams = new HashMap(); Map formParams = new HashMap(); + + + + String[] contentTypes = { - "application/json"}; + "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(); + if(hasFields) postBody = mp; } else { - } + + } try { String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType); @@ -310,129 +85,40 @@ public class PetApi { } } } - //error info- code: 400 reason: "Invalid status value" model: - public List findPetsByStatus (String status) throws ApiException { - Object postBody = null; - // verify required params are set - if(status == null ) { - throw new ApiException(400, "missing required params"); - } + + + public void addPet (Pet pet) throws ApiException { + Object postBody = pet; + + // create path and map variables - String path = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + String path = "/pet".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); - if(!"null".equals(String.valueOf(status))) - queryParams.put("status", String.valueOf(status)); + + + + String[] contentTypes = { - "application/json"}; + "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(); + if(hasFields) postBody = mp; } else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // 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(); - Map formParams = new HashMap(); - - if(!"null".equals(String.valueOf(tags))) - queryParams.put("tags", String.valueOf(tags)); - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // create path and map variables - String path = "/pet/uploadImage".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "multipart/form-data"}; - - 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("additionalMetadata", additionalMetadata, MediaType.MULTIPART_FORM_DATA_TYPE); - hasFields = true; - mp.field("file", file, MediaType.MULTIPART_FORM_DATA_TYPE); - if(hasFields) - postBody = mp; - } - else { - formParams.put("additionalMetadata", additionalMetadata);} try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); @@ -451,5 +137,273 @@ public class PetApi { } } } - } + + + public List findPetsByStatus (List status) throws ApiException { + Object postBody = null; + + // create path and map variables + String path = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + Map formParams = new HashMap(); + + if(!"null".equals(String.valueOf(status))) + queryParams.put("status", String.valueOf(status)); + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // create path and map variables + String path = "/pet/findByTags".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + Map formParams = new HashMap(); + + if(!"null".equals(String.valueOf(tags))) + queryParams.put("tags", String.valueOf(tags)); + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // 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(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 updatePetWithForm (String petId, String name, String status) throws ApiException { + Object postBody = null; + + + // 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(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + "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(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + + + public void deletePet (String api_key, Long petId) throws ApiException { + Object postBody = null; + + + // 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(); + Map formParams = new HashMap(); + + + + headerParams.put("api_key", api_key); + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); + if(response != null){ + return ; + } + else { + return ; + } + } catch (ApiException ex) { + if(ex.getCode() == 404) { + return ; + } + else { + throw ex; + } + } + } + +} 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/client/api/StoreApi.java similarity index 74% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/api/StoreApi.java index 6346fd6bd6..968d5840a7 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/client/api/StoreApi.java @@ -1,39 +1,44 @@ -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.*; + +import java.util.*; + +import com.wordnik.client.model.Order; + import com.sun.jersey.multipart.FormDataMultiPart; import javax.ws.rs.core.MediaType; import java.io.File; -import java.util.*; +import java.util.Map; +import java.util.HashMap; public class StoreApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public ApiInvoker getInvoker() { return apiInvoker; } - + public void setBasePath(String basePath) { this.basePath = basePath; } - + public String getBasePath() { return basePath; } - //error info- code: 400 reason: "Invalid order" model: - public void placeOrder (Order body) throws ApiException { + + + public Order placeOrder (Order 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 = "/store/order".replaceAll("\\{format\\}","json"); @@ -42,66 +47,132 @@ public class StoreApi { Map headerParams = new HashMap(); Map formParams = new HashMap(); + + + + String[] contentTypes = { - "application/json"}; + + }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); + if(hasFields) postBody = mp; } else { - } + + } try { String response = apiInvoker.invokeAPI(basePath, path, "POST", 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; } } } - //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 { + + + public Order getOrderById (String orderId) throws ApiException { Object postBody = null; - // 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())); + String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString())); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); + + + + String[] contentTypes = { - "application/json"}; + + }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); + if(hasFields) postBody = mp; } else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // 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(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } try { String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); @@ -120,52 +191,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 { - Object postBody = null; - // 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(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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/java/src/main/java/com/wordnik/petstore/api/UserApi.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/api/UserApi.java similarity index 82% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/api/UserApi.java index 15c4354746..73b764f1a3 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/client/api/UserApi.java @@ -1,61 +1,391 @@ -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.*; + +import java.util.*; + +import com.wordnik.client.model.User; +import java.util.*; + import com.sun.jersey.multipart.FormDataMultiPart; import javax.ws.rs.core.MediaType; import java.io.File; -import java.util.*; +import java.util.Map; +import java.util.HashMap; public class UserApi { - String basePath = "http://petstore.swagger.wordnik.com/api"; + String basePath = "http://petstore.swagger.wordnik.com/v2"; ApiInvoker apiInvoker = ApiInvoker.getInstance(); public ApiInvoker getInvoker() { return apiInvoker; } - + public void setBasePath(String basePath) { this.basePath = basePath; } - + public String getBasePath() { 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 { + + + public void createUser (User body) throws ApiException { Object postBody = body; - // verify required params are set - if(username == null || 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".replaceAll("\\{format\\}","json"); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); + + + + String[] contentTypes = { - "application/json"}; + + }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); + if(hasFields) postBody = mp; } else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = body; + + + // create path and map variables + String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = body; + + + // create path and map variables + String path = "/user/createWithList".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // create path and map variables + 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 = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // create path and map variables + String path = "/user/logout".replaceAll("\\{format\\}","json"); + + // query params + Map queryParams = new HashMap(); + Map headerParams = new HashMap(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = null; + + + // 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(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } + + try { + String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { + Object postBody = body; + + + // 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(); + Map formParams = new HashMap(); + + + + + + String[] contentTypes = { + + }; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + + if(contentType.startsWith("multipart/form-data")) { + boolean hasFields = false; + FormDataMultiPart mp = new FormDataMultiPart(); + + if(hasFields) + postBody = mp; + } + else { + + } try { String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType); @@ -74,35 +404,41 @@ 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 { 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/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); Map headerParams = new HashMap(); Map formParams = new HashMap(); + + + + String[] contentTypes = { - "application/json"}; + + }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); + if(hasFields) postBody = mp; } else { - } + + } try { String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType); @@ -121,278 +457,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 { - 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())); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // 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(); - 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"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - Object postBody = null; - // create path and map variables - String path = "/user/logout".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, 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 { - 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/createWithArray".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { - 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/createWithList".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, 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 { - 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".replaceAll("\\{format\\}","json"); - - // query params - Map queryParams = new HashMap(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String[] contentTypes = { - "application/json"}; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - - if(contentType.startsWith("multipart/form-data")) { - boolean hasFields = false; - FormDataMultiPart mp = new FormDataMultiPart(); - if(hasFields) - postBody = mp; - } - else { - } - - try { - String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); - if(response != null){ - return ; - } - else { - return ; - } - } catch (ApiException ex) { - if(ex.getCode() == 404) { - return ; - } - else { - throw ex; - } - } - } - } - + +} diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Category.java similarity index 63% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/model/Category.java index aa9303084b..5a0a18d40a 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Category.java @@ -1,8 +1,21 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -public class Category { + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Category { private Long id = null; + + //public enum idEnum { }; + private String name = null; + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -10,6 +23,10 @@ public class Category { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getName() { return name; } @@ -17,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/java/src/main/java/com/wordnik/petstore/model/Order.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Order.java similarity index 57% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/model/Order.java index c44ea0f38c..65af51c2f6 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Order.java @@ -1,14 +1,32 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; import java.util.Date; -public class Order { + +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; - /* Order Status */ - private String status = null; - //public enum statusEnum { placed, approved, delivered, }; + + //public enum quantityEnum { }; + private Date shipDate = null; + private String status = null; + private Boolean complete = null; + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -16,6 +34,10 @@ public class Order { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getPetId() { return petId; } @@ -23,6 +45,10 @@ public class Order { this.petId = petId; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public Integer getQuantity() { return quantity; } @@ -30,13 +56,10 @@ public class Order { this.quantity = quantity; } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - + + /** + **/ + @ApiModelProperty(required = false, value = "") public Date getShipDate() { return shipDate; } @@ -44,17 +67,43 @@ public class Order { this.shipDate = shipDate; } + + /** + * Order Status + **/ + @ApiModelProperty(required = false, value = "Order Status") + 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; + } + + + @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(" status: ").append(status).append("\n"); + sb.append(" complete: ").append(complete).append("\n"); sb.append("}\n"); return sb.toString(); } } - diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Pet.java similarity index 63% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/model/Pet.java index b5a577d1a8..f84c1d0d92 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Pet.java @@ -1,18 +1,28 @@ -package com.wordnik.petstore.model; +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 */ + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Pet { private Long id = null; + + //public enum idEnum { }; + private Category category = null; private String name = null; - private List photoUrls = new ArrayList(); - private List tags = new ArrayList(); - /* pet status in the store */ + private List photoUrls = new ArrayList() ; + private List tags = new ArrayList() ; private String status = null; - //public enum statusEnum { available, pending, sold, }; + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -20,6 +30,10 @@ public class Pet { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public Category getCategory() { return category; } @@ -27,6 +41,10 @@ public class Pet { this.category = category; } + + /** + **/ + @ApiModelProperty(required = true, value = "") public String getName() { return name; } @@ -34,6 +52,10 @@ public class Pet { this.name = name; } + + /** + **/ + @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; } @@ -41,6 +63,10 @@ public class Pet { this.photoUrls = photoUrls; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public List getTags() { return tags; } @@ -48,6 +74,11 @@ public class Pet { this.tags = tags; } + + /** + * pet status in the store + **/ + @ApiModelProperty(required = false, value = "pet status in the store") public String getStatus() { return status; } @@ -55,10 +86,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"); @@ -69,4 +103,3 @@ public class Pet { return sb.toString(); } } - diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Tag.java similarity index 63% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/model/Tag.java index 886a5a6513..6fdc13bb04 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/Tag.java @@ -1,8 +1,21 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -public class Tag { + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class Tag { private Long id = null; + + //public enum idEnum { }; + private String name = null; + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -10,6 +23,10 @@ public class Tag { this.id = id; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getName() { return name; } @@ -17,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/java/src/main/java/com/wordnik/petstore/model/User.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/User.java similarity index 71% rename from samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/User.java rename to samples/client/petstore/java/src/main/java/com/wordnik/client/model/User.java index 4b28758add..3e1d8d032e 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/User.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/model/User.java @@ -1,16 +1,30 @@ -package com.wordnik.petstore.model; +package com.wordnik.client.model; -public class User { + +import com.wordnik.swagger.annotations.*; + + +@ApiModel(description = "") +public class User { private Long id = null; - private String firstName = null; + + //public enum idEnum { }; + private String username = null; + private String firstName = null; private String lastName = null; private String email = null; private String password = null; private String phone = null; - /* User Status */ private Integer userStatus = null; - //public enum userStatusEnum { 1-registered, 2-active, 3-closed, }; + + //public enum userStatusEnum { }; + + + + /** + **/ + @ApiModelProperty(required = false, value = "") public Long getId() { return id; } @@ -18,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; } @@ -32,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; } @@ -39,6 +65,10 @@ public class User { this.lastName = lastName; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getEmail() { return email; } @@ -46,6 +76,10 @@ public class User { this.email = email; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getPassword() { return password; } @@ -53,6 +87,10 @@ public class User { this.password = password; } + + /** + **/ + @ApiModelProperty(required = false, value = "") public String getPhone() { return phone; } @@ -60,6 +98,11 @@ public class User { this.phone = phone; } + + /** + * User Status + **/ + @ApiModelProperty(required = false, value = "User Status") public Integer getUserStatus() { return userStatus; } @@ -67,13 +110,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"); @@ -83,4 +129,3 @@ public class User { return sb.toString(); } } - diff --git a/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcshareddata/PetstoreClient.xccheckout b/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcshareddata/PetstoreClient.xccheckout index 66f3c15bca..fafd21fb8e 100644 --- a/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcshareddata/PetstoreClient.xccheckout +++ b/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcshareddata/PetstoreClient.xccheckout @@ -10,29 +10,29 @@ PetstoreClient IDESourceControlProjectOriginsDictionary - 92840518-904D-4771-AA3D-9AF52CA48B71 + E5BBF0AA85077C865C95437976D06D819733A208 ssh://github.com/wordnik/swagger-codegen.git IDESourceControlProjectPath samples/client/petstore/objc/PetstoreClient.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary - 92840518-904D-4771-AA3D-9AF52CA48B71 + E5BBF0AA85077C865C95437976D06D819733A208 ../../../../.. IDESourceControlProjectURL ssh://github.com/wordnik/swagger-codegen.git IDESourceControlProjectVersion - 110 + 111 IDESourceControlProjectWCCIdentifier - 92840518-904D-4771-AA3D-9AF52CA48B71 + E5BBF0AA85077C865C95437976D06D819733A208 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 92840518-904D-4771-AA3D-9AF52CA48B71 + E5BBF0AA85077C865C95437976D06D819733A208 IDESourceControlWCCName swagger-codegen diff --git a/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate index 86db4ca503..6ff18c077e 100644 Binary files a/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate and b/samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient/ViewController.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/ViewController.m index d8e593c507..1af289ecee 100644 --- a/samples/client/petstore/objc/PetstoreClient/PetstoreClient/ViewController.m +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/ViewController.m @@ -24,6 +24,10 @@ [api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) { NSLog(@"%@", [output asDictionary]); + [output set_id:@101]; + [api addPetWithCompletionBlock:output completionHandler:^(NSError *error) { + NSLog(@"Done!"); + }]; }]; } diff --git a/samples/client/petstore/objc/client/SWGPetApi.h b/samples/client/petstore/objc/client/SWGPetApi.h index 373f1c6448..5a79b72c36 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.h +++ b/samples/client/petstore/objc/client/SWGPetApi.h @@ -25,10 +25,10 @@ Add a new pet to the store - @param body Pet object that needs to be added to the store + @param pet Pet object that needs to be added to the store */ --(NSNumber*) addPetWithCompletionBlock : (SWGPet*) body +-(NSNumber*) addPetWithCompletionBlock : (SWGPet*) pet completionHandler: (void (^)(NSError* error))completionBlock; /** diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index 1ae7436917..df590fcde3 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -54,6 +54,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath]; // remove format in URL if needed @@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -136,10 +137,11 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } --(NSNumber*) addPetWithCompletionBlock:(SWGPet*) body +-(NSNumber*) addPetWithCompletionBlock:(SWGPet*) pet completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = pet; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath]; // remove format in URL if needed @@ -158,9 +160,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -170,25 +172,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -226,6 +228,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath]; // remove format in URL if needed @@ -291,6 +294,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath]; // remove format in URL if needed @@ -356,6 +360,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed @@ -416,6 +421,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed @@ -470,6 +476,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m index 30e2ba6d70..35714fae6c 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/client/SWGStoreApi.m @@ -54,6 +54,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order", basePath]; // remove format in URL if needed @@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -145,6 +146,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; // remove format in URL if needed @@ -203,6 +205,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; // remove format in URL if needed diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m index 34d2301553..8c0e817ad5 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/client/SWGUserApi.m @@ -54,6 +54,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath]; // remove format in URL if needed @@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -140,6 +141,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath]; // remove format in URL if needed @@ -158,9 +160,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -170,25 +172,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -226,6 +228,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath]; // remove format in URL if needed @@ -244,9 +247,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -256,25 +259,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -313,6 +316,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSString* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/login", basePath]; // remove format in URL if needed @@ -367,6 +371,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; (void (^)(NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/logout", basePath]; // remove format in URL if needed @@ -419,6 +424,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed @@ -478,6 +484,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = body; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed @@ -497,9 +504,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; id bodyDictionary = nil; - if(body != nil && [body isKindOfClass:[NSArray class]]){ + if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){ NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)body) { + for (id dict in (NSArray*)m_body) { if([dict respondsToSelector:@selector(asDictionary)]) { [objs addObject:[(SWGObject*)dict asDictionary]]; } @@ -509,25 +516,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; } bodyDictionary = objs; } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(SWGObject*)body asDictionary]; + else if([m_body respondsToSelector:@selector(asDictionary)]) { + bodyDictionary = [(SWGObject*)m_body asDictionary]; } - else if([body isKindOfClass:[NSString class]]) { + else if([m_body isKindOfClass:[NSString class]]) { // convert it to a dictionary NSError * error; - NSString * str = (NSString*)body; + NSString * str = (NSString*)m_body; NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; bodyDictionary = JSON; } - else if([body isKindOfClass: [SWGFile class]]) { + else if([m_body isKindOfClass: [SWGFile class]]) { requestContentType = @"form-data"; - bodyDictionary = body; + bodyDictionary = m_body; } else{ - NSLog(@"don't know what to do with %@", body); + NSLog(@"don't know what to do with %@", m_body); } @@ -565,6 +572,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + id m_body = nil; NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed