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.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import com.wordnik.client.model.Pet;
|
|
||||||
|
import com.wordnik.client.model.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.wordnik.client.model.Pet;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
String basePath = "";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public void addHeader(String key, String value) {
|
public void addHeader(String key, String value) {
|
||||||
@ -30,6 +36,8 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
public void updatePet (Pet body) throws ApiException {
|
public void updatePet (Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -46,7 +54,7 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
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
|
// create path and map variables
|
||||||
@ -81,7 +91,7 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -100,6 +110,8 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
|
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -118,7 +130,7 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Pet", Pet.class);
|
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 {
|
public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -155,7 +169,7 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Pet", Pet.class);
|
return (List<Pet>) ApiInvoker.deserialize(response, "Pet", Pet.class);
|
||||||
}
|
}
|
||||||
@ -174,6 +188,8 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
public Pet getPetById (Long petId) throws ApiException {
|
public Pet getPetById (Long petId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -190,7 +206,7 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
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
|
// create path and map variables
|
||||||
@ -225,7 +243,45 @@ public class PetApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,19 @@ package com.wordnik.client.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import com.wordnik.client.model.Order;
|
|
||||||
|
import com.wordnik.client.model.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.wordnik.client.model.Order;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
String basePath = "";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public void addHeader(String key, String value) {
|
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
|
// create path and map variables
|
||||||
@ -46,16 +54,16 @@ public class StoreApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (ApiException ex) {
|
} catch (ApiException ex) {
|
||||||
if(ex.getCode() == 404) {
|
if(ex.getCode() == 404) {
|
||||||
return ;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ex;
|
throw ex;
|
||||||
@ -65,6 +73,8 @@ public class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
public Order getOrderById (String orderId) throws ApiException {
|
public Order getOrderById (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -81,7 +91,7 @@ public class StoreApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||||
}
|
}
|
||||||
@ -100,6 +110,8 @@ public class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
public void deleteOrder (String orderId) throws ApiException {
|
public void deleteOrder (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -116,7 +128,7 @@ public class StoreApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,20 @@ package com.wordnik.client.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
|
|
||||||
|
import com.wordnik.client.model.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import com.wordnik.client.model.User;
|
import com.wordnik.client.model.User;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
String basePath = "";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public void addHeader(String key, String value) {
|
public void addHeader(String key, String value) {
|
||||||
@ -31,6 +37,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void createUser (User body) throws ApiException {
|
public void createUser (User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -47,7 +55,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -66,6 +74,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -82,7 +92,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -101,6 +111,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -117,7 +129,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -136,6 +148,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public String loginUser (String username, String password) throws ApiException {
|
public String loginUser (String username, String password) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -156,7 +170,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (String) ApiInvoker.deserialize(response, "", String.class);
|
return (String) ApiInvoker.deserialize(response, "", String.class);
|
||||||
}
|
}
|
||||||
@ -175,6 +189,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void logoutUser () throws ApiException {
|
public void logoutUser () throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -191,7 +207,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -210,6 +226,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public User getUserByName (String username) throws ApiException {
|
public User getUserByName (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -226,7 +244,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||||
}
|
}
|
||||||
@ -245,6 +263,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void updateUser (String username, User body) throws ApiException {
|
public void updateUser (String username, User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -261,7 +281,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -280,6 +300,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
public void deleteUser (String username) throws ApiException {
|
public void deleteUser (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -296,7 +318,7 @@ public class UserApi {
|
|||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
|
||||||
try {
|
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){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,12 @@ public class Order {
|
|||||||
|
|
||||||
private Date shipDate = null;
|
private Date shipDate = null;
|
||||||
private String status = null;
|
private String status = null;
|
||||||
|
private Boolean complete = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = true, value = "")
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -68,8 +69,9 @@ public class Order {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Order Status
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = false, value = "")
|
@ApiModelProperty(required = false, value = "Order Status")
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@ -89,6 +102,7 @@ public class Order {
|
|||||||
sb.append(" quantity: ").append(quantity).append("\n");
|
sb.append(" quantity: ").append(quantity).append("\n");
|
||||||
sb.append(" shipDate: ").append(shipDate).append("\n");
|
sb.append(" shipDate: ").append(shipDate).append("\n");
|
||||||
sb.append(" status: ").append(status).append("\n");
|
sb.append(" status: ").append(status).append("\n");
|
||||||
|
sb.append(" complete: ").append(complete).append("\n");
|
||||||
sb.append("}\n");
|
sb.append("}\n");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,7 @@ import java.util.*;
|
|||||||
import com.wordnik.swagger.annotations.*;
|
import com.wordnik.swagger.annotations.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
@ApiModel(description = "")
|
||||||
* A single pet in the store
|
|
||||||
**/
|
|
||||||
@ApiModel(description = "A single pet in the store")
|
|
||||||
public class Pet {
|
public class Pet {
|
||||||
private Long id = null;
|
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() {
|
public Long getId() {
|
||||||
return id;
|
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() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class Tag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = true, value = "")
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ public class Tag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = true, value = "")
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,9 @@ public class User {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* User Status
|
||||||
**/
|
**/
|
||||||
@ApiModelProperty(required = false, value = "")
|
@ApiModelProperty(required = false, value = "User Status")
|
||||||
public Integer getUserStatus() {
|
public Integer getUserStatus() {
|
||||||
return userStatus;
|
return userStatus;
|
||||||
}
|
}
|
||||||
|
@ -107,35 +107,35 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.wordnik</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations-version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey</groupId>
|
<groupId>com.sun.jersey</groupId>
|
||||||
<artifactId>jersey-client</artifactId>
|
<artifactId>jersey-client</artifactId>
|
||||||
<version>${jersey-version}</version>
|
<version>${jersey-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey.contribs</groupId>
|
<groupId>com.sun.jersey.contribs</groupId>
|
||||||
<artifactId>jersey-multipart</artifactId>
|
<artifactId>jersey-multipart</artifactId>
|
||||||
<version>${jersey-version}</version>
|
<version>${jersey-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
@ -146,7 +146,6 @@
|
|||||||
<groupId>joda-time</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>${jodatime-version}</version>
|
<version>${jodatime-version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
@ -157,8 +156,14 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
<properties>
|
<properties>
|
||||||
|
<swagger-annotations-version>1.5.0-SNAPSHOT</swagger-annotations-version>
|
||||||
<jersey-version>1.7</jersey-version>
|
<jersey-version>1.7</jersey-version>
|
||||||
<jackson-version>2.1.4</jackson-version>
|
<jackson-version>2.1.4</jackson-version>
|
||||||
<jodatime-version>2.3</jodatime-version>
|
<jodatime-version>2.3</jodatime-version>
|
||||||
|
@ -26,4 +26,4 @@ public class ApiException extends Exception {
|
|||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -185,4 +185,3 @@ public class ApiInvoker {
|
|||||||
return hostMap.get(host);
|
return hostMap.get(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,4 +21,3 @@ public class JsonUtil {
|
|||||||
return mapper;
|
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.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
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 com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public ApiInvoker getInvoker() {
|
public ApiInvoker getInvoker() {
|
||||||
return apiInvoker;
|
return apiInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBasePath(String basePath) {
|
public void setBasePath(String basePath) {
|
||||||
this.basePath = basePath;
|
this.basePath = basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBasePath() {
|
public String getBasePath() {
|
||||||
return basePath;
|
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 {
|
public void updatePet (Pet body) throws ApiException {
|
||||||
Object postBody = body;
|
Object postBody = body;
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
@ -279,19 +47,26 @@ public class PetApi {
|
|||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] contentTypes = {
|
String[] contentTypes = {
|
||||||
"application/json"};
|
"application/json","application/xml"
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
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;
|
public void addPet (Pet pet) throws ApiException {
|
||||||
// verify required params are set
|
Object postBody = pet;
|
||||||
if(status == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = 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[] contentTypes = {
|
||||||
"application/json"};
|
"application/json","application/xml"
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
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.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
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 com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public ApiInvoker getInvoker() {
|
public ApiInvoker getInvoker() {
|
||||||
return apiInvoker;
|
return apiInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBasePath(String basePath) {
|
public void setBasePath(String basePath) {
|
||||||
this.basePath = basePath;
|
this.basePath = basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBasePath() {
|
public String getBasePath() {
|
||||||
return basePath;
|
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;
|
Object postBody = body;
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
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> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] contentTypes = {
|
String[] contentTypes = {
|
||||||
"application/json"};
|
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (ApiException ex) {
|
} catch (ApiException ex) {
|
||||||
if(ex.getCode() == 404) {
|
if(ex.getCode() == 404) {
|
||||||
return ;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ex;
|
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;
|
Object postBody = null;
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
// 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
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] contentTypes = {
|
String[] contentTypes = {
|
||||||
"application/json"};
|
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
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.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
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 com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/v2";
|
||||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||||
|
|
||||||
public ApiInvoker getInvoker() {
|
public ApiInvoker getInvoker() {
|
||||||
return apiInvoker;
|
return apiInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBasePath(String basePath) {
|
public void setBasePath(String basePath) {
|
||||||
this.basePath = basePath;
|
this.basePath = basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBasePath() {
|
public String getBasePath() {
|
||||||
return basePath;
|
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;
|
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
|
// 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
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] contentTypes = {
|
String[] contentTypes = {
|
||||||
"application/json"};
|
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
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 {
|
public void deleteUser (String username) throws ApiException {
|
||||||
Object postBody = null;
|
Object postBody = null;
|
||||||
// verify required params are set
|
|
||||||
if(username == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
// 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
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] contentTypes = {
|
String[] contentTypes = {
|
||||||
"application/json"};
|
|
||||||
|
};
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
boolean hasFields = false;
|
boolean hasFields = false;
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
|
||||||
if(hasFields)
|
if(hasFields)
|
||||||
postBody = mp;
|
postBody = mp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
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;
|
private Long id = null;
|
||||||
|
|
||||||
|
//public enum idEnum { };
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -10,6 +23,10 @@ public class Category {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -17,14 +34,16 @@ public class Category {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Category {\n");
|
sb.append("class Category {\n");
|
||||||
|
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" name: ").append(name).append("\n");
|
sb.append(" name: ").append(name).append("\n");
|
||||||
sb.append("}\n");
|
sb.append("}\n");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,32 @@
|
|||||||
package com.wordnik.petstore.model;
|
package com.wordnik.client.model;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
public class Order {
|
|
||||||
|
import com.wordnik.swagger.annotations.*;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModel(description = "")
|
||||||
|
public class Order {
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
|
||||||
|
//public enum idEnum { };
|
||||||
|
|
||||||
private Long petId = null;
|
private Long petId = null;
|
||||||
|
|
||||||
|
//public enum petIdEnum { };
|
||||||
|
|
||||||
private Integer quantity = null;
|
private Integer quantity = null;
|
||||||
/* Order Status */
|
|
||||||
private String status = null;
|
//public enum quantityEnum { };
|
||||||
//public enum statusEnum { placed, approved, delivered, };
|
|
||||||
private Date shipDate = null;
|
private Date shipDate = null;
|
||||||
|
private String status = null;
|
||||||
|
private Boolean complete = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -16,6 +34,10 @@ public class Order {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getPetId() {
|
public Long getPetId() {
|
||||||
return petId;
|
return petId;
|
||||||
}
|
}
|
||||||
@ -23,6 +45,10 @@ public class Order {
|
|||||||
this.petId = petId;
|
this.petId = petId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Integer getQuantity() {
|
public Integer getQuantity() {
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
@ -30,13 +56,10 @@ public class Order {
|
|||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
/**
|
||||||
}
|
**/
|
||||||
public void setStatus(String status) {
|
@ApiModelProperty(required = false, value = "")
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getShipDate() {
|
public Date getShipDate() {
|
||||||
return shipDate;
|
return shipDate;
|
||||||
}
|
}
|
||||||
@ -44,17 +67,43 @@ public class Order {
|
|||||||
this.shipDate = shipDate;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Order {\n");
|
sb.append("class Order {\n");
|
||||||
|
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" petId: ").append(petId).append("\n");
|
sb.append(" petId: ").append(petId).append("\n");
|
||||||
sb.append(" quantity: ").append(quantity).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(" shipDate: ").append(shipDate).append("\n");
|
||||||
|
sb.append(" status: ").append(status).append("\n");
|
||||||
|
sb.append(" complete: ").append(complete).append("\n");
|
||||||
sb.append("}\n");
|
sb.append("}\n");
|
||||||
return sb.toString();
|
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 java.util.*;
|
||||||
import com.wordnik.petstore.model.Category;
|
|
||||||
import com.wordnik.petstore.model.Tag;
|
import com.wordnik.swagger.annotations.*;
|
||||||
public class Pet {
|
|
||||||
/* unique identifier for the pet */
|
|
||||||
|
@ApiModel(description = "")
|
||||||
|
public class Pet {
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
|
||||||
|
//public enum idEnum { };
|
||||||
|
|
||||||
private Category category = null;
|
private Category category = null;
|
||||||
private String name = null;
|
private String name = null;
|
||||||
private List<String> photoUrls = new ArrayList<String>();
|
private List<String> photoUrls = new ArrayList<String>() ;
|
||||||
private List<Tag> tags = new ArrayList<Tag>();
|
private List<Tag> tags = new ArrayList<Tag>() ;
|
||||||
/* pet status in the store */
|
|
||||||
private String status = null;
|
private String status = null;
|
||||||
//public enum statusEnum { available, pending, sold, };
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -20,6 +30,10 @@ public class Pet {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Category getCategory() {
|
public Category getCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
@ -27,6 +41,10 @@ public class Pet {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = true, value = "")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -34,6 +52,10 @@ public class Pet {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = true, value = "")
|
||||||
public List<String> getPhotoUrls() {
|
public List<String> getPhotoUrls() {
|
||||||
return photoUrls;
|
return photoUrls;
|
||||||
}
|
}
|
||||||
@ -41,6 +63,10 @@ public class Pet {
|
|||||||
this.photoUrls = photoUrls;
|
this.photoUrls = photoUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public List<Tag> getTags() {
|
public List<Tag> getTags() {
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
@ -48,6 +74,11 @@ public class Pet {
|
|||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "pet status in the store")
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -55,10 +86,13 @@ public class Pet {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Pet {\n");
|
sb.append("class Pet {\n");
|
||||||
|
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" category: ").append(category).append("\n");
|
sb.append(" category: ").append(category).append("\n");
|
||||||
sb.append(" name: ").append(name).append("\n");
|
sb.append(" name: ").append(name).append("\n");
|
||||||
@ -69,4 +103,3 @@ public class Pet {
|
|||||||
return sb.toString();
|
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;
|
private Long id = null;
|
||||||
|
|
||||||
|
//public enum idEnum { };
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -10,6 +23,10 @@ public class Tag {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -17,14 +34,16 @@ public class Tag {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Tag {\n");
|
sb.append("class Tag {\n");
|
||||||
|
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" name: ").append(name).append("\n");
|
sb.append(" name: ").append(name).append("\n");
|
||||||
sb.append("}\n");
|
sb.append("}\n");
|
||||||
return sb.toString();
|
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 Long id = null;
|
||||||
private String firstName = null;
|
|
||||||
|
//public enum idEnum { };
|
||||||
|
|
||||||
private String username = null;
|
private String username = null;
|
||||||
|
private String firstName = null;
|
||||||
private String lastName = null;
|
private String lastName = null;
|
||||||
private String email = null;
|
private String email = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
private String phone = null;
|
private String phone = null;
|
||||||
/* User Status */
|
|
||||||
private Integer userStatus = null;
|
private Integer userStatus = null;
|
||||||
//public enum userStatusEnum { 1-registered, 2-active, 3-closed, };
|
|
||||||
|
//public enum userStatusEnum { };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -18,13 +32,10 @@ public class User {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFirstName() {
|
|
||||||
return firstName;
|
/**
|
||||||
}
|
**/
|
||||||
public void setFirstName(String firstName) {
|
@ApiModelProperty(required = false, value = "")
|
||||||
this.firstName = firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
@ -32,6 +43,21 @@ public class User {
|
|||||||
this.username = username;
|
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() {
|
public String getLastName() {
|
||||||
return lastName;
|
return lastName;
|
||||||
}
|
}
|
||||||
@ -39,6 +65,10 @@ public class User {
|
|||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
@ -46,6 +76,10 @@ public class User {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
@ -53,6 +87,10 @@ public class User {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "")
|
||||||
public String getPhone() {
|
public String getPhone() {
|
||||||
return phone;
|
return phone;
|
||||||
}
|
}
|
||||||
@ -60,6 +98,11 @@ public class User {
|
|||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User Status
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(required = false, value = "User Status")
|
||||||
public Integer getUserStatus() {
|
public Integer getUserStatus() {
|
||||||
return userStatus;
|
return userStatus;
|
||||||
}
|
}
|
||||||
@ -67,13 +110,16 @@ public class User {
|
|||||||
this.userStatus = userStatus;
|
this.userStatus = userStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class User {\n");
|
sb.append("class User {\n");
|
||||||
|
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" firstName: ").append(firstName).append("\n");
|
|
||||||
sb.append(" username: ").append(username).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(" lastName: ").append(lastName).append("\n");
|
||||||
sb.append(" email: ").append(email).append("\n");
|
sb.append(" email: ").append(email).append("\n");
|
||||||
sb.append(" password: ").append(password).append("\n");
|
sb.append(" password: ").append(password).append("\n");
|
||||||
@ -83,4 +129,3 @@ public class User {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,29 +10,29 @@
|
|||||||
<string>PetstoreClient</string>
|
<string>PetstoreClient</string>
|
||||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>92840518-904D-4771-AA3D-9AF52CA48B71</key>
|
<key>E5BBF0AA85077C865C95437976D06D819733A208</key>
|
||||||
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IDESourceControlProjectPath</key>
|
<key>IDESourceControlProjectPath</key>
|
||||||
<string>samples/client/petstore/objc/PetstoreClient.xcworkspace</string>
|
<string>samples/client/petstore/objc/PetstoreClient.xcworkspace</string>
|
||||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>92840518-904D-4771-AA3D-9AF52CA48B71</key>
|
<key>E5BBF0AA85077C865C95437976D06D819733A208</key>
|
||||||
<string>../../../../..</string>
|
<string>../../../../..</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IDESourceControlProjectURL</key>
|
<key>IDESourceControlProjectURL</key>
|
||||||
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
<string>ssh://github.com/wordnik/swagger-codegen.git</string>
|
||||||
<key>IDESourceControlProjectVersion</key>
|
<key>IDESourceControlProjectVersion</key>
|
||||||
<integer>110</integer>
|
<integer>111</integer>
|
||||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||||
<string>92840518-904D-4771-AA3D-9AF52CA48B71</string>
|
<string>E5BBF0AA85077C865C95437976D06D819733A208</string>
|
||||||
<key>IDESourceControlProjectWCConfigurations</key>
|
<key>IDESourceControlProjectWCConfigurations</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||||
<string>public.vcs.git</string>
|
<string>public.vcs.git</string>
|
||||||
<key>IDESourceControlWCCIdentifierKey</key>
|
<key>IDESourceControlWCCIdentifierKey</key>
|
||||||
<string>92840518-904D-4771-AA3D-9AF52CA48B71</string>
|
<string>E5BBF0AA85077C865C95437976D06D819733A208</string>
|
||||||
<key>IDESourceControlWCCName</key>
|
<key>IDESourceControlWCCName</key>
|
||||||
<string>swagger-codegen</string>
|
<string>swagger-codegen</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
Binary file not shown.
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
[api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) {
|
[api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) {
|
||||||
NSLog(@"%@", [output asDictionary]);
|
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
|
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;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +54,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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 {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = pet;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -158,9 +160,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -170,25 +172,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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
|
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// 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
|
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// 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
|
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -416,6 +421,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -470,6 +476,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// 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
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -203,6 +205,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
|
@ -54,6 +54,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -72,9 +73,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -84,25 +85,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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 {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -158,9 +160,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -170,25 +172,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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 {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -244,9 +247,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -256,25 +259,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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
|
completionHandler: (void (^)(NSString* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/login", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/login", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -367,6 +371,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
(void (^)(NSError* error))completionBlock {
|
(void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/logout", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/logout", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// 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
|
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -478,6 +484,7 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = body;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -497,9 +504,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
|
|
||||||
id bodyDictionary = nil;
|
id bodyDictionary = nil;
|
||||||
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
if(m_body != nil && [m_body isKindOfClass:[NSArray class]]){
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
for (id dict in (NSArray*)body) {
|
for (id dict in (NSArray*)m_body) {
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
}
|
}
|
||||||
@ -509,25 +516,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/v2";
|
|||||||
}
|
}
|
||||||
bodyDictionary = objs;
|
bodyDictionary = objs;
|
||||||
}
|
}
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
else if([m_body respondsToSelector:@selector(asDictionary)]) {
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
bodyDictionary = [(SWGObject*)m_body asDictionary];
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
else if([m_body isKindOfClass:[NSString class]]) {
|
||||||
// convert it to a dictionary
|
// convert it to a dictionary
|
||||||
NSError * error;
|
NSError * error;
|
||||||
NSString * str = (NSString*)body;
|
NSString * str = (NSString*)m_body;
|
||||||
NSDictionary *JSON =
|
NSDictionary *JSON =
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
options:NSJSONReadingMutableContainers
|
options:NSJSONReadingMutableContainers
|
||||||
error:&error];
|
error:&error];
|
||||||
bodyDictionary = JSON;
|
bodyDictionary = JSON;
|
||||||
}
|
}
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
else if([m_body isKindOfClass: [SWGFile class]]) {
|
||||||
requestContentType = @"form-data";
|
requestContentType = @"form-data";
|
||||||
bodyDictionary = body;
|
bodyDictionary = m_body;
|
||||||
}
|
}
|
||||||
else{
|
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 {
|
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||||
|
|
||||||
|
id m_body = nil;
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user