rebuilt client

This commit is contained in:
Tony Tam
2015-02-15 22:12:48 -08:00
parent 73a6c0c42d
commit d98e894b41
8 changed files with 102 additions and 48 deletions

View File

@@ -15,7 +15,7 @@ import java.util.HashMap;
import java.io.File;
public class PetApi {
String basePath = "http://petstore.swagger.wordnik.com/v2";
String basePath = "http://petstore.swagger.io/v2";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
@@ -73,8 +73,8 @@ public class PetApi {
}
public void addPet (Pet pet) throws ApiException {
Object postBody = pet;
public void addPet (Pet body) throws ApiException {
Object postBody = body;
@@ -300,13 +300,13 @@ public class PetApi {
}
public void uploadImage (File petImage) throws ApiException {
public void uploadFile (String additionalMetadata, File file) throws ApiException {
Object postBody = null;
// create path and map variables
String path = "/pet/{petId}/upload".replaceAll("\\{format\\}","json");
String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();

View File

@@ -7,6 +7,7 @@ import io.swagger.client.model.*;
import java.util.*;
import java.util.Map;
import io.swagger.client.model.Order;
import java.util.Map;
@@ -14,7 +15,7 @@ import java.util.HashMap;
import java.io.File;
public class StoreApi {
String basePath = "http://petstore.swagger.wordnik.com/v2";
String basePath = "http://petstore.swagger.io/v2";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
@@ -35,6 +36,43 @@ public class StoreApi {
public Map<String, Integer> getInventory () throws ApiException {
Object postBody = null;
// create path and map variables
String path = "/store/inventory".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
if(response != null){
return (Map<String, Integer>) ApiInvoker.deserialize(response, "map", Map.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public Order placeOrder (Order body) throws ApiException {
Object postBody = body;

View File

@@ -15,7 +15,7 @@ import java.util.HashMap;
import java.io.File;
public class UserApi {
String basePath = "http://petstore.swagger.wordnik.com/v2";
String basePath = "http://petstore.swagger.io/v2";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {

View File

@@ -2,20 +2,20 @@ package io.swagger.client.model;
import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class Category {
public class Category {
private Long id = null;
//public enum idEnum { };
private String name = null;
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -27,6 +27,7 @@ public class Category {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("name")
public String getName() {
return name;
}

View File

@@ -3,30 +3,27 @@ package io.swagger.client.model;
import java.util.Date;
import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class Order {
public class Order {
private Long id = null;
//public enum idEnum { };
private Long petId = null;
//public enum petIdEnum { };
private Integer quantity = null;
//public enum quantityEnum { };
private Date shipDate = null;
private String status = null;
public enum StatusEnum {
placed, approved, delivered,
};
private StatusEnum status = null;
private Boolean complete = null;
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -38,6 +35,7 @@ public class Order {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("petId")
public Long getPetId() {
return petId;
}
@@ -49,6 +47,7 @@ public class Order {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
}
@@ -60,6 +59,7 @@ public class Order {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
}
@@ -72,10 +72,11 @@ public class Order {
* Order Status
**/
@ApiModelProperty(required = false, value = "Order Status")
public String getStatus() {
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
public void setStatus(String status) {
public void setStatus(StatusEnum status) {
this.status = status;
}
@@ -83,6 +84,7 @@ public class Order {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("complete")
public Boolean getComplete() {
return complete;
}

View File

@@ -1,28 +1,31 @@
package io.swagger.client.model;
import io.swagger.client.model.Category;
import io.swagger.client.model.Tag;
import java.util.*;
import io.swagger.client.model.Tag;
import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class Pet {
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>() ;
private String status = null;
public enum StatusEnum {
available, pending, sold,
};
private StatusEnum status = null;
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -34,6 +37,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("category")
public Category getCategory() {
return category;
}
@@ -45,6 +49,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("name")
public String getName() {
return name;
}
@@ -56,6 +61,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
@@ -67,6 +73,7 @@ public class Pet {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
}
@@ -79,10 +86,11 @@ public class Pet {
* pet status in the store
**/
@ApiModelProperty(required = false, value = "pet status in the store")
public String getStatus() {
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
public void setStatus(String status) {
public void setStatus(StatusEnum status) {
this.status = status;
}

View File

@@ -2,20 +2,20 @@ package io.swagger.client.model;
import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class Tag {
public class Tag {
private Long id = null;
//public enum idEnum { };
private String name = null;
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -27,6 +27,7 @@ public class Tag {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("name")
public String getName() {
return name;
}

View File

@@ -2,14 +2,13 @@ package io.swagger.client.model;
import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class User {
public class User {
private Long id = null;
//public enum idEnum { };
private String username = null;
private String firstName = null;
private String lastName = null;
@@ -17,14 +16,12 @@ public class User {
private String password = null;
private String phone = null;
private Integer userStatus = null;
//public enum userStatusEnum { };
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
@@ -36,6 +33,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("username")
public String getUsername() {
return username;
}
@@ -47,6 +45,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
}
@@ -58,6 +57,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("lastName")
public String getLastName() {
return lastName;
}
@@ -69,6 +69,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("email")
public String getEmail() {
return email;
}
@@ -80,6 +81,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("password")
public String getPassword() {
return password;
}
@@ -91,6 +93,7 @@ public class User {
/**
**/
@ApiModelProperty(required = false, value = "")
@JsonProperty("phone")
public String getPhone() {
return phone;
}
@@ -103,6 +106,7 @@ public class User {
* User Status
**/
@ApiModelProperty(required = false, value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
}