Merge pull request #2325 from cbornet/scalar_converter

Add scalar converter to retrofit2
This commit is contained in:
wing328 2016-03-08 15:50:45 +08:00
commit c9434347c2
22 changed files with 646 additions and 59 deletions

View File

@ -12,8 +12,9 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil
import retrofit2.Converter; import retrofit2.Converter;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
{{#useRxJava}}import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;{{/useRxJava}} {{#useRxJava}}import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;{{/useRxJava}}
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -120,6 +121,7 @@ public class ApiClient {
.baseUrl(baseUrl) .baseUrl(baseUrl)
.client(okClient) .client(okClient)
{{#useRxJava}}.addCallAdapterFactory(RxJavaCallAdapterFactory.create()){{/useRxJava}} {{#useRxJava}}.addCallAdapterFactory(RxJavaCallAdapterFactory.create()){{/useRxJava}}
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(gson)); .addConverterFactory(GsonCustomConverterFactory.create(gson));
} }

View File

@ -103,6 +103,7 @@ ext {
dependencies { dependencies {
compile "com.squareup.retrofit2:retrofit:$retrofit_version" compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-scalars:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version" compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
{{#useRxJava}} {{#useRxJava}}
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version" compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"

View File

@ -118,38 +118,31 @@
<artifactId>retrofit</artifactId> <artifactId>retrofit</artifactId>
<version>${retrofit-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-scalars</artifactId>
<version>${retrofit-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.squareup.retrofit2</groupId> <groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId> <artifactId>converter-gson</artifactId>
<version>${retrofit-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.oltu.oauth2</groupId> <groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId> <artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu-version}</version> <version>${oltu-version}</version>
</dependency>{{#useRxJava}}
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>${rxjava-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.retrofit2</groupId>
<artifactId>okhttp</artifactId> <artifactId>adapter-rxjava</artifactId>
<version>${okhttp-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>{{/useRxJava}}
{{#useRxJava}}
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>${rxjava-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>adapter-rxjava</artifactId>
<version>${retrofit-version}</version>
</dependency>
{{/useRxJava}}
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
@ -161,10 +154,8 @@
</dependencies> </dependencies>
<properties> <properties>
<swagger-annotations-version>1.5.0</swagger-annotations-version> <swagger-annotations-version>1.5.0</swagger-annotations-version>
<retrofit-version>2.0.0-beta4</retrofit-version> <retrofit-version>2.0.0-beta4</retrofit-version>{{#useRxJava}}
{{#useRxJava}}<rxjava-version>1.0.16</rxjava-version>{{/useRxJava}} <rxjava-version>1.0.16</rxjava-version>{{/useRxJava}}
<okhttp-version>3.0.1</okhttp-version>
<gson-version>2.4</gson-version>
<oltu-version>1.0.0</oltu-version> <oltu-version>1.0.0</oltu-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version> <junit-version>4.12</junit-version>

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml ```xml
<dependency> <dependency>

View File

@ -100,6 +100,7 @@ ext {
dependencies { dependencies {
compile "com.squareup.retrofit2:retrofit:$retrofit_version" compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-scalars:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version" compile "com.squareup.retrofit2:converter-gson:$retrofit_version"

View File

@ -118,6 +118,11 @@
<artifactId>retrofit</artifactId> <artifactId>retrofit</artifactId>
<version>${retrofit-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-scalars</artifactId>
<version>${retrofit-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.squareup.retrofit2</groupId> <groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId> <artifactId>converter-gson</artifactId>
@ -128,7 +133,6 @@
<artifactId>org.apache.oltu.oauth2.client</artifactId> <artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu-version}</version> <version>${oltu-version}</version>
</dependency> </dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>

View File

@ -12,8 +12,9 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil
import retrofit2.Converter; import retrofit2.Converter;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -46,10 +47,18 @@ public class ApiClient {
this(); this();
for(String authName : authNames) { for(String authName : authNames) {
Interceptor auth; Interceptor auth;
if (authName == "api_key") { if (authName == "petstore_auth") {
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"); auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else if (authName == "test_api_client_id") {
auth = new ApiKeyAuth("header", "x-test_api_client_id");
} else if (authName == "test_api_client_secret") {
auth = new ApiKeyAuth("header", "x-test_api_client_secret");
} else if (authName == "api_key") {
auth = new ApiKeyAuth("header", "api_key");
} else if (authName == "test_api_key_query") {
auth = new ApiKeyAuth("query", "test_api_key_query");
} else if (authName == "test_api_key_header") {
auth = new ApiKeyAuth("header", "test_api_key_header");
} else { } else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
} }
@ -119,6 +128,7 @@ public class ApiClient {
.baseUrl(baseUrl) .baseUrl(baseUrl)
.client(okClient) .client(okClient)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(gson)); .addConverterFactory(GsonCustomConverterFactory.create(gson));
} }

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-26T13:30:07.836+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-07T09:02:50.804Z")
public class StringUtil { public class StringUtil {
/** /**
* Check if the given array contains the given value (with case-insensitive comparison). * Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -3,6 +3,9 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Tag;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -12,6 +15,9 @@ import com.google.gson.annotations.SerializedName;
@ApiModel(description = "") @ApiModel(description = "")
public class InlineResponse200 { public class InlineResponse200 {
@SerializedName("photoUrls")
private List<String> photoUrls = new ArrayList<String>();
@SerializedName("name") @SerializedName("name")
private String name = null; private String name = null;
@ -21,6 +27,46 @@ public class InlineResponse200 {
@SerializedName("category") @SerializedName("category")
private Object category = null; private Object category = null;
@SerializedName("tags")
private List<Tag> tags = new ArrayList<Tag>();
public enum StatusEnum {
@SerializedName("available")
AVAILABLE("available"),
@SerializedName("pending")
PENDING("pending"),
@SerializedName("sold")
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
@SerializedName("status")
private StatusEnum status = null;
/**
**/
@ApiModelProperty(value = "")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
/** /**
@ -56,6 +102,29 @@ public class InlineResponse200 {
} }
/**
**/
@ApiModelProperty(value = "")
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
/**
* pet status in the store
**/
@ApiModelProperty(value = "pet status in the store")
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
@ -66,14 +135,17 @@ public class InlineResponse200 {
return false; return false;
} }
InlineResponse200 inlineResponse200 = (InlineResponse200) o; InlineResponse200 inlineResponse200 = (InlineResponse200) o;
return Objects.equals(name, inlineResponse200.name) && return Objects.equals(photoUrls, inlineResponse200.photoUrls) &&
Objects.equals(name, inlineResponse200.name) &&
Objects.equals(id, inlineResponse200.id) && Objects.equals(id, inlineResponse200.id) &&
Objects.equals(category, inlineResponse200.category); Objects.equals(category, inlineResponse200.category) &&
Objects.equals(tags, inlineResponse200.tags) &&
Objects.equals(status, inlineResponse200.status);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(name, id, category); return Objects.hash(photoUrls, name, id, category, tags, status);
} }
@Override @Override
@ -81,9 +153,12 @@ public class InlineResponse200 {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse200 {\n"); sb.append("class InlineResponse200 {\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}"); sb.append("}");
return sb.toString(); return sb.toString();
} }

View File

@ -0,0 +1,69 @@
package io.swagger.client.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class ObjectReturn {
@SerializedName("return")
private Integer _return = null;
/**
**/
@ApiModelProperty(value = "")
public Integer getReturn() {
return _return;
}
public void setReturn(Integer _return) {
this._return = _return;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ObjectReturn _return = (ObjectReturn) o;
return Objects.equals(_return, _return._return);
}
@Override
public int hashCode() {
return Objects.hash(_return);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ObjectReturn {\n");
sb.append(" _return: ").append(toIndentedString(_return)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,69 @@
package io.swagger.client.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class SpecialModelName {
@SerializedName("$special[property.name]")
private Long specialPropertyName = null;
/**
**/
@ApiModelProperty(value = "")
public Long getSpecialPropertyName() {
return specialPropertyName;
}
public void setSpecialPropertyName(Long specialPropertyName) {
this.specialPropertyName = specialPropertyName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(specialPropertyName, specialModelName.specialPropertyName);
}
@Override
public int hashCode() {
return Objects.hash(specialPropertyName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SpecialModelName {\n");
sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml ```xml
<dependency> <dependency>

View File

@ -101,6 +101,7 @@ ext {
dependencies { dependencies {
compile "com.squareup.retrofit2:retrofit:$retrofit_version" compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-scalars:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version" compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version" compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
compile "io.reactivex:rxjava:$rx_java_version" compile "io.reactivex:rxjava:$rx_java_version"

View File

@ -1 +0,0 @@
Hello world!

View File

@ -118,6 +118,11 @@
<artifactId>retrofit</artifactId> <artifactId>retrofit</artifactId>
<version>${retrofit-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-scalars</artifactId>
<version>${retrofit-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.squareup.retrofit2</groupId> <groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId> <artifactId>converter-gson</artifactId>
@ -128,18 +133,16 @@
<artifactId>org.apache.oltu.oauth2.client</artifactId> <artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu-version}</version> <version>${oltu-version}</version>
</dependency> </dependency>
<dependency>
<dependency> <groupId>io.reactivex</groupId>
<groupId>io.reactivex</groupId> <artifactId>rxjava</artifactId>
<artifactId>rxjava</artifactId> <version>${rxjava-version}</version>
<version>${rxjava-version}</version> </dependency>
</dependency> <dependency>
<dependency> <groupId>com.squareup.retrofit2</groupId>
<groupId>com.squareup.retrofit2</groupId> <artifactId>adapter-rxjava</artifactId>
<artifactId>adapter-rxjava</artifactId> <version>${retrofit-version}</version>
<version>${retrofit-version}</version> </dependency>
</dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>

View File

@ -12,8 +12,9 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil
import retrofit2.Converter; import retrofit2.Converter;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -46,10 +47,18 @@ public class ApiClient {
this(); this();
for(String authName : authNames) { for(String authName : authNames) {
Interceptor auth; Interceptor auth;
if (authName == "api_key") { if (authName == "petstore_auth") {
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"); auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else if (authName == "test_api_client_id") {
auth = new ApiKeyAuth("header", "x-test_api_client_id");
} else if (authName == "test_api_client_secret") {
auth = new ApiKeyAuth("header", "x-test_api_client_secret");
} else if (authName == "api_key") {
auth = new ApiKeyAuth("header", "api_key");
} else if (authName == "test_api_key_query") {
auth = new ApiKeyAuth("query", "test_api_key_query");
} else if (authName == "test_api_key_header") {
auth = new ApiKeyAuth("header", "test_api_key_header");
} else { } else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
} }
@ -119,6 +128,7 @@ public class ApiClient {
.baseUrl(baseUrl) .baseUrl(baseUrl)
.client(okClient) .client(okClient)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(gson)); .addConverterFactory(GsonCustomConverterFactory.create(gson));
} }

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-26T13:30:13.630+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-07T09:11:59.834Z")
public class StringUtil { public class StringUtil {
/** /**
* Check if the given array contains the given value (with case-insensitive comparison). * Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -10,6 +10,7 @@ import okhttp3.RequestBody;
import io.swagger.client.model.Pet; import io.swagger.client.model.Pet;
import java.io.File; import java.io.File;
import io.swagger.client.model.InlineResponse200;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -46,8 +47,8 @@ public interface PetApi {
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma seperated strings * Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for query
* @return Call<List<Pet>> * @return Call<List<Pet>>
*/ */
@ -129,6 +130,19 @@ public interface PetApi {
); );
/**
* Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return Call<InlineResponse200>
*/
@GET("pet/{petId}?response=inline_arbitrary_object")
Observable<InlineResponse200> getPetByIdInObject(
@Path("petId") Long petId
);
/** /**
* Fake endpoint to test byte array return by &#39;Find pet by ID&#39; * Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions * Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
@ -137,7 +151,7 @@ public interface PetApi {
*/ */
@GET("pet/{petId}?testing_byte_array=true") @GET("pet/{petId}?testing_byte_array=true")
Observable<byte[]> getPetByIdWithByteArray( Observable<byte[]> petPetIdtestingByteArraytrueGet(
@Path("petId") Long petId @Path("petId") Long petId
); );

View File

@ -17,6 +17,19 @@ import java.util.Map;
public interface StoreApi { public interface StoreApi {
/**
* Finds orders by status
* A single status value can be provided as a string
* @param status Status value that needs to be considered for query
* @return Call<List<Order>>
*/
@GET("store/findByStatus")
Observable<List<Order>> findOrdersByStatus(
@Query("status") String status
);
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
@ -28,6 +41,17 @@ public interface StoreApi {
/**
* Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
* Returns an arbitrary object which is actually a map of status codes to quantities
* @return Call<Object>
*/
@GET("store/inventory?response=arbitrary_object")
Observable<Object> getInventoryInObject();
/** /**
* Place an order for a pet * Place an order for a pet
* *

View File

@ -0,0 +1,176 @@
package io.swagger.client.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Tag;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class InlineResponse200 {
@SerializedName("photoUrls")
private List<String> photoUrls = new ArrayList<String>();
@SerializedName("name")
private String name = null;
@SerializedName("id")
private Long id = null;
@SerializedName("category")
private Object category = null;
@SerializedName("tags")
private List<Tag> tags = new ArrayList<Tag>();
public enum StatusEnum {
@SerializedName("available")
AVAILABLE("available"),
@SerializedName("pending")
PENDING("pending"),
@SerializedName("sold")
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
@SerializedName("status")
private StatusEnum status = null;
/**
**/
@ApiModelProperty(value = "")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
/**
**/
@ApiModelProperty(value = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
**/
@ApiModelProperty(required = true, value = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
**/
@ApiModelProperty(value = "")
public Object getCategory() {
return category;
}
public void setCategory(Object category) {
this.category = category;
}
/**
**/
@ApiModelProperty(value = "")
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
/**
* pet status in the store
**/
@ApiModelProperty(value = "pet status in the store")
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InlineResponse200 inlineResponse200 = (InlineResponse200) o;
return Objects.equals(photoUrls, inlineResponse200.photoUrls) &&
Objects.equals(name, inlineResponse200.name) &&
Objects.equals(id, inlineResponse200.id) &&
Objects.equals(category, inlineResponse200.category) &&
Objects.equals(tags, inlineResponse200.tags) &&
Objects.equals(status, inlineResponse200.status);
}
@Override
public int hashCode() {
return Objects.hash(photoUrls, name, id, category, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse200 {\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,69 @@
package io.swagger.client.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class ObjectReturn {
@SerializedName("return")
private Integer _return = null;
/**
**/
@ApiModelProperty(value = "")
public Integer getReturn() {
return _return;
}
public void setReturn(Integer _return) {
this._return = _return;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ObjectReturn _return = (ObjectReturn) o;
return Objects.equals(_return, _return._return);
}
@Override
public int hashCode() {
return Objects.hash(_return);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ObjectReturn {\n");
sb.append(" _return: ").append(toIndentedString(_return)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,69 @@
package io.swagger.client.model;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class SpecialModelName {
@SerializedName("$special[property.name]")
private Long specialPropertyName = null;
/**
**/
@ApiModelProperty(value = "")
public Long getSpecialPropertyName() {
return specialPropertyName;
}
public void setSpecialPropertyName(Long specialPropertyName) {
this.specialPropertyName = specialPropertyName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(specialPropertyName, specialModelName.specialPropertyName);
}
@Override
public int hashCode() {
return Objects.hash(specialPropertyName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SpecialModelName {\n");
sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}