mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Update samples for okhttp-gson-parcelableModel. (#5208)
This commit is contained in:
parent
b3fac54df6
commit
ee1ef2c1f6
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# Capitalization
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**smallCamel** | **String** | | [optional]
|
||||||
|
**capitalCamel** | **String** | | [optional]
|
||||||
|
**smallSnake** | **String** | | [optional]
|
||||||
|
**capitalSnake** | **String** | | [optional]
|
||||||
|
**scAETHFlowPoints** | **String** | | [optional]
|
||||||
|
**ATT_NAME** | **String** | Name of the pet | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
# ClassModel
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**propertyClass** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
# OuterEnum
|
||||||
|
|
||||||
|
## Enum
|
||||||
|
|
||||||
|
|
||||||
|
* `PLACED` (value: `"placed"`)
|
||||||
|
|
||||||
|
* `APPROVED` (value: `"approved"`)
|
||||||
|
|
||||||
|
* `DELIVERED` (value: `"delivered"`)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.*;
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSink;
|
||||||
|
import okio.GzipSink;
|
||||||
|
import okio.Okio;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes request bodies using gzip.
|
||||||
|
*
|
||||||
|
* Taken from https://github.com/square/okhttp/issues/350
|
||||||
|
*/
|
||||||
|
class GzipRequestInterceptor implements Interceptor {
|
||||||
|
@Override public Response intercept(Chain chain) throws IOException {
|
||||||
|
Request originalRequest = chain.request();
|
||||||
|
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
|
||||||
|
return chain.proceed(originalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request compressedRequest = originalRequest.newBuilder()
|
||||||
|
.header("Content-Encoding", "gzip")
|
||||||
|
.method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
|
||||||
|
.build();
|
||||||
|
return chain.proceed(compressedRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody forceContentLength(final RequestBody requestBody) throws IOException {
|
||||||
|
final Buffer buffer = new Buffer();
|
||||||
|
requestBody.writeTo(buffer);
|
||||||
|
return new RequestBody() {
|
||||||
|
@Override
|
||||||
|
public MediaType contentType() {
|
||||||
|
return requestBody.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long contentLength() {
|
||||||
|
return buffer.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
sink.write(buffer.snapshot());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestBody gzip(final RequestBody body) {
|
||||||
|
return new RequestBody() {
|
||||||
|
@Override public MediaType contentType() {
|
||||||
|
return body.contentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public long contentLength() {
|
||||||
|
return -1; // We don't know the compressed length in advance!
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void writeTo(BufferedSink sink) throws IOException {
|
||||||
|
BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
|
||||||
|
body.writeTo(gzipSink);
|
||||||
|
gzipSink.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,246 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.os.Parcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capitalization
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Capitalization implements Parcelable {
|
||||||
|
@SerializedName("smallCamel")
|
||||||
|
private String smallCamel = null;
|
||||||
|
|
||||||
|
@SerializedName("CapitalCamel")
|
||||||
|
private String capitalCamel = null;
|
||||||
|
|
||||||
|
@SerializedName("small_Snake")
|
||||||
|
private String smallSnake = null;
|
||||||
|
|
||||||
|
@SerializedName("Capital_Snake")
|
||||||
|
private String capitalSnake = null;
|
||||||
|
|
||||||
|
@SerializedName("SCA_ETH_Flow_Points")
|
||||||
|
private String scAETHFlowPoints = null;
|
||||||
|
|
||||||
|
@SerializedName("ATT_NAME")
|
||||||
|
private String ATT_NAME = null;
|
||||||
|
|
||||||
|
public Capitalization smallCamel(String smallCamel) {
|
||||||
|
this.smallCamel = smallCamel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get smallCamel
|
||||||
|
* @return smallCamel
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getSmallCamel() {
|
||||||
|
return smallCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmallCamel(String smallCamel) {
|
||||||
|
this.smallCamel = smallCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization capitalCamel(String capitalCamel) {
|
||||||
|
this.capitalCamel = capitalCamel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get capitalCamel
|
||||||
|
* @return capitalCamel
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getCapitalCamel() {
|
||||||
|
return capitalCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapitalCamel(String capitalCamel) {
|
||||||
|
this.capitalCamel = capitalCamel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization smallSnake(String smallSnake) {
|
||||||
|
this.smallSnake = smallSnake;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get smallSnake
|
||||||
|
* @return smallSnake
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getSmallSnake() {
|
||||||
|
return smallSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmallSnake(String smallSnake) {
|
||||||
|
this.smallSnake = smallSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization capitalSnake(String capitalSnake) {
|
||||||
|
this.capitalSnake = capitalSnake;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get capitalSnake
|
||||||
|
* @return capitalSnake
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getCapitalSnake() {
|
||||||
|
return capitalSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapitalSnake(String capitalSnake) {
|
||||||
|
this.capitalSnake = capitalSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
|
||||||
|
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get scAETHFlowPoints
|
||||||
|
* @return scAETHFlowPoints
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getScAETHFlowPoints() {
|
||||||
|
return scAETHFlowPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScAETHFlowPoints(String scAETHFlowPoints) {
|
||||||
|
this.scAETHFlowPoints = scAETHFlowPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization ATT_NAME(String ATT_NAME) {
|
||||||
|
this.ATT_NAME = ATT_NAME;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the pet
|
||||||
|
* @return ATT_NAME
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "Name of the pet ")
|
||||||
|
public String getATTNAME() {
|
||||||
|
return ATT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setATTNAME(String ATT_NAME) {
|
||||||
|
this.ATT_NAME = ATT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Capitalization capitalization = (Capitalization) o;
|
||||||
|
return Objects.equals(this.smallCamel, capitalization.smallCamel) &&
|
||||||
|
Objects.equals(this.capitalCamel, capitalization.capitalCamel) &&
|
||||||
|
Objects.equals(this.smallSnake, capitalization.smallSnake) &&
|
||||||
|
Objects.equals(this.capitalSnake, capitalization.capitalSnake) &&
|
||||||
|
Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) &&
|
||||||
|
Objects.equals(this.ATT_NAME, capitalization.ATT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Capitalization {\n");
|
||||||
|
|
||||||
|
sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n");
|
||||||
|
sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n");
|
||||||
|
sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n");
|
||||||
|
sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n");
|
||||||
|
sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n");
|
||||||
|
sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).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(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
|
||||||
|
out.writeValue(smallCamel);
|
||||||
|
|
||||||
|
out.writeValue(capitalCamel);
|
||||||
|
|
||||||
|
out.writeValue(smallSnake);
|
||||||
|
|
||||||
|
out.writeValue(capitalSnake);
|
||||||
|
|
||||||
|
out.writeValue(scAETHFlowPoints);
|
||||||
|
|
||||||
|
out.writeValue(ATT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Capitalization() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
Capitalization(Parcel in) {
|
||||||
|
|
||||||
|
smallCamel = (String)in.readValue(null);
|
||||||
|
capitalCamel = (String)in.readValue(null);
|
||||||
|
smallSnake = (String)in.readValue(null);
|
||||||
|
capitalSnake = (String)in.readValue(null);
|
||||||
|
scAETHFlowPoints = (String)in.readValue(null);
|
||||||
|
ATT_NAME = (String)in.readValue(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<Capitalization> CREATOR = new Parcelable.Creator<Capitalization>() {
|
||||||
|
public Capitalization createFromParcel(Parcel in) {
|
||||||
|
return new Capitalization(in);
|
||||||
|
}
|
||||||
|
public Capitalization[] newArray(int size) {
|
||||||
|
return new Capitalization[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.os.Parcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model for testing model with \"_class\" property
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "Model for testing model with \"_class\" property")
|
||||||
|
|
||||||
|
public class ClassModel implements Parcelable {
|
||||||
|
@SerializedName("_class")
|
||||||
|
private String propertyClass = null;
|
||||||
|
|
||||||
|
public ClassModel propertyClass(String propertyClass) {
|
||||||
|
this.propertyClass = propertyClass;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get propertyClass
|
||||||
|
* @return propertyClass
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public String getPropertyClass() {
|
||||||
|
return propertyClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyClass(String propertyClass) {
|
||||||
|
this.propertyClass = propertyClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ClassModel classModel = (ClassModel) o;
|
||||||
|
return Objects.equals(this.propertyClass, classModel.propertyClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(propertyClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ClassModel {\n");
|
||||||
|
|
||||||
|
sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
|
|
||||||
|
out.writeValue(propertyClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassModel() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassModel(Parcel in) {
|
||||||
|
|
||||||
|
propertyClass = (String)in.readValue(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Parcelable.Creator<ClassModel> CREATOR = new Parcelable.Creator<ClassModel>() {
|
||||||
|
public ClassModel createFromParcel(Parcel in) {
|
||||||
|
return new ClassModel(in);
|
||||||
|
}
|
||||||
|
public ClassModel[] newArray(int size) {
|
||||||
|
return new ClassModel[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.os.Parcel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets or Sets OuterEnum
|
||||||
|
*/
|
||||||
|
public enum OuterEnum {
|
||||||
|
|
||||||
|
@SerializedName("placed")
|
||||||
|
PLACED("placed"),
|
||||||
|
|
||||||
|
@SerializedName("approved")
|
||||||
|
APPROVED("approved"),
|
||||||
|
|
||||||
|
@SerializedName("delivered")
|
||||||
|
DELIVERED("delivered");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
OuterEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user