mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
rebuilt samples
This commit is contained in:
parent
63c428d048
commit
4c674ca94b
@ -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<Pet> findPetsByStatus (List<String> 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<Pet>) ApiInvoker.deserialize(response, "Pet", Pet.class);
|
||||
}
|
||||
@ -137,6 +149,8 @@ public class PetApi {
|
||||
|
||||
|
||||
public List<Pet> findPetsByTags (List<String> 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<Pet>) 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
@ -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 ;
|
||||
}
|
||||
|
@ -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<User> 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<User> 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 ;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -100,8 +100,9 @@ public class User {
|
||||
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
@ApiModelProperty(required = false, value = "")
|
||||
@ApiModelProperty(required = false, value = "User Status")
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
|
@ -107,35 +107,35 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey.contribs</groupId>
|
||||
<artifactId>jersey-multipart</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
@ -146,7 +146,6 @@
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${jodatime-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
@ -157,8 +156,14 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.0-SNAPSHOT</swagger-annotations-version>
|
||||
<jersey-version>1.7</jersey-version>
|
||||
<jackson-version>2.1.4</jackson-version>
|
||||
<jodatime-version>2.3</jodatime-version>
|
||||
|
@ -26,4 +26,4 @@ public class ApiException extends Exception {
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
}
|
@ -185,4 +185,3 @@ public class ApiInvoker {
|
||||
return hostMap.get(host);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,3 @@ public class JsonUtil {
|
||||
return mapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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: <none>
|
||||
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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: <none>
|
||||
public List<Pet> 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet>) 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: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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: <none>
|
||||
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||
//error info- code: 405 reason: "Validation exception" model: <none>
|
||||
|
||||
|
||||
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<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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: <none>
|
||||
public List<Pet> 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet>) 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: <none>
|
||||
public List<Pet> 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet>) 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet> findPetsByStatus (List<String> status) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet>) ApiInvoker.deserialize(response, "Pet", Pet.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<Pet>) 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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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: <none>
|
||||
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<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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: <none>
|
||||
//error info- code: 404 reason: "Order not found" model: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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: <none>
|
||||
//error info- code: 404 reason: "Order not found" model: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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: <none>
|
||||
//error info- code: 404 reason: "User not found" model: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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: <none>
|
||||
//error info- code: 404 reason: "User not found" model: <none>
|
||||
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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: <none>
|
||||
//error info- code: 404 reason: "User not found" model: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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: <none>
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<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/createWithArray".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<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/createWithList".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
/* pet status in the store */
|
||||
private List<String> photoUrls = new ArrayList<String>() ;
|
||||
private List<Tag> tags = new ArrayList<Tag>() ;
|
||||
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<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
@ -41,6 +63,10 @@ public class Pet {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = false, value = "")
|
||||
public List<Tag> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -10,29 +10,29 @@
|
||||
<string>PetstoreClient</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>92840518-904D-4771-AA3D-9AF52CA48B71</key>
|
||||
<key>E5BBF0AA85077C865C95437976D06D819733A208</key>
|
||||
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectPath</key>
|
||||
<string>samples/client/petstore/objc/PetstoreClient.xcworkspace</string>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>92840518-904D-4771-AA3D-9AF52CA48B71</key>
|
||||
<key>E5BBF0AA85077C865C95437976D06D819733A208</key>
|
||||
<string>../../../../..</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>110</integer>
|
||||
<integer>111</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>92840518-904D-4771-AA3D-9AF52CA48B71</string>
|
||||
<string>E5BBF0AA85077C865C95437976D06D819733A208</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>92840518-904D-4771-AA3D-9AF52CA48B71</string>
|
||||
<string>E5BBF0AA85077C865C95437976D06D819733A208</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>swagger-codegen</string>
|
||||
</dict>
|
||||
|
Binary file not shown.
@ -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!");
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user