This commit is contained in:
Tony Tam 2015-10-20 11:42:40 -07:00
parent 295af57c9a
commit 7f5cdba606
15 changed files with 140 additions and 194 deletions

View File

@ -1,89 +1,11 @@
group = 'io.swagger'
version = '1.0.0'
apply plugin: 'java'
apply plugin: 'maven'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
repositories {
jcenter()
}
if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 22
buildToolsVersion '22.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
afterEvaluate {
android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
task.description = "Create jar artifact for ${variant.name}"
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task);
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
} else {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
install {
repositories.mavenInstaller {
pom.artifactId = 'swagger-petstore-okhttp-gson'
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
mavenCentral()
}
dependencies {
@ -93,3 +15,17 @@ dependencies {
compile 'com.brsanthu:migbase64:2.2'
testCompile 'junit:junit:4.8.1'
}
group = 'io.swagger'
version = '1.0.0'
install {
repositories.mavenInstaller {
pom.artifactId = 'swagger-petstore-okhttp-gson'
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}

View File

@ -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-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class Pair {
private String name = "";
private String value = "";

View File

@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -6,15 +6,22 @@ import io.swagger.client.ApiException;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.model.*;
import com.google.gson.reflect.TypeToken;
import com.squareup.okhttp.Call;
import java.lang.reflect.Type;
import java.util.*;
import io.swagger.client.model.Pet;
import java.io.File;
import java.lang.reflect.Type;
import java.util.*;
import java.io.File;
import java.util.Map;
import java.util.HashMap;
public class PetApi {
private ApiClient apiClient;
@ -290,11 +297,7 @@ public class PetApi {
final String contentType = apiClient.selectHeaderContentType(contentTypes);
headerParams.put("Content-Type", contentType);
<<<<<<< HEAD
String[] authNames = new String[] { "api_key", "petstore_auth" };
=======
String[] authNames = new String[] { "api_key" };
>>>>>>> master
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames);
}

View File

@ -6,15 +6,22 @@ import io.swagger.client.ApiException;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.model.*;
import com.google.gson.reflect.TypeToken;
import com.squareup.okhttp.Call;
import java.lang.reflect.Type;
import java.util.*;
import java.util.Map;
import io.swagger.client.model.Order;
import java.lang.reflect.Type;
import java.util.*;
import java.io.File;
import java.util.Map;
import java.util.HashMap;
public class StoreApi {
private ApiClient apiClient;

View File

@ -6,15 +6,22 @@ import io.swagger.client.ApiException;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import io.swagger.client.model.*;
import com.google.gson.reflect.TypeToken;
import com.squareup.okhttp.Call;
import java.lang.reflect.Type;
import java.util.*;
import io.swagger.client.model.User;
import java.util.*;
import java.lang.reflect.Type;
import java.util.*;
import java.io.File;
import java.util.Map;
import java.util.HashMap;
public class UserApi {
private ApiClient apiClient;

View File

@ -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-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;

View File

@ -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-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public interface Authentication {
/** Apply authentication settings to header and query params. */
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);

View File

@ -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-19T23:12:21.445-07:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
public class OAuth implements Authentication {
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {

View File

@ -1,10 +1,6 @@
package io.swagger.client;
<<<<<<< HEAD
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-19T23:12:22.261-07:00")
=======
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-11T00:10:38.251+02:00")
>>>>>>> master
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:31.307-07:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -1,16 +1,15 @@
package io.swagger.client.api;
import io.swagger.client.CollectionFormats.*;
import io.swagger.client.model.*;
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 {
/**
@ -21,7 +20,7 @@ public interface PetApi {
* @return Void
*/
@PUT("/pet")
@PUT("/pet")
Void updatePet(
@Body Pet body
);
@ -30,14 +29,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
@ -47,7 +46,7 @@ public interface PetApi {
* @return Void
*/
@POST("/pet")
@POST("/pet")
Void addPet(
@Body Pet body
);
@ -56,14 +55,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
@ -73,7 +72,7 @@ public interface PetApi {
* @return List<Pet>
*/
@GET("/pet/findByStatus")
@GET("/pet/findByStatus")
List<Pet> findPetsByStatus(
@Query("status") List<String> status
);
@ -82,14 +81,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
@ -99,7 +98,7 @@ public interface PetApi {
* @return List<Pet>
*/
@GET("/pet/findByTags")
@GET("/pet/findByTags")
List<Pet> findPetsByTags(
@Query("tags") List<String> tags
);
@ -108,14 +107,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
@ -125,7 +124,7 @@ public interface PetApi {
* @return Pet
*/
@GET("/pet/{petId}")
@GET("/pet/{petId}")
Pet getPetById(
@Path("petId") Long petId
);
@ -134,14 +133,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
@ -154,7 +153,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
);
@ -165,15 +164,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
@ -184,7 +183,7 @@ public interface PetApi {
* @return Void
*/
@DELETE("/pet/{petId}")
@DELETE("/pet/{petId}")
Void deletePet(
@Path("petId") Long petId, @Header("api_key") String apiKey
);
@ -194,14 +193,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
@ -214,7 +213,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
);
@ -225,14 +224,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
);
);
}

View File

@ -1,16 +1,15 @@
package io.swagger.client.api;
import io.swagger.client.CollectionFormats.*;
import io.swagger.client.model.*;
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 {
/**
@ -20,21 +19,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
@ -44,7 +43,7 @@ public interface StoreApi {
* @return Order
*/
@POST("/store/order")
@POST("/store/order")
Order placeOrder(
@Body Order body
);
@ -53,14 +52,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
@ -70,7 +69,7 @@ public interface StoreApi {
* @return Order
*/
@GET("/store/order/{orderId}")
@GET("/store/order/{orderId}")
Order getOrderById(
@Path("orderId") String orderId
);
@ -79,14 +78,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
@ -96,7 +95,7 @@ public interface StoreApi {
* @return Void
*/
@DELETE("/store/order/{orderId}")
@DELETE("/store/order/{orderId}")
Void deleteOrder(
@Path("orderId") String orderId
);
@ -105,13 +104,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
);
);
}

View File

@ -1,14 +1,13 @@
package io.swagger.client.api;
import io.swagger.client.CollectionFormats.*;
import io.swagger.client.model.*;
import retrofit.Callback;
import retrofit.http.*;
import retrofit.mime.*;
import io.swagger.client.model.User;
import java.util.*;
import io.swagger.client.model.User;
import java.util.*;
public interface UserApi {
@ -21,7 +20,7 @@ public interface UserApi {
* @return Void
*/
@POST("/user")
@POST("/user")
Void createUser(
@Body User body
);
@ -30,14 +29,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
@ -47,7 +46,7 @@ public interface UserApi {
* @return Void
*/
@POST("/user/createWithArray")
@POST("/user/createWithArray")
Void createUsersWithArrayInput(
@Body List<User> body
);
@ -56,14 +55,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
@ -73,7 +72,7 @@ public interface UserApi {
* @return Void
*/
@POST("/user/createWithList")
@POST("/user/createWithList")
Void createUsersWithListInput(
@Body List<User> body
);
@ -82,14 +81,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
@ -100,7 +99,7 @@ public interface UserApi {
* @return String
*/
@GET("/user/login")
@GET("/user/login")
String loginUser(
@Query("username") String username, @Query("password") String password
);
@ -110,14 +109,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
@ -126,21 +125,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
@ -150,7 +149,7 @@ public interface UserApi {
* @return User
*/
@GET("/user/{username}")
@GET("/user/{username}")
User getUserByName(
@Path("username") String username
);
@ -159,14 +158,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
@ -177,7 +176,7 @@ public interface UserApi {
* @return Void
*/
@PUT("/user/{username}")
@PUT("/user/{username}")
Void updateUser(
@Path("username") String username, @Body User body
);
@ -187,14 +186,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
@ -204,7 +203,7 @@ public interface UserApi {
* @return Void
*/
@DELETE("/user/{username}")
@DELETE("/user/{username}")
Void deleteUser(
@Path("username") String username
);
@ -213,13 +212,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
);
);
}