forked from loafle/openapi-generator-original
update java petstore sample
This commit is contained in:
@@ -39,7 +39,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
||||
import io.swagger.client.auth.ApiKeyAuth;
|
||||
import io.swagger.client.auth.OAuth;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-07T15:05:10.376+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class ApiClient {
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
@@ -69,8 +69,8 @@ public class ApiClient {
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<String, Authentication>();
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class ApiException extends Exception {
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Configuration {
|
||||
private static ApiClient defaultApiClient = new ApiClient();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.text.DateFormat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-07T15:05:10.376+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class JSON {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class TypeRef<T> {
|
||||
private final Type type;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.io.File;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-04T19:58:40.953+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class PetApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import io.swagger.client.model.Order;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class StoreApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class UserApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:23.285+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public interface Authentication {
|
||||
/** Apply authentication settings to header and query params. */
|
||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-22T13:15:32.345+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-02T21:16:46.418+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T19:53:03.542+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
||||
@@ -7,11 +7,11 @@ import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T19:53:03.542+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
@@ -19,6 +19,7 @@ public class Order {
|
||||
private Integer quantity = null;
|
||||
private Date shipDate = null;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
PLACED("placed"),
|
||||
APPROVED("approved"),
|
||||
@@ -31,6 +32,7 @@ public enum StatusEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@ package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.StringUtil;
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T19:53:03.542+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
@@ -22,6 +22,7 @@ public class Pet {
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
PENDING("pending"),
|
||||
@@ -34,6 +35,7 @@ public enum StatusEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T19:53:03.542+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T19:53:03.542+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:25.953+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
||||
@@ -43,7 +43,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
||||
import io.swagger.client.auth.ApiKeyAuth;
|
||||
import io.swagger.client.auth.OAuth;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class ApiClient {
|
||||
private Client client;
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
@@ -76,8 +76,8 @@ public class ApiClient {
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<String, Authentication>();
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class ApiException extends Exception {
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Configuration {
|
||||
private static ApiClient defaultApiClient = new ApiClient();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.text.DateFormat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class JSON {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class TypeRef<T> {
|
||||
private final Type type;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.io.File;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class PetApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import io.swagger.client.model.Order;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class StoreApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class UserApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:47.318+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public interface Authentication {
|
||||
/** Apply authentication settings to header and query params. */
|
||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-22T13:15:27.225+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T15:52:25.446+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
@@ -44,8 +44,12 @@ public class Category {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id) &&
|
||||
Objects.equals(name, category.name);
|
||||
|
||||
@@ -7,11 +7,11 @@ import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T15:52:25.446+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
@@ -19,6 +19,7 @@ public class Order {
|
||||
private Integer quantity = null;
|
||||
private Date shipDate = null;
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
PLACED("placed"),
|
||||
APPROVED("approved"),
|
||||
@@ -31,6 +32,7 @@ public enum StatusEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
@@ -116,8 +118,12 @@ public enum StatusEnum {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return Objects.equals(id, order.id) &&
|
||||
Objects.equals(petId, order.petId) &&
|
||||
|
||||
@@ -2,18 +2,18 @@ package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.StringUtil;
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T15:52:25.446+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
@@ -22,6 +22,7 @@ public class Pet {
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
PENDING("pending"),
|
||||
@@ -34,6 +35,7 @@ public enum StatusEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
@@ -118,8 +120,12 @@ public enum StatusEnum {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(id, pet.id) &&
|
||||
Objects.equals(category, pet.category) &&
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T15:52:25.446+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
@@ -44,8 +44,12 @@ public class Tag {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(id, tag.id) &&
|
||||
Objects.equals(name, tag.name);
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.swagger.client.StringUtil;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-23T15:52:25.446+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:01.946+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
@@ -123,8 +123,12 @@ public class User {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) &&
|
||||
Objects.equals(username, user.username) &&
|
||||
|
||||
@@ -143,8 +143,8 @@ public class ApiClient {
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<String, Authentication>();
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.swagger.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class ApiException extends Exception {
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class Configuration {
|
||||
private static ApiClient defaultApiClient = new ApiClient();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public interface Authentication {
|
||||
/** Apply authentication settings to header and query params. */
|
||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T15:16:28.364+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:08.052+08:00")
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.StringUtil;
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
if (authName == "petstore_auth") {
|
||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if (authName == "api_key") {
|
||||
if (authName == "api_key") {
|
||||
auth = new ApiKeyAuth("header", "api_key");
|
||||
} else if (authName == "petstore_auth") {
|
||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:31.307-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:14.988+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.client.model.Pet;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public interface PetApi {
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ public interface PetApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@PUT("/pet")
|
||||
@PUT("/pet")
|
||||
Void updatePet(
|
||||
@Body Pet body
|
||||
);
|
||||
@@ -29,14 +30,14 @@ public interface PetApi {
|
||||
* Update an existing pet
|
||||
* Async method
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@PUT("/pet")
|
||||
@PUT("/pet")
|
||||
void updatePet(
|
||||
@Body Pet body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
@@ -46,7 +47,7 @@ public interface PetApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@POST("/pet")
|
||||
@POST("/pet")
|
||||
Void addPet(
|
||||
@Body Pet body
|
||||
);
|
||||
@@ -55,14 +56,14 @@ public interface PetApi {
|
||||
* Add a new pet to the store
|
||||
* Async method
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@POST("/pet")
|
||||
@POST("/pet")
|
||||
void addPet(
|
||||
@Body Pet body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
@@ -72,7 +73,7 @@ public interface PetApi {
|
||||
* @return List<Pet>
|
||||
*/
|
||||
|
||||
@GET("/pet/findByStatus")
|
||||
@GET("/pet/findByStatus")
|
||||
List<Pet> findPetsByStatus(
|
||||
@Query("status") List<String> status
|
||||
);
|
||||
@@ -81,14 +82,14 @@ public interface PetApi {
|
||||
* Finds Pets by status
|
||||
* Async method
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/pet/findByStatus")
|
||||
@GET("/pet/findByStatus")
|
||||
void findPetsByStatus(
|
||||
@Query("status") List<String> status, Callback<List<Pet>> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
@@ -98,7 +99,7 @@ public interface PetApi {
|
||||
* @return List<Pet>
|
||||
*/
|
||||
|
||||
@GET("/pet/findByTags")
|
||||
@GET("/pet/findByTags")
|
||||
List<Pet> findPetsByTags(
|
||||
@Query("tags") List<String> tags
|
||||
);
|
||||
@@ -107,14 +108,14 @@ public interface PetApi {
|
||||
* Finds Pets by tags
|
||||
* Async method
|
||||
* @param tags Tags to filter by
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/pet/findByTags")
|
||||
@GET("/pet/findByTags")
|
||||
void findPetsByTags(
|
||||
@Query("tags") List<String> tags, Callback<List<Pet>> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
@@ -124,7 +125,7 @@ public interface PetApi {
|
||||
* @return Pet
|
||||
*/
|
||||
|
||||
@GET("/pet/{petId}")
|
||||
@GET("/pet/{petId}")
|
||||
Pet getPetById(
|
||||
@Path("petId") Long petId
|
||||
);
|
||||
@@ -133,14 +134,14 @@ public interface PetApi {
|
||||
* Find pet by ID
|
||||
* Async method
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/pet/{petId}")
|
||||
@GET("/pet/{petId}")
|
||||
void getPetById(
|
||||
@Path("petId") Long petId, Callback<Pet> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
@@ -153,7 +154,7 @@ public interface PetApi {
|
||||
*/
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/pet/{petId}")
|
||||
@POST("/pet/{petId}")
|
||||
Void updatePetWithForm(
|
||||
@Path("petId") String petId, @Field("name") String name, @Field("status") String status
|
||||
);
|
||||
@@ -164,15 +165,15 @@ public interface PetApi {
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/pet/{petId}")
|
||||
@POST("/pet/{petId}")
|
||||
void updatePetWithForm(
|
||||
@Path("petId") String petId, @Field("name") String name, @Field("status") String status, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
@@ -183,7 +184,7 @@ public interface PetApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@DELETE("/pet/{petId}")
|
||||
@DELETE("/pet/{petId}")
|
||||
Void deletePet(
|
||||
@Path("petId") Long petId, @Header("api_key") String apiKey
|
||||
);
|
||||
@@ -193,14 +194,14 @@ public interface PetApi {
|
||||
* Async method
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@DELETE("/pet/{petId}")
|
||||
@DELETE("/pet/{petId}")
|
||||
void deletePet(
|
||||
@Path("petId") Long petId, @Header("api_key") String apiKey, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
@@ -213,7 +214,7 @@ public interface PetApi {
|
||||
*/
|
||||
|
||||
@Multipart
|
||||
@POST("/pet/{petId}/uploadImage")
|
||||
@POST("/pet/{petId}/uploadImage")
|
||||
Void uploadFile(
|
||||
@Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file
|
||||
);
|
||||
@@ -224,14 +225,14 @@ public interface PetApi {
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@Multipart
|
||||
@POST("/pet/{petId}/uploadImage")
|
||||
@POST("/pet/{petId}/uploadImage")
|
||||
void uploadFile(
|
||||
@Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Map;
|
||||
import io.swagger.client.model.Order;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public interface StoreApi {
|
||||
|
||||
/**
|
||||
@@ -19,21 +20,21 @@ public interface StoreApi {
|
||||
* @return Map<String, Integer>
|
||||
*/
|
||||
|
||||
@GET("/store/inventory")
|
||||
@GET("/store/inventory")
|
||||
Map<String, Integer> getInventory();
|
||||
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Async method
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/store/inventory")
|
||||
@GET("/store/inventory")
|
||||
void getInventory(
|
||||
Callback<Map<String, Integer>> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
@@ -43,7 +44,7 @@ public interface StoreApi {
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
@POST("/store/order")
|
||||
@POST("/store/order")
|
||||
Order placeOrder(
|
||||
@Body Order body
|
||||
);
|
||||
@@ -52,14 +53,14 @@ public interface StoreApi {
|
||||
* Place an order for a pet
|
||||
* Async method
|
||||
* @param body order placed for purchasing the pet
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@POST("/store/order")
|
||||
@POST("/store/order")
|
||||
void placeOrder(
|
||||
@Body Order body, Callback<Order> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
@@ -69,7 +70,7 @@ public interface StoreApi {
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
@GET("/store/order/{orderId}")
|
||||
@GET("/store/order/{orderId}")
|
||||
Order getOrderById(
|
||||
@Path("orderId") String orderId
|
||||
);
|
||||
@@ -78,14 +79,14 @@ public interface StoreApi {
|
||||
* Find purchase order by ID
|
||||
* Async method
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/store/order/{orderId}")
|
||||
@GET("/store/order/{orderId}")
|
||||
void getOrderById(
|
||||
@Path("orderId") String orderId, Callback<Order> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
@@ -95,7 +96,7 @@ public interface StoreApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@DELETE("/store/order/{orderId}")
|
||||
@DELETE("/store/order/{orderId}")
|
||||
Void deleteOrder(
|
||||
@Path("orderId") String orderId
|
||||
);
|
||||
@@ -104,13 +105,13 @@ public interface StoreApi {
|
||||
* Delete purchase order by ID
|
||||
* Async method
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@DELETE("/store/order/{orderId}")
|
||||
@DELETE("/store/order/{orderId}")
|
||||
void deleteOrder(
|
||||
@Path("orderId") String orderId, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.model.*;
|
||||
import io.swagger.client.CollectionFormats.*;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.http.*;
|
||||
import retrofit.mime.*;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.client.model.User;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public interface UserApi {
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@POST("/user")
|
||||
@POST("/user")
|
||||
Void createUser(
|
||||
@Body User body
|
||||
);
|
||||
@@ -29,14 +30,14 @@ public interface UserApi {
|
||||
* Create user
|
||||
* Async method
|
||||
* @param body Created user object
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@POST("/user")
|
||||
@POST("/user")
|
||||
void createUser(
|
||||
@Body User body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -46,7 +47,7 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@POST("/user/createWithArray")
|
||||
@POST("/user/createWithArray")
|
||||
Void createUsersWithArrayInput(
|
||||
@Body List<User> body
|
||||
);
|
||||
@@ -55,14 +56,14 @@ public interface UserApi {
|
||||
* Creates list of users with given input array
|
||||
* Async method
|
||||
* @param body List of user object
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@POST("/user/createWithArray")
|
||||
@POST("/user/createWithArray")
|
||||
void createUsersWithArrayInput(
|
||||
@Body List<User> body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -72,7 +73,7 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@POST("/user/createWithList")
|
||||
@POST("/user/createWithList")
|
||||
Void createUsersWithListInput(
|
||||
@Body List<User> body
|
||||
);
|
||||
@@ -81,14 +82,14 @@ public interface UserApi {
|
||||
* Creates list of users with given input array
|
||||
* Async method
|
||||
* @param body List of user object
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@POST("/user/createWithList")
|
||||
@POST("/user/createWithList")
|
||||
void createUsersWithListInput(
|
||||
@Body List<User> body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
@@ -99,7 +100,7 @@ public interface UserApi {
|
||||
* @return String
|
||||
*/
|
||||
|
||||
@GET("/user/login")
|
||||
@GET("/user/login")
|
||||
String loginUser(
|
||||
@Query("username") String username, @Query("password") String password
|
||||
);
|
||||
@@ -109,14 +110,14 @@ public interface UserApi {
|
||||
* Async method
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/user/login")
|
||||
@GET("/user/login")
|
||||
void loginUser(
|
||||
@Query("username") String username, @Query("password") String password, Callback<String> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
@@ -125,21 +126,21 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@GET("/user/logout")
|
||||
@GET("/user/logout")
|
||||
Void logoutUser();
|
||||
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
* Async method
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/user/logout")
|
||||
@GET("/user/logout")
|
||||
void logoutUser(
|
||||
Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
@@ -149,7 +150,7 @@ public interface UserApi {
|
||||
* @return User
|
||||
*/
|
||||
|
||||
@GET("/user/{username}")
|
||||
@GET("/user/{username}")
|
||||
User getUserByName(
|
||||
@Path("username") String username
|
||||
);
|
||||
@@ -158,14 +159,14 @@ public interface UserApi {
|
||||
* Get user by user name
|
||||
* Async method
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@GET("/user/{username}")
|
||||
@GET("/user/{username}")
|
||||
void getUserByName(
|
||||
@Path("username") String username, Callback<User> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
@@ -176,7 +177,7 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@PUT("/user/{username}")
|
||||
@PUT("/user/{username}")
|
||||
Void updateUser(
|
||||
@Path("username") String username, @Body User body
|
||||
);
|
||||
@@ -186,14 +187,14 @@ public interface UserApi {
|
||||
* Async method
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@PUT("/user/{username}")
|
||||
@PUT("/user/{username}")
|
||||
void updateUser(
|
||||
@Path("username") String username, @Body User body, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
@@ -203,7 +204,7 @@ public interface UserApi {
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@DELETE("/user/{username}")
|
||||
@DELETE("/user/{username}")
|
||||
Void deleteUser(
|
||||
@Path("username") String username
|
||||
);
|
||||
@@ -212,13 +213,13 @@ public interface UserApi {
|
||||
* Delete user
|
||||
* Async method
|
||||
* @param username The name that needs to be deleted
|
||||
* @param cb callback method
|
||||
* @param cb callback method
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@DELETE("/user/{username}")
|
||||
@DELETE("/user/{username}")
|
||||
void deleteUser(
|
||||
@Path("username") String username, Callback<Void> cb
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.swagger.client.auth;
|
||||
|
||||
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
|
||||
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -85,42 +86,55 @@ public class OAuth implements Interceptor {
|
||||
updateAccessToken(null);
|
||||
}
|
||||
|
||||
// Build the request
|
||||
Builder rb = request.newBuilder();
|
||||
|
||||
String requestAccessToken = new String(getAccessToken());
|
||||
try {
|
||||
oAuthRequest = new OAuthBearerClientRequest(request.urlString())
|
||||
.setAccessToken(requestAccessToken)
|
||||
.buildHeaderMessage();
|
||||
} catch (OAuthSystemException e) {
|
||||
throw new IOException(e);
|
||||
if (getAccessToken() != null) {
|
||||
// Build the request
|
||||
Builder rb = request.newBuilder();
|
||||
|
||||
String requestAccessToken = new String(getAccessToken());
|
||||
try {
|
||||
oAuthRequest = new OAuthBearerClientRequest(request.urlString())
|
||||
.setAccessToken(requestAccessToken)
|
||||
.buildHeaderMessage();
|
||||
} catch (OAuthSystemException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
for ( Map.Entry<String, String> header : oAuthRequest.getHeaders().entrySet() ) {
|
||||
rb.addHeader(header.getKey(), header.getValue());
|
||||
}
|
||||
rb.url( oAuthRequest.getLocationUri());
|
||||
|
||||
//Execute the request
|
||||
Response response = chain.proceed(rb.build());
|
||||
|
||||
// 401 most likely indicates that access token has expired.
|
||||
// Time to refresh and resend the request
|
||||
if ( response != null && (response.code() == HTTP_UNAUTHORIZED | response.code() == HTTP_FORBIDDEN) ) {
|
||||
if (updateAccessToken(requestAccessToken)) {
|
||||
return intercept( chain );
|
||||
}
|
||||
}
|
||||
return response;
|
||||
} else {
|
||||
return chain.proceed(chain.request());
|
||||
}
|
||||
|
||||
for ( Map.Entry<String, String> header : oAuthRequest.getHeaders().entrySet() ) {
|
||||
rb.addHeader(header.getKey(), header.getValue());
|
||||
}
|
||||
rb.url( oAuthRequest.getLocationUri());
|
||||
|
||||
//Execute the request
|
||||
Response response = chain.proceed(rb.build());
|
||||
|
||||
// 401 most likely indicates that access token has expired.
|
||||
// Time to refresh and resend the request
|
||||
if ( response.code() == HTTP_UNAUTHORIZED ) {
|
||||
updateAccessToken(requestAccessToken);
|
||||
return intercept( chain );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public synchronized void updateAccessToken(String requestAccessToken) throws IOException {
|
||||
/*
|
||||
* Returns true if the access token has been updated
|
||||
*/
|
||||
public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException {
|
||||
if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) {
|
||||
try {
|
||||
OAuthJSONAccessTokenResponse accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage());
|
||||
setAccessToken(accessTokenResponse.getAccessToken());
|
||||
if (accessTokenListener != null) {
|
||||
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());
|
||||
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
|
||||
setAccessToken(accessTokenResponse.getAccessToken());
|
||||
if (accessTokenListener != null) {
|
||||
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());
|
||||
}
|
||||
return getAccessToken().equals(requestAccessToken);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (OAuthSystemException e) {
|
||||
throw new IOException(e);
|
||||
@@ -128,6 +142,7 @@ public class OAuth implements Interceptor {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.StringUtil;
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
if (authName == "petstore_auth") {
|
||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if (authName == "api_key") {
|
||||
if (authName == "api_key") {
|
||||
auth = new ApiKeyAuth("header", "api_key");
|
||||
} else if (authName == "petstore_auth") {
|
||||
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-10T12:25:26.227+01:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-29T00:18:18.137+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.StringUtil;
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user