forked from loafle/openapi-generator-original
Revert "Regenerate Android-Java sample"
This reverts commit 15f5eae2a80da4c658b466da04d11d5d51532cee.
This commit is contained in:
parent
15f5eae2a8
commit
1fb2a97497
@ -1,8 +1,6 @@
|
||||
|
||||
group = 'io.swagger'
|
||||
project.version = '1.0.0'
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@ -23,10 +21,8 @@ allprojects {
|
||||
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion '22.0.0'
|
||||
@ -85,7 +81,6 @@ afterEvaluate {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
@ -94,4 +89,3 @@ task sourcesJar(type: Jar) {
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
|
@ -365,10 +365,8 @@ public class ApiInvoker {
|
||||
|
||||
int code = response.getStatusLine().getStatusCode();
|
||||
String responseString = null;
|
||||
if(code == 204) {
|
||||
if(code == 204)
|
||||
responseString = "";
|
||||
return responseString;
|
||||
}
|
||||
else if(code >= 200 && code < 300) {
|
||||
if(response.getEntity() != null) {
|
||||
HttpEntity resEntity = response.getEntity();
|
||||
|
@ -35,10 +35,6 @@ public class JsonUtil {
|
||||
public static Type getListTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Order>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("User".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<User>>(){}.getType();
|
||||
}
|
||||
@ -47,16 +43,16 @@ public class JsonUtil {
|
||||
return new TypeToken<List<Category>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Tag>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Pet".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Pet>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ApiResponse".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<ApiResponse>>(){}.getType();
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Tag>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Order>>(){}.getType();
|
||||
}
|
||||
|
||||
return new TypeToken<List<Object>>(){}.getType();
|
||||
@ -65,10 +61,6 @@ public class JsonUtil {
|
||||
public static Type getTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Order>(){}.getType();
|
||||
}
|
||||
|
||||
if ("User".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<User>(){}.getType();
|
||||
}
|
||||
@ -77,16 +69,16 @@ public class JsonUtil {
|
||||
return new TypeToken<Category>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Tag>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Pet".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Pet>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ApiResponse".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<ApiResponse>(){}.getType();
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Tag>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Order>(){}.getType();
|
||||
}
|
||||
|
||||
return new TypeToken<Object>(){}.getType();
|
||||
|
@ -10,8 +10,6 @@ import java.util.*;
|
||||
|
||||
import io.swagger.client.model.Pet;
|
||||
import java.io.File;
|
||||
import io.swagger.client.model.ApiResponse;
|
||||
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
@ -20,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class PetApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
@ -51,11 +48,6 @@ public class PetApi {
|
||||
public void updatePet (Pet body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
@ -110,11 +102,6 @@ public class PetApi {
|
||||
public void addPet (Pet body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling addPet");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
@ -169,11 +156,6 @@ public class PetApi {
|
||||
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'status' is set
|
||||
if (status == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
||||
@ -186,7 +168,7 @@ public class PetApi {
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("csv", "status", status));
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
|
||||
|
||||
|
||||
|
||||
@ -230,11 +212,6 @@ public class PetApi {
|
||||
public List<Pet> findPetsByTags (List<String> tags) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'tags' is set
|
||||
if (tags == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
||||
@ -247,7 +224,7 @@ public class PetApi {
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("csv", "tags", tags));
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
|
||||
|
||||
|
||||
|
||||
@ -284,8 +261,8 @@ public class PetApi {
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a single pet
|
||||
* @param petId ID of pet to return
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return Pet
|
||||
*/
|
||||
public Pet getPetById (Long petId) throws ApiException {
|
||||
@ -349,7 +326,7 @@ public class PetApi {
|
||||
* @param status Updated status of the pet
|
||||
* @return void
|
||||
*/
|
||||
public void updatePetWithForm (Long petId, String name, String status) throws ApiException {
|
||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
@ -480,9 +457,9 @@ public class PetApi {
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
* @return ApiResponse
|
||||
* @return void
|
||||
*/
|
||||
public ApiResponse uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
|
||||
public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
@ -535,10 +512,10 @@ public class PetApi {
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (ApiResponse) ApiInvoker.deserialize(response, "", ApiResponse.class);
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
@ -546,4 +523,3 @@ public class PetApi {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import java.util.*;
|
||||
import java.util.Map;
|
||||
import io.swagger.client.model.Order;
|
||||
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
|
||||
@ -19,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class StoreApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
@ -103,11 +101,6 @@ public class StoreApi {
|
||||
public Order placeOrder (Order body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
||||
@ -159,7 +152,7 @@ public class StoreApi {
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return Order
|
||||
*/
|
||||
public Order getOrderById (Long orderId) throws ApiException {
|
||||
public Order getOrderById (String orderId) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
@ -272,4 +265,3 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import java.util.*;
|
||||
import io.swagger.client.model.User;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
|
||||
@ -19,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class UserApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
@ -50,11 +48,6 @@ public class UserApi {
|
||||
public void createUser (User body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling createUser");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user".replaceAll("\\{format\\}","json");
|
||||
@ -109,11 +102,6 @@ public class UserApi {
|
||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
|
||||
@ -168,11 +156,6 @@ public class UserApi {
|
||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
|
||||
@ -228,16 +211,6 @@ public class UserApi {
|
||||
public String loginUser (String username, String password) throws ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
|
||||
}
|
||||
|
||||
// verify the required parameter 'password' is set
|
||||
if (password == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("\\{format\\}","json");
|
||||
@ -414,11 +387,6 @@ public class UserApi {
|
||||
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
|
||||
}
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
@ -524,4 +492,3 @@ public class UserApi {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,68 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class ApiResponse {
|
||||
|
||||
@SerializedName("code")
|
||||
private Integer code = null;
|
||||
@SerializedName("type")
|
||||
private String type = null;
|
||||
@SerializedName("message")
|
||||
private String message = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ApiResponse {\n");
|
||||
|
||||
sb.append(" code: ").append(code).append("\n");
|
||||
sb.append(" type: ").append(type).append("\n");
|
||||
sb.append(" message: ").append(message).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Category {
|
||||
|
||||
@ -50,5 +48,3 @@ public class Category {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,12 +2,10 @@ package io.swagger.client.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Order {
|
||||
|
||||
@ -111,5 +109,3 @@ public class Order {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Category;
|
||||
import java.util.*;
|
||||
import io.swagger.client.model.Tag;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Pet {
|
||||
|
||||
@ -20,9 +18,9 @@ public class Pet {
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
private List<String> photoUrls = new ArrayList<String>() ;
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
private List<Tag> tags = new ArrayList<Tag>() ;
|
||||
public enum StatusEnum {
|
||||
available, pending, sold,
|
||||
};
|
||||
@ -113,5 +111,3 @@ public class Pet {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Tag {
|
||||
|
||||
@ -50,5 +48,3 @@ public class Tag {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class User {
|
||||
|
||||
@ -135,5 +133,3 @@ public class User {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user