forked from loafle/openapi-generator-original
Fixes enums c#
This commit is contained in:
parent
3aff6e8328
commit
b434fb517f
12
README.md
12
README.md
@ -36,6 +36,7 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
|||||||
- [To build a server stub](#to-build-a-server-stub)
|
- [To build a server stub](#to-build-a-server-stub)
|
||||||
- [Node.js](#nodejs)
|
- [Node.js](#nodejs)
|
||||||
- [PHP Silex](#php-silex)
|
- [PHP Silex](#php-silex)
|
||||||
|
- [Python Flask (Connexion)](#python-flask-connexion)
|
||||||
- [Ruby Sinatra](#ruby-sinatra)
|
- [Ruby Sinatra](#ruby-sinatra)
|
||||||
- [Scala Scalatra](#scala-scalatra)
|
- [Scala Scalatra](#scala-scalatra)
|
||||||
- [Java JAX-RS](#java-jax-rs)
|
- [Java JAX-RS](#java-jax-rs)
|
||||||
@ -268,9 +269,11 @@ AkkaScalaClientCodegen.java
|
|||||||
AndroidClientCodegen.java
|
AndroidClientCodegen.java
|
||||||
AsyncScalaClientCodegen.java
|
AsyncScalaClientCodegen.java
|
||||||
CSharpClientCodegen.java
|
CSharpClientCodegen.java
|
||||||
|
ClojureClientCodegen.java
|
||||||
CsharpDotNet2ClientCodegen.java
|
CsharpDotNet2ClientCodegen.java
|
||||||
DartClientCodegen.java
|
DartClientCodegen.java
|
||||||
FlashClientCodegen.java
|
FlashClientCodegen.java
|
||||||
|
FlaskConnexionCodegen.java
|
||||||
JavaClientCodegen.java
|
JavaClientCodegen.java
|
||||||
JavaInflectorServerCodegen.java
|
JavaInflectorServerCodegen.java
|
||||||
JaxRSServerCodegen.java
|
JaxRSServerCodegen.java
|
||||||
@ -441,6 +444,15 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
|||||||
-o samples/server/petstore/silex
|
-o samples/server/petstore/silex
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Python Flask (Connexion)
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l flaskConnexion \
|
||||||
|
-o samples/server/petstore/flaskConnexion
|
||||||
|
```
|
||||||
|
|
||||||
### Ruby Sinatra
|
### Ruby Sinatra
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.swagger.codegen.cmd;
|
package io.swagger.codegen.cmd;
|
||||||
|
|
||||||
import ch.lambdaj.function.convert.Converter;
|
import ch.lambdaj.function.convert.Converter;
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.samskivert.mustache.Mustache;
|
import com.samskivert.mustache.Mustache;
|
||||||
@ -9,7 +10,6 @@ import io.airlift.airline.Option;
|
|||||||
import io.swagger.codegen.DefaultGenerator;
|
import io.swagger.codegen.DefaultGenerator;
|
||||||
import io.swagger.codegen.SupportingFile;
|
import io.swagger.codegen.SupportingFile;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class Meta implements Runnable {
|
|||||||
final File targetDir = new File(outputFolder);
|
final File targetDir = new File(outputFolder);
|
||||||
LOG.info("writing to folder [{}]", targetDir.getAbsolutePath());
|
LOG.info("writing to folder [{}]", targetDir.getAbsolutePath());
|
||||||
|
|
||||||
String mainClass = StringUtils.capitalize(name) + "Generator";
|
String mainClass = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, name) + "Generator";
|
||||||
|
|
||||||
List<SupportingFile> supportingFiles = ImmutableList.of(
|
List<SupportingFile> supportingFiles = ImmutableList.of(
|
||||||
new SupportingFile("pom.mustache", "", "pom.xml"),
|
new SupportingFile("pom.mustache", "", "pom.xml"),
|
||||||
@ -68,11 +68,18 @@ public class Meta implements Runnable {
|
|||||||
"src/main/resources/META-INF/services", "io.swagger.codegen.CodegenConfig")
|
"src/main/resources/META-INF/services", "io.swagger.codegen.CodegenConfig")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
String swaggerVersion = this.getClass().getPackage().getImplementationVersion();
|
||||||
|
// if the code is running outside of the jar (i.e. from the IDE), it will not have the version available.
|
||||||
|
// let's default it with something.
|
||||||
|
if (swaggerVersion==null) {
|
||||||
|
swaggerVersion = "2.1.3";
|
||||||
|
}
|
||||||
Map<String, Object> data = new ImmutableMap.Builder<String, Object>()
|
Map<String, Object> data = new ImmutableMap.Builder<String, Object>()
|
||||||
.put("generatorPackage", targetPackage)
|
.put("generatorPackage", targetPackage)
|
||||||
.put("generatorClass", mainClass)
|
.put("generatorClass", mainClass)
|
||||||
.put("name", name)
|
.put("name", name)
|
||||||
.put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass).build();
|
.put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass)
|
||||||
|
.put("swaggerCodegenVersion", swaggerVersion).build();
|
||||||
|
|
||||||
|
|
||||||
with(supportingFiles).convert(processFiles(targetDir, data));
|
with(supportingFiles).convert(processFiles(targetDir, data));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.swagger.codegen.languages;
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
import io.swagger.codegen.CodegenConfig;
|
import io.swagger.codegen.CodegenConfig;
|
||||||
import io.swagger.codegen.CodegenConstants;
|
import io.swagger.codegen.CodegenConstants;
|
||||||
import io.swagger.codegen.CodegenOperation;
|
import io.swagger.codegen.CodegenOperation;
|
||||||
@ -13,8 +14,6 @@ import io.swagger.models.Swagger;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -23,13 +22,15 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
private static final String PROJECT_DESCRIPTION = "projectDescription";
|
private static final String PROJECT_DESCRIPTION = "projectDescription";
|
||||||
private static final String PROJECT_VERSION = "projectVersion";
|
private static final String PROJECT_VERSION = "projectVersion";
|
||||||
private static final String PROJECT_URL = "projectUrl";
|
private static final String PROJECT_URL = "projectUrl";
|
||||||
private static final String LICENSE_NAME = "licenseName";
|
private static final String PROJECT_LICENSE_NAME = "projectLicenseName";
|
||||||
private static final String LICENSE_URL = "licenseUrl";
|
private static final String PROJECT_LICENSE_URL = "projectLicenseUrl";
|
||||||
private static final String BASE_NAMESPACE = "baseNamespace";
|
private static final String BASE_NAMESPACE = "baseNamespace";
|
||||||
|
|
||||||
protected String projectName = null;
|
protected String projectName = null;
|
||||||
protected String projectDescription = null;
|
protected String projectDescription = null;
|
||||||
protected String projectVersion = null;
|
protected String projectVersion = null;
|
||||||
|
protected String baseNamespace = null;
|
||||||
|
|
||||||
protected String sourceFolder = "src";
|
protected String sourceFolder = "src";
|
||||||
|
|
||||||
public ClojureClientCodegen() {
|
public ClojureClientCodegen() {
|
||||||
@ -37,6 +38,21 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
outputFolder = "generated-code" + File.separator + "clojure";
|
outputFolder = "generated-code" + File.separator + "clojure";
|
||||||
apiTemplateFiles.put("api.mustache", ".clj");
|
apiTemplateFiles.put("api.mustache", ".clj");
|
||||||
embeddedTemplateDir = templateDir = "clojure";
|
embeddedTemplateDir = templateDir = "clojure";
|
||||||
|
|
||||||
|
cliOptions.add(new CliOption(PROJECT_NAME,
|
||||||
|
"name of the project (Default: generated from info.title or \"swagger-clj-client\")"));
|
||||||
|
cliOptions.add(new CliOption(PROJECT_DESCRIPTION,
|
||||||
|
"description of the project (Default: using info.description or \"Client library of <projectNname>\")"));
|
||||||
|
cliOptions.add(new CliOption(PROJECT_VERSION,
|
||||||
|
"version of the project (Default: using info.version or \"1.0.0\")"));
|
||||||
|
cliOptions.add(new CliOption(PROJECT_URL,
|
||||||
|
"URL of the project (Default: using info.contact.url or not included in project.clj)"));
|
||||||
|
cliOptions.add(new CliOption(PROJECT_LICENSE_NAME,
|
||||||
|
"name of the license the project uses (Default: using info.license.name or not included in project.clj)"));
|
||||||
|
cliOptions.add(new CliOption(PROJECT_LICENSE_URL,
|
||||||
|
"URL of the license the project uses (Default: using info.license.url or not included in project.clj)"));
|
||||||
|
cliOptions.add(new CliOption(BASE_NAMESPACE,
|
||||||
|
"the base/top namespace (Default: generated from projectName)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,6 +83,9 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
if (additionalProperties.containsKey(PROJECT_VERSION)) {
|
if (additionalProperties.containsKey(PROJECT_VERSION)) {
|
||||||
projectVersion = ((String) additionalProperties.get(PROJECT_VERSION));
|
projectVersion = ((String) additionalProperties.get(PROJECT_VERSION));
|
||||||
}
|
}
|
||||||
|
if (additionalProperties.containsKey(BASE_NAMESPACE)) {
|
||||||
|
baseNamespace = ((String) additionalProperties.get(BASE_NAMESPACE));
|
||||||
|
}
|
||||||
|
|
||||||
if (swagger.getInfo() != null) {
|
if (swagger.getInfo() != null) {
|
||||||
Info info = swagger.getInfo();
|
Info info = swagger.getInfo();
|
||||||
@ -91,11 +110,11 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
}
|
}
|
||||||
if (info.getLicense() != null) {
|
if (info.getLicense() != null) {
|
||||||
License license = info.getLicense();
|
License license = info.getLicense();
|
||||||
if (additionalProperties.get(LICENSE_NAME) == null) {
|
if (additionalProperties.get(PROJECT_LICENSE_NAME) == null) {
|
||||||
additionalProperties.put(LICENSE_NAME, license.getName());
|
additionalProperties.put(PROJECT_LICENSE_NAME, license.getName());
|
||||||
}
|
}
|
||||||
if (additionalProperties.get(LICENSE_URL) == null) {
|
if (additionalProperties.get(PROJECT_LICENSE_URL) == null) {
|
||||||
additionalProperties.put(LICENSE_URL, license.getUrl());
|
additionalProperties.put(PROJECT_LICENSE_URL, license.getUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,8 +129,9 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
if (projectDescription == null) {
|
if (projectDescription == null) {
|
||||||
projectDescription = "Client library of " + projectName;
|
projectDescription = "Client library of " + projectName;
|
||||||
}
|
}
|
||||||
|
if (baseNamespace == null) {
|
||||||
final String baseNamespace = dashize(projectName);
|
baseNamespace = dashize(projectName);
|
||||||
|
}
|
||||||
apiPackage = baseNamespace + ".api";
|
apiPackage = baseNamespace + ".api";
|
||||||
|
|
||||||
additionalProperties.put(PROJECT_NAME, projectName);
|
additionalProperties.put(PROJECT_NAME, projectName);
|
||||||
|
@ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String value;
|
String value;
|
||||||
if (apiKeyPrefix != null) {
|
if (apiKeyPrefix != null) {
|
||||||
value = apiKeyPrefix + " " + apiKey;
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
@ -2,11 +2,12 @@ package {{invokerPackage}}.auth;
|
|||||||
|
|
||||||
import {{invokerPackage}}.Pair;
|
import {{invokerPackage}}.Pair;
|
||||||
|
|
||||||
|
import com.migcomponents.migbase64.Base64;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
|
||||||
|
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class HttpBasicAuth implements Authentication {
|
public class HttpBasicAuth implements Authentication {
|
||||||
@ -31,9 +32,12 @@ public class HttpBasicAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
try {
|
try {
|
||||||
headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8")));
|
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,13 @@
|
|||||||
<version>${jodatime-version}</version>
|
<version>${jodatime-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Base64 encoding that works in both JVM and Android -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.brsanthu</groupId>
|
||||||
|
<artifactId>migbase64</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -64,6 +64,38 @@ import {{invokerPackage}}.auth.ApiKeyAuth;
|
|||||||
import {{invokerPackage}}.auth.OAuth;
|
import {{invokerPackage}}.auth.OAuth;
|
||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
public static final double JAVA_VERSION;
|
||||||
|
public static final boolean IS_ANDROID;
|
||||||
|
public static final int ANDROID_SDK_VERSION;
|
||||||
|
|
||||||
|
static {
|
||||||
|
JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version"));
|
||||||
|
boolean isAndroid;
|
||||||
|
try {
|
||||||
|
Class.forName("android.app.Activity");
|
||||||
|
isAndroid = true;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
isAndroid = false;
|
||||||
|
}
|
||||||
|
IS_ANDROID = isAndroid;
|
||||||
|
int sdkVersion = 0;
|
||||||
|
if (IS_ANDROID) {
|
||||||
|
try {
|
||||||
|
sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null));
|
||||||
|
} catch (Exception e2) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ANDROID_SDK_VERSION = sdkVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The datetime format to be used when <code>lenientDatetimeFormat</code> is enabled.
|
||||||
|
*/
|
||||||
|
public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||||
|
|
||||||
private String basePath = "{{basePath}}";
|
private String basePath = "{{basePath}}";
|
||||||
private boolean lenientOnJson = false;
|
private boolean lenientOnJson = false;
|
||||||
private boolean debugging = false;
|
private boolean debugging = false;
|
||||||
@ -100,8 +132,7 @@ public class ApiClient {
|
|||||||
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
// Always use UTC as the default time zone when dealing with date (without time).
|
// Always use UTC as the default time zone when dealing with date (without time).
|
||||||
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
// Use the system's default time zone when dealing with datetime (mainly formatting).
|
initDatetimeFormat();
|
||||||
this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
|
||||||
|
|
||||||
// Be lenient on datetime formats when parsing datetime from string.
|
// Be lenient on datetime formats when parsing datetime from string.
|
||||||
// See <code>parseDatetime</code>.
|
// See <code>parseDatetime</code>.
|
||||||
@ -263,25 +294,30 @@ public class ApiClient {
|
|||||||
if (str == null)
|
if (str == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
DateFormat format;
|
||||||
if (lenientDatetimeFormat) {
|
if (lenientDatetimeFormat) {
|
||||||
/*
|
/*
|
||||||
* When lenientDatetimeFormat is enabled, process the given string
|
* When lenientDatetimeFormat is enabled, normalize the date string
|
||||||
* to support various formats defined by ISO 8601.
|
* into <code>LENIENT_DATETIME_FORMAT</code> to support various formats
|
||||||
|
* defined by ISO 8601.
|
||||||
*/
|
*/
|
||||||
// normalize time zone
|
// normalize time zone
|
||||||
// trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+00:00
|
// trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("[zZ]\\z", "+00:00");
|
str = str.replaceAll("[zZ]\\z", "+0000");
|
||||||
// add colon: 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05+00:00
|
// remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("([+-]\\d{2})(\\d{2})\\z", "$1:$2");
|
str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2");
|
||||||
// expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+00:00
|
// expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("([+-]\\d{2})\\z", "$1:00");
|
str = str.replaceAll("([+-]\\d{2})\\z", "$100");
|
||||||
// add milliseconds when missing
|
// add milliseconds when missing
|
||||||
// 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05.000+00:00
|
// 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000
|
||||||
str = str.replaceAll("(:\\d{1,2})([+-]\\d{2}:\\d{2})\\z", "$1.000$2");
|
str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2");
|
||||||
|
format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT);
|
||||||
|
} else {
|
||||||
|
format = this.datetimeFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return datetimeFormat.parse(str);
|
return format.parse(str);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -916,6 +952,31 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize datetime format according to the current environment, e.g. Java 1.7 and Android.
|
||||||
|
*/
|
||||||
|
private void initDatetimeFormat() {
|
||||||
|
String formatWithTimeZone = null;
|
||||||
|
if (IS_ANDROID) {
|
||||||
|
if (ANDROID_SDK_VERSION >= 18) {
|
||||||
|
// The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18)
|
||||||
|
formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
|
||||||
|
}
|
||||||
|
} else if (JAVA_VERSION >= 1.7) {
|
||||||
|
// The time zone format "XXX" is available since Java 1.7
|
||||||
|
formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
||||||
|
}
|
||||||
|
if (formatWithTimeZone != null) {
|
||||||
|
this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone);
|
||||||
|
// NOTE: Use the system's default time zone (mainly for datetime formatting).
|
||||||
|
} else {
|
||||||
|
// Use a common format that works across all systems.
|
||||||
|
this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
// Always use the UTC time zone as we are using a constant trailing "Z" here.
|
||||||
|
this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
|
@ -2,7 +2,7 @@ package {{invokerPackage}}.auth;
|
|||||||
|
|
||||||
import {{invokerPackage}}.Pair;
|
import {{invokerPackage}}.Pair;
|
||||||
|
|
||||||
import com.migcomponents.migbase64.Base64;
|
import com.squareup.okhttp.Credentials;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,11 +31,11 @@ public class HttpBasicAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
if (username == null && password == null) {
|
||||||
try {
|
return;
|
||||||
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
headerParams.put("Authorization", Credentials.basic(
|
||||||
|
username == null ? "" : username,
|
||||||
|
password == null ? "" : password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,6 @@
|
|||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>${gson-version}</version>
|
<version>${gson-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.brsanthu</groupId>
|
|
||||||
<artifactId>migbase64</artifactId>
|
|
||||||
<version>2.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -148,6 +148,13 @@
|
|||||||
<version>${jodatime-version}</version>
|
<version>${jodatime-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Base64 encoding that works in both JVM and Android -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.brsanthu</groupId>
|
||||||
|
<artifactId>migbase64</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{=< >=}}(ns <package>.<classname>
|
{{=< >=}}(ns <package>.<classname>
|
||||||
(:require [<projectName>.core :refer [call-api check-required-params]])
|
(:require [<baseNamespace>.core :refer [call-api check-required-params]])
|
||||||
(:import (java.io File)))
|
(:import (java.io File)))
|
||||||
<#operations><#operation>
|
<#operations><#operation>
|
||||||
(defn <nickname>
|
(defn <nickname>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{{=< >=}}(defproject <&projectName> "<&projectVersion>"
|
{{=< >=}}(defproject <&projectName> "<&projectVersion>"
|
||||||
:description "<&projectDescription>"<#projectUrl>
|
:description "<&projectDescription>"<#projectUrl>
|
||||||
:url "<&projectUrl>"</projectUrl><#licenseName>
|
:url "<&projectUrl>"</projectUrl><#projectLicenseName>
|
||||||
:license {:name "<&licenseName>"<#licenseUrl>
|
:license {:name "<&projectLicenseName>"<#projectLicenseUrl>
|
||||||
:url "<&licenseUrl>"</licenseUrl>}</licenseName>
|
:url "<&projectLicenseUrl>"</projectLicenseUrl>}</projectLicenseName>
|
||||||
:dependencies [[org.clojure/clojure "1.7.0"]
|
:dependencies [[org.clojure/clojure "1.7.0"]
|
||||||
[clj-http "2.0.0"]
|
[clj-http "2.0.0"]
|
||||||
[cheshire "5.5.0"]])
|
[cheshire "5.5.0"]])
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-codegen-version>2.1.3</swagger-codegen-version>
|
<swagger-codegen-version>{{swaggerCodegenVersion}}</swagger-codegen-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
public enum {{name}} {
|
public enum {{datatypeWithEnum}} {
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
[EnumMember("{{jsonname}}")]
|
[EnumMember(Value = "{{jsonname}}")]
|
||||||
{{name}}{{^-last}},
|
{{name}}{{^-last}},
|
||||||
{{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}}
|
{{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
}
|
}
|
@ -1,69 +1,119 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
namespace {{packageName}}.Model {
|
namespace {{packageName}}.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {{description}}
|
/// {{description}}
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class {{classname}}{{#parent}} : {{{parent}}}{{/parent}} {
|
public class {{classname}} : IEquatable<{{classname}}>{{#parent}}, {{{parent}}}{{/parent}}
|
||||||
{{#vars}}{{#isEnum}}
|
{ {{#vars}}{{#isEnum}}
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}}
|
||||||
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
private {{{name}}} {{name}};
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
/// </summary>{{#description}}
|
/// </summary>{{#description}}
|
||||||
/// <value>{{{description}}}</value>{{/description}}
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
[DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
|
[DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
|
||||||
public {{{name}}} {{name}} { get; set; }
|
public {{{datatypeWithEnum}}} {{name}} { get; set; }
|
||||||
{{/vars}}
|
{{/isEnum}}{{/vars}}{{#vars}}{{^isEnum}}
|
||||||
|
|
||||||
{{#vars}}{{^isEnum}}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
/// </summary>{{#description}}
|
/// </summary>{{#description}}
|
||||||
/// <value>{{{description}}}</value>{{/description}}
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
[DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
|
[DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
|
||||||
public {{{datatype}}} {{name}} { get; set; }
|
public {{{datatype}}} {{name}} { get; set; }
|
||||||
|
|
||||||
{{/isEnum}}{{/vars}}
|
{{/isEnum}}{{/vars}}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class {{classname}} {\n");
|
sb.Append("class {{classname}} {\n");
|
||||||
{{#vars}}
|
{{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public {{#parent}} new {{/parent}}string ToJson() {
|
public {{#parent}} new {{/parent}}string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as {{classname}});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if {{classname}} instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of {{classname}} to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals({{classname}} other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return {{#vars}}{{#isNotContainer}}
|
||||||
|
(
|
||||||
|
this.{{name}} == other.{{name}} ||
|
||||||
|
this.{{name}} != null &&
|
||||||
|
this.{{name}}.Equals(other.{{name}})
|
||||||
|
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
|
||||||
|
(
|
||||||
|
this.{{name}} == other.{{name}} ||
|
||||||
|
this.{{name}} != null &&
|
||||||
|
this.{{name}}.SequenceEqual(other.{{name}})
|
||||||
|
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
{{#vars}}
|
||||||
|
if (this.{{name}} != null)
|
||||||
|
hash = hash * 57 + this.{{name}}.GetHashCode();
|
||||||
|
{{/vars}}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
}
|
}
|
||||||
|
@ -317,10 +317,24 @@ sub update_params_for_auth {
|
|||||||
foreach my $auth (@$auth_settings) {
|
foreach my $auth (@$auth_settings) {
|
||||||
# determine which one to use
|
# determine which one to use
|
||||||
if (!defined($auth)) {
|
if (!defined($auth)) {
|
||||||
|
# TODO show warning about auth setting not defined
|
||||||
}
|
}
|
||||||
{{#authMethods}}elsif ($auth eq '{{name}}') {
|
{{#authMethods}}elsif ($auth eq '{{name}}') {
|
||||||
{{#isApiKey}}{{#isKeyInHeader}}$header_params->{'{{keyParamName}}'} = $self->get_api_key_with_prefix('{{keyParamName}}');{{/isKeyInHeader}}{{#isKeyInQuery}}$query_params->{'{{keyParamName}}'} = $self->get_api_key_with_prefix('{{keyParamName}}');{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}$header_params->{'Authorization'} = 'Basic '.encode_base64($WWW::{{moduleName}}::Configuration::username.":".$WWW::{{moduleName}}::Configuration::password);{{/isBasic}}
|
{{#isApiKey}}{{#isKeyInHeader}}
|
||||||
{{#isOAuth}}$header_params->{'Authorization'} = 'Bearer ' . $WWW::{{moduleName}}::Configuration::access_token;{{/isOAuth}}
|
my $api_key = $self->get_api_key_with_prefix('{{keyParamName}}');
|
||||||
|
if ($api_key) {
|
||||||
|
$header_params->{'{{keyParamName}}'} = $api_key;
|
||||||
|
}{{/isKeyInHeader}}{{#isKeyInQuery}}
|
||||||
|
my $api_key = $self->get_api_key_with_prefix('{{keyParamName}}');
|
||||||
|
if ($api_key) {
|
||||||
|
$query_params->{'{{keyParamName}}'} = $api_key;
|
||||||
|
}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}
|
||||||
|
if ($WWW::{{moduleName}}::Configuration::username || $WWW::{{moduleName}}::Configuration::password) {
|
||||||
|
$header_params->{'Authorization'} = 'Basic ' . encode_base64($WWW::{{moduleName}}::Configuration::username . ":" . $WWW::{{moduleName}}::Configuration::password);
|
||||||
|
}{{/isBasic}}{{#isOAuth}}
|
||||||
|
if ($WWW::{{moduleName}}::Configuration::access_token) {
|
||||||
|
$header_params->{'Authorization'} = 'Bearer ' . $WWW::{{moduleName}}::Configuration::access_token;
|
||||||
|
}{{/isOAuth}}
|
||||||
}
|
}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
else {
|
else {
|
||||||
|
@ -166,12 +166,18 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
{{#authMethods}}{{#isApiKey}}
|
{{#authMethods}}{{#isApiKey}}
|
||||||
|
// this endpoint requires API key authentication
|
||||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('{{keyParamName}}');
|
$apiKey = $this->apiClient->getApiKeyWithPrefix('{{keyParamName}}');
|
||||||
if (isset($apiKey)) {
|
if ($apiKey !== null) {
|
||||||
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
|
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
|
||||||
}{{/isApiKey}}
|
}{{/isApiKey}}
|
||||||
{{#isBasic}}$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());{{/isBasic}}
|
{{#isBasic}}// this endpoint requires HTTP basic authentication
|
||||||
{{#isOAuth}}$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();{{/isOAuth}}
|
if ($this->apiClient->getConfig()->getUsername() !== null or $this->apiClient->getConfig()->getPassword() !== null) {
|
||||||
|
$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
|
||||||
|
}{{/isBasic}}{{#isOAuth}}// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}{{/isOAuth}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
|
@ -453,7 +453,9 @@ class ApiClient(object):
|
|||||||
for auth in auth_settings:
|
for auth in auth_settings:
|
||||||
auth_setting = config.auth_settings().get(auth)
|
auth_setting = config.auth_settings().get(auth)
|
||||||
if auth_setting:
|
if auth_setting:
|
||||||
if auth_setting['in'] == 'header':
|
if not auth_setting['value']:
|
||||||
|
continue
|
||||||
|
elif auth_setting['in'] == 'header':
|
||||||
headers[auth_setting['key']] = auth_setting['value']
|
headers[auth_setting['key']] = auth_setting['value']
|
||||||
elif auth_setting['in'] == 'query':
|
elif auth_setting['in'] == 'query':
|
||||||
querys[auth_setting['key']] = auth_setting['value']
|
querys[auth_setting['key']] = auth_setting['value']
|
||||||
|
13
pom.xml
13
pom.xml
@ -305,6 +305,18 @@
|
|||||||
<module>samples/client/petstore/android-java</module>
|
<module>samples/client/petstore/android-java</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>clojure-client</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>env</name>
|
||||||
|
<value>clojure</value>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<modules>
|
||||||
|
<module>samples/client/petstore/clojure</module>
|
||||||
|
</modules>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>java-client</id>
|
<id>java-client</id>
|
||||||
<activation>
|
<activation>
|
||||||
@ -435,6 +447,7 @@
|
|||||||
</activation>
|
</activation>
|
||||||
<modules>
|
<modules>
|
||||||
<module>samples/client/petstore/android-java</module>
|
<module>samples/client/petstore/android-java</module>
|
||||||
|
<module>samples/client/petstore/clojure</module>
|
||||||
<module>samples/client/petstore/java/default</module>
|
<module>samples/client/petstore/java/default</module>
|
||||||
<module>samples/client/petstore/java/jersey2</module>
|
<module>samples/client/petstore/java/jersey2</module>
|
||||||
<module>samples/client/petstore/java/okhttp-gson</module>
|
<module>samples/client/petstore/java/okhttp-gson</module>
|
||||||
|
1
samples/client/petstore/clojure/.gitignore
vendored
1
samples/client/petstore/clojure/.gitignore
vendored
@ -1,7 +1,6 @@
|
|||||||
/target
|
/target
|
||||||
/classes
|
/classes
|
||||||
/checkouts
|
/checkouts
|
||||||
pom.xml
|
|
||||||
pom.xml.asc
|
pom.xml.asc
|
||||||
*.jar
|
*.jar
|
||||||
*.class
|
*.class
|
||||||
|
32
samples/client/petstore/clojure/pom.xml
Normal file
32
samples/client/petstore/clojure/pom.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-petstore-clojure</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>Swagger Petstore - Clojure Client</name>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>lein-test</id>
|
||||||
|
<phase>integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<executable>lein</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>test</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -1,38 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace IO.Swagger.Model {
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class Category {
|
public class Category : IEquatable<Category>
|
||||||
|
{
|
||||||
|
|
||||||
private Id Id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Id
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
|
||||||
public Id Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Name Name;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Name
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
|
||||||
public Name Name { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -40,25 +23,21 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Category {\n");
|
sb.Append("class Category {\n");
|
||||||
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -66,12 +45,70 @@ namespace IO.Swagger.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public string ToJson() {
|
public string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as Category);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if Category instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of Category to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(Category other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Name == other.Name ||
|
||||||
|
this.Name != null &&
|
||||||
|
this.Name.Equals(other.Name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Name != null)
|
||||||
|
hash = hash * 57 + this.Name.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,87 +1,40 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace IO.Swagger.Model {
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class Order {
|
public class Order : IEquatable<Order>
|
||||||
|
{
|
||||||
|
|
||||||
private Id Id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Id
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
|
||||||
public Id Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private PetId PetId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets PetId
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="petId", EmitDefaultValue=false)]
|
|
||||||
public PetId PetId { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Quantity Quantity;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Quantity
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
|
||||||
public Quantity Quantity { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private ShipDate ShipDate;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets ShipDate
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
|
||||||
public ShipDate ShipDate { get; set; }
|
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum Status {
|
public enum StatusEnum {
|
||||||
|
|
||||||
[EnumMember("placed")]
|
[EnumMember(Value = "placed")]
|
||||||
Placed,
|
Placed,
|
||||||
|
|
||||||
[EnumMember("approved")]
|
[EnumMember(Value = "approved")]
|
||||||
Approved,
|
Approved,
|
||||||
|
|
||||||
[EnumMember("delivered")]
|
[EnumMember(Value = "delivered")]
|
||||||
Delivered
|
Delivered
|
||||||
}
|
}
|
||||||
|
|
||||||
private Status Status;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order Status
|
/// Order Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>Order Status</value>
|
/// <value>Order Status</value>
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||||
public Status Status { get; set; }
|
public StatusEnum Status { get; set; }
|
||||||
|
|
||||||
|
|
||||||
private Complete Complete;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Complete
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="complete", EmitDefaultValue=false)]
|
|
||||||
public Complete Complete { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -89,62 +42,43 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PetId
|
/// Gets or Sets PetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="petId", EmitDefaultValue=false)]
|
[DataMember(Name="petId", EmitDefaultValue=false)]
|
||||||
public long? PetId { get; set; }
|
public long? PetId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Quantity
|
/// Gets or Sets Quantity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
||||||
public int? Quantity { get; set; }
|
public int? Quantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ShipDate
|
/// Gets or Sets ShipDate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
||||||
public DateTime? ShipDate { get; set; }
|
public DateTime? ShipDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Order Status
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Order Status</value>
|
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
|
||||||
public string Status { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Complete
|
/// Gets or Sets Complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="complete", EmitDefaultValue=false)]
|
[DataMember(Name="complete", EmitDefaultValue=false)]
|
||||||
public bool? Complete { get; set; }
|
public bool? Complete { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Order {\n");
|
sb.Append("class Order {\n");
|
||||||
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
|
||||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||||
|
|
||||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -152,12 +86,102 @@ namespace IO.Swagger.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public string ToJson() {
|
public string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as Order);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if Order instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of Order to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(Order other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.PetId == other.PetId ||
|
||||||
|
this.PetId != null &&
|
||||||
|
this.PetId.Equals(other.PetId)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Quantity == other.Quantity ||
|
||||||
|
this.Quantity != null &&
|
||||||
|
this.Quantity.Equals(other.Quantity)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.ShipDate == other.ShipDate ||
|
||||||
|
this.ShipDate != null &&
|
||||||
|
this.ShipDate.Equals(other.ShipDate)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Status == other.Status ||
|
||||||
|
this.Status != null &&
|
||||||
|
this.Status.Equals(other.Status)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Complete == other.Complete ||
|
||||||
|
this.Complete != null &&
|
||||||
|
this.Complete.Equals(other.Complete)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.PetId != null)
|
||||||
|
hash = hash * 57 + this.PetId.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Quantity != null)
|
||||||
|
hash = hash * 57 + this.Quantity.GetHashCode();
|
||||||
|
|
||||||
|
if (this.ShipDate != null)
|
||||||
|
hash = hash * 57 + this.ShipDate.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Status != null)
|
||||||
|
hash = hash * 57 + this.Status.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Complete != null)
|
||||||
|
hash = hash * 57 + this.Complete.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,87 +1,40 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace IO.Swagger.Model {
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class Pet {
|
public class Pet : IEquatable<Pet>
|
||||||
|
{
|
||||||
|
|
||||||
private Id Id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Id
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
|
||||||
public Id Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Category Category;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Category
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="category", EmitDefaultValue=false)]
|
|
||||||
public Category Category { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Name Name;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Name
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
|
||||||
public Name Name { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private PhotoUrls PhotoUrls;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets PhotoUrls
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
|
||||||
public PhotoUrls PhotoUrls { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Tags Tags;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Tags
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
|
||||||
public Tags Tags { get; set; }
|
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum Status {
|
public enum StatusEnum {
|
||||||
|
|
||||||
[EnumMember("available")]
|
[EnumMember(Value = "available")]
|
||||||
Available,
|
Available,
|
||||||
|
|
||||||
[EnumMember("pending")]
|
[EnumMember(Value = "pending")]
|
||||||
Pending,
|
Pending,
|
||||||
|
|
||||||
[EnumMember("sold")]
|
[EnumMember(Value = "sold")]
|
||||||
Sold
|
Sold
|
||||||
}
|
}
|
||||||
|
|
||||||
private Status Status;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>pet status in the store</value>
|
/// <value>pet status in the store</value>
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||||
public Status Status { get; set; }
|
public StatusEnum Status { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -89,62 +42,43 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Category
|
/// Gets or Sets Category
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="category", EmitDefaultValue=false)]
|
[DataMember(Name="category", EmitDefaultValue=false)]
|
||||||
public Category Category { get; set; }
|
public Category Category { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PhotoUrls
|
/// Gets or Sets PhotoUrls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||||
public List<string> PhotoUrls { get; set; }
|
public List<string> PhotoUrls { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Tags
|
/// Gets or Sets Tags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||||
public List<Tag> Tags { get; set; }
|
public List<Tag> Tags { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
|
||||||
/// <value>pet status in the store</value>
|
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
|
||||||
public string Status { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the string presentation of the object
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Pet {\n");
|
sb.Append("class Pet {\n");
|
||||||
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
|
|
||||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -152,12 +86,102 @@ namespace IO.Swagger.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public string ToJson() {
|
public string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as Pet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if Pet instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of Pet to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(Pet other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Category == other.Category ||
|
||||||
|
this.Category != null &&
|
||||||
|
this.Category.Equals(other.Category)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Name == other.Name ||
|
||||||
|
this.Name != null &&
|
||||||
|
this.Name.Equals(other.Name)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.PhotoUrls == other.PhotoUrls ||
|
||||||
|
this.PhotoUrls != null &&
|
||||||
|
this.PhotoUrls.SequenceEqual(other.PhotoUrls)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Tags == other.Tags ||
|
||||||
|
this.Tags != null &&
|
||||||
|
this.Tags.SequenceEqual(other.Tags)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Status == other.Status ||
|
||||||
|
this.Status != null &&
|
||||||
|
this.Status.Equals(other.Status)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Category != null)
|
||||||
|
hash = hash * 57 + this.Category.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Name != null)
|
||||||
|
hash = hash * 57 + this.Name.GetHashCode();
|
||||||
|
|
||||||
|
if (this.PhotoUrls != null)
|
||||||
|
hash = hash * 57 + this.PhotoUrls.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Tags != null)
|
||||||
|
hash = hash * 57 + this.Tags.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Status != null)
|
||||||
|
hash = hash * 57 + this.Status.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace IO.Swagger.Model {
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class Tag {
|
public class Tag : IEquatable<Tag>
|
||||||
|
{
|
||||||
|
|
||||||
private Id Id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Id
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
|
||||||
public Id Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Name Name;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Name
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
|
||||||
public Name Name { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -40,25 +23,21 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Tag {\n");
|
sb.Append("class Tag {\n");
|
||||||
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -66,12 +45,70 @@ namespace IO.Swagger.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public string ToJson() {
|
public string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as Tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if Tag instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of Tag to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(Tag other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Name == other.Name ||
|
||||||
|
this.Name != null &&
|
||||||
|
this.Name.Equals(other.Name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Name != null)
|
||||||
|
hash = hash * 57 + this.Name.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,93 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace IO.Swagger.Model {
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class User {
|
public class User : IEquatable<User>
|
||||||
|
{
|
||||||
|
|
||||||
private Id Id;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Id
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
|
||||||
public Id Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Username Username;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Username
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="username", EmitDefaultValue=false)]
|
|
||||||
public Username Username { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private FirstName FirstName;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets FirstName
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
|
||||||
public FirstName FirstName { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private LastName LastName;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets LastName
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
|
||||||
public LastName LastName { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Email Email;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Email
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="email", EmitDefaultValue=false)]
|
|
||||||
public Email Email { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Password Password;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Password
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
|
||||||
public Password Password { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private Phone Phone;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Phone
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="phone", EmitDefaultValue=false)]
|
|
||||||
public Phone Phone { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private UserStatus UserStatus;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// User Status
|
|
||||||
/// </summary>
|
|
||||||
/// <value>User Status</value>
|
|
||||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
|
||||||
public UserStatus UserStatus { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -95,49 +23,42 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Username
|
/// Gets or Sets Username
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="username", EmitDefaultValue=false)]
|
[DataMember(Name="username", EmitDefaultValue=false)]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets FirstName
|
/// Gets or Sets FirstName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets LastName
|
/// Gets or Sets LastName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Email
|
/// Gets or Sets Email
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="email", EmitDefaultValue=false)]
|
[DataMember(Name="email", EmitDefaultValue=false)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Password
|
/// Gets or Sets Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Phone
|
/// Gets or Sets Phone
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="phone", EmitDefaultValue=false)]
|
[DataMember(Name="phone", EmitDefaultValue=false)]
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User Status
|
/// User Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -145,30 +66,21 @@ namespace IO.Swagger.Model {
|
|||||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
||||||
public int? UserStatus { get; set; }
|
public int? UserStatus { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String presentation of the object</returns>
|
/// <returns>String presentation of the object</returns>
|
||||||
public override string ToString() {
|
public override string ToString()
|
||||||
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class User {\n");
|
sb.Append("class User {\n");
|
||||||
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||||
|
|
||||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||||
|
|
||||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||||
|
|
||||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||||
|
|
||||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -176,12 +88,118 @@ namespace IO.Swagger.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the JSON string presentation of the object
|
/// Returns the JSON string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
/// <returns>JSON string presentation of the object</returns>
|
||||||
public string ToJson() {
|
public string ToJson()
|
||||||
|
{
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns true if objects are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Object to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
return this.Equals(obj as User);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if User instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Instance of User to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(User other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Username == other.Username ||
|
||||||
|
this.Username != null &&
|
||||||
|
this.Username.Equals(other.Username)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.FirstName == other.FirstName ||
|
||||||
|
this.FirstName != null &&
|
||||||
|
this.FirstName.Equals(other.FirstName)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.LastName == other.LastName ||
|
||||||
|
this.LastName != null &&
|
||||||
|
this.LastName.Equals(other.LastName)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Email == other.Email ||
|
||||||
|
this.Email != null &&
|
||||||
|
this.Email.Equals(other.Email)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Password == other.Password ||
|
||||||
|
this.Password != null &&
|
||||||
|
this.Password.Equals(other.Password)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Phone == other.Phone ||
|
||||||
|
this.Phone != null &&
|
||||||
|
this.Phone.Equals(other.Phone)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.UserStatus == other.UserStatus ||
|
||||||
|
this.UserStatus != null &&
|
||||||
|
this.UserStatus.Equals(other.UserStatus)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the hash code
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/263416/677735
|
||||||
|
unchecked // Overflow is fine, just wrap
|
||||||
|
{
|
||||||
|
int hash = 41;
|
||||||
|
// Suitable nullity checks etc, of course :)
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Username != null)
|
||||||
|
hash = hash * 57 + this.Username.GetHashCode();
|
||||||
|
|
||||||
|
if (this.FirstName != null)
|
||||||
|
hash = hash * 57 + this.FirstName.GetHashCode();
|
||||||
|
|
||||||
|
if (this.LastName != null)
|
||||||
|
hash = hash * 57 + this.LastName.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Email != null)
|
||||||
|
hash = hash * 57 + this.Email.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Password != null)
|
||||||
|
hash = hash * 57 + this.Password.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Phone != null)
|
||||||
|
hash = hash * 57 + this.Phone.GetHashCode();
|
||||||
|
|
||||||
|
if (this.UserStatus != null)
|
||||||
|
hash = hash * 57 + this.UserStatus.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,25 @@
|
|||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="TestPet.cs" Line="11" Column="2" />
|
<File FileName="TestPet.cs" Line="8" Column="25" />
|
||||||
</Files>
|
</Files>
|
||||||
|
<Pads>
|
||||||
|
<Pad Id="MonoDevelop.NUnit.TestPad">
|
||||||
|
<State name="__root__">
|
||||||
|
<Node name="SwaggerClientTest" expanded="True">
|
||||||
|
<Node name="SwaggerClientTest" expanded="True">
|
||||||
|
<Node name="SwaggerClient" expanded="True">
|
||||||
|
<Node name="TestPet" expanded="True">
|
||||||
|
<Node name="TestPet" expanded="True">
|
||||||
|
<Node name="TestEqual" selected="True" />
|
||||||
|
</Node>
|
||||||
|
</Node>
|
||||||
|
</Node>
|
||||||
|
</Node>
|
||||||
|
</Node>
|
||||||
|
</State>
|
||||||
|
</Pad>
|
||||||
|
</Pads>
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
<BreakpointStore />
|
<BreakpointStore />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using IO.Swagger.Api;
|
using IO.Swagger.Api;
|
||||||
@ -144,6 +145,68 @@ namespace SwaggerClient.TestPet
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestEqual()
|
||||||
|
{
|
||||||
|
// create pet
|
||||||
|
Pet p1 = new Pet();
|
||||||
|
p1.Id = petId;
|
||||||
|
p1.Name = "Csharp test";
|
||||||
|
p1.Status = "available";
|
||||||
|
// create Category object
|
||||||
|
Category category1 = new Category();
|
||||||
|
category1.Id = 56;
|
||||||
|
category1.Name = "sample category name2";
|
||||||
|
List<String> photoUrls1 = new List<String>(new String[] {"sample photoUrls"});
|
||||||
|
// create Tag object
|
||||||
|
Tag tag1 = new Tag();
|
||||||
|
tag1.Id = petId;
|
||||||
|
tag1.Name = "sample tag name1";
|
||||||
|
List<Tag> tags1 = new List<Tag>(new Tag[] {tag1});
|
||||||
|
p1.Tags = tags1;
|
||||||
|
p1.Category = category1;
|
||||||
|
p1.PhotoUrls = photoUrls1;
|
||||||
|
|
||||||
|
// create pet 2
|
||||||
|
Pet p2 = new Pet();
|
||||||
|
p2.Id = petId;
|
||||||
|
p2.Name = "Csharp test";
|
||||||
|
p2.Status = "available";
|
||||||
|
// create Category object
|
||||||
|
Category category2 = new Category();
|
||||||
|
category2.Id = 56;
|
||||||
|
category2.Name = "sample category name2";
|
||||||
|
List<String> photoUrls2 = new List<String>(new String[] {"sample photoUrls"});
|
||||||
|
// create Tag object
|
||||||
|
Tag tag2 = new Tag();
|
||||||
|
tag2.Id = petId;
|
||||||
|
tag2.Name = "sample tag name1";
|
||||||
|
List<Tag> tags2 = new List<Tag>(new Tag[] {tag2});
|
||||||
|
p2.Tags = tags2;
|
||||||
|
p2.Category = category2;
|
||||||
|
p2.PhotoUrls = photoUrls2;
|
||||||
|
|
||||||
|
// p1 and p2 should be equal (both object and attribute level)
|
||||||
|
Assert.IsTrue (category1.Equals (category2));
|
||||||
|
Assert.IsTrue (tags1.SequenceEqual (tags2));
|
||||||
|
Assert.IsTrue (p1.PhotoUrls.SequenceEqual(p2.PhotoUrls));
|
||||||
|
|
||||||
|
Assert.IsTrue (p1.Equals (p2));
|
||||||
|
|
||||||
|
// update attribute to that p1 and p2 are not equal
|
||||||
|
category2.Name = "new category name";
|
||||||
|
Assert.IsFalse(category1.Equals (category2));
|
||||||
|
|
||||||
|
tags2 = new List<Tag> ();
|
||||||
|
Assert.IsFalse (tags1.SequenceEqual (tags2));
|
||||||
|
|
||||||
|
// photoUrls has not changed so it should be equal
|
||||||
|
Assert.IsTrue (p1.PhotoUrls.SequenceEqual(p2.PhotoUrls));
|
||||||
|
|
||||||
|
Assert.IsFalse (p1.Equals (p2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,8 +1,8 @@
|
|||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
|
||||||
/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
|
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -148,6 +148,13 @@
|
|||||||
<version>${jodatime-version}</version>
|
<version>${jodatime-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Base64 encoding that works in both JVM and Android -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.brsanthu</groupId>
|
||||||
|
<artifactId>migbase64</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-19T13:52:16.052+01:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:23.285+08:00")
|
||||||
public class ApiKeyAuth implements Authentication {
|
public class ApiKeyAuth implements Authentication {
|
||||||
private final String location;
|
private final String location;
|
||||||
private final String paramName;
|
private final String paramName;
|
||||||
@ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String value;
|
String value;
|
||||||
if (apiKeyPrefix != null) {
|
if (apiKeyPrefix != null) {
|
||||||
value = apiKeyPrefix + " " + apiKey;
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
@ -2,13 +2,14 @@ package io.swagger.client.auth;
|
|||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
|
||||||
|
import com.migcomponents.migbase64.Base64;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-19T13:52:16.052+01:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-22T13:15:32.345+08:00")
|
||||||
public class HttpBasicAuth implements Authentication {
|
public class HttpBasicAuth implements Authentication {
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
@ -31,9 +32,12 @@ public class HttpBasicAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
try {
|
try {
|
||||||
headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8")));
|
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,13 @@
|
|||||||
<version>${jodatime-version}</version>
|
<version>${jodatime-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Base64 encoding that works in both JVM and Android -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.brsanthu</groupId>
|
||||||
|
<artifactId>migbase64</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
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-20T17:28:47.318+08:00")
|
||||||
public class ApiKeyAuth implements Authentication {
|
public class ApiKeyAuth implements Authentication {
|
||||||
private final String location;
|
private final String location;
|
||||||
private final String paramName;
|
private final String paramName;
|
||||||
@ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String value;
|
String value;
|
||||||
if (apiKeyPrefix != null) {
|
if (apiKeyPrefix != null) {
|
||||||
value = apiKeyPrefix + " " + apiKey;
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
@ -2,13 +2,14 @@ package io.swagger.client.auth;
|
|||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
|
||||||
|
import com.migcomponents.migbase64.Base64;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
|
||||||
|
|
||||||
@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-22T13:15:27.225+08:00")
|
||||||
public class HttpBasicAuth implements Authentication {
|
public class HttpBasicAuth implements Authentication {
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
@ -31,9 +32,12 @@ public class HttpBasicAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
try {
|
try {
|
||||||
headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8")));
|
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,6 @@
|
|||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>${gson-version}</version>
|
<version>${gson-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.brsanthu</groupId>
|
|
||||||
<artifactId>migbase64</artifactId>
|
|
||||||
<version>2.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -64,6 +64,38 @@ import io.swagger.client.auth.ApiKeyAuth;
|
|||||||
import io.swagger.client.auth.OAuth;
|
import io.swagger.client.auth.OAuth;
|
||||||
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
|
public static final double JAVA_VERSION;
|
||||||
|
public static final boolean IS_ANDROID;
|
||||||
|
public static final int ANDROID_SDK_VERSION;
|
||||||
|
|
||||||
|
static {
|
||||||
|
JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version"));
|
||||||
|
boolean isAndroid;
|
||||||
|
try {
|
||||||
|
Class.forName("android.app.Activity");
|
||||||
|
isAndroid = true;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
isAndroid = false;
|
||||||
|
}
|
||||||
|
IS_ANDROID = isAndroid;
|
||||||
|
int sdkVersion = 0;
|
||||||
|
if (IS_ANDROID) {
|
||||||
|
try {
|
||||||
|
sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null));
|
||||||
|
} catch (Exception e2) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ANDROID_SDK_VERSION = sdkVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The datetime format to be used when <code>lenientDatetimeFormat</code> is enabled.
|
||||||
|
*/
|
||||||
|
public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||||
|
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
private String basePath = "http://petstore.swagger.io/v2";
|
||||||
private boolean lenientOnJson = false;
|
private boolean lenientOnJson = false;
|
||||||
private boolean debugging = false;
|
private boolean debugging = false;
|
||||||
@ -100,8 +132,7 @@ public class ApiClient {
|
|||||||
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
// Always use UTC as the default time zone when dealing with date (without time).
|
// Always use UTC as the default time zone when dealing with date (without time).
|
||||||
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
// Use the system's default time zone when dealing with datetime (mainly formatting).
|
initDatetimeFormat();
|
||||||
this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
|
||||||
|
|
||||||
// Be lenient on datetime formats when parsing datetime from string.
|
// Be lenient on datetime formats when parsing datetime from string.
|
||||||
// See <code>parseDatetime</code>.
|
// See <code>parseDatetime</code>.
|
||||||
@ -262,25 +293,30 @@ public class ApiClient {
|
|||||||
if (str == null)
|
if (str == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
DateFormat format;
|
||||||
if (lenientDatetimeFormat) {
|
if (lenientDatetimeFormat) {
|
||||||
/*
|
/*
|
||||||
* When lenientDatetimeFormat is enabled, process the given string
|
* When lenientDatetimeFormat is enabled, normalize the date string
|
||||||
* to support various formats defined by ISO 8601.
|
* into <code>LENIENT_DATETIME_FORMAT</code> to support various formats
|
||||||
|
* defined by ISO 8601.
|
||||||
*/
|
*/
|
||||||
// normalize time zone
|
// normalize time zone
|
||||||
// trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+00:00
|
// trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("[zZ]\\z", "+00:00");
|
str = str.replaceAll("[zZ]\\z", "+0000");
|
||||||
// add colon: 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05+00:00
|
// remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("([+-]\\d{2})(\\d{2})\\z", "$1:$2");
|
str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2");
|
||||||
// expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+00:00
|
// expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000
|
||||||
str = str.replaceAll("([+-]\\d{2})\\z", "$1:00");
|
str = str.replaceAll("([+-]\\d{2})\\z", "$100");
|
||||||
// add milliseconds when missing
|
// add milliseconds when missing
|
||||||
// 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05.000+00:00
|
// 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000
|
||||||
str = str.replaceAll("(:\\d{1,2})([+-]\\d{2}:\\d{2})\\z", "$1.000$2");
|
str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2");
|
||||||
|
format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT);
|
||||||
|
} else {
|
||||||
|
format = this.datetimeFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return datetimeFormat.parse(str);
|
return format.parse(str);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -915,6 +951,31 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize datetime format according to the current environment, e.g. Java 1.7 and Android.
|
||||||
|
*/
|
||||||
|
private void initDatetimeFormat() {
|
||||||
|
String formatWithTimeZone = null;
|
||||||
|
if (IS_ANDROID) {
|
||||||
|
if (ANDROID_SDK_VERSION >= 18) {
|
||||||
|
// The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18)
|
||||||
|
formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
|
||||||
|
}
|
||||||
|
} else if (JAVA_VERSION >= 1.7) {
|
||||||
|
// The time zone format "XXX" is available since Java 1.7
|
||||||
|
formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
||||||
|
}
|
||||||
|
if (formatWithTimeZone != null) {
|
||||||
|
this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone);
|
||||||
|
// NOTE: Use the system's default time zone (mainly for datetime formatting).
|
||||||
|
} else {
|
||||||
|
// Use a common format that works across all systems.
|
||||||
|
this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
// Always use the UTC time zone as we are using a constant trailing "Z" here.
|
||||||
|
this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply SSL related settings to httpClient according to the current values of
|
* Apply SSL related settings to httpClient according to the current values of
|
||||||
* verifyingSsl and sslCaCert.
|
* verifyingSsl and sslCaCert.
|
||||||
|
@ -5,7 +5,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:42:25.339-07:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:54.086+08:00")
|
||||||
public class ApiKeyAuth implements Authentication {
|
public class ApiKeyAuth implements Authentication {
|
||||||
private final String location;
|
private final String location;
|
||||||
private final String paramName;
|
private final String paramName;
|
||||||
@ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String value;
|
String value;
|
||||||
if (apiKeyPrefix != null) {
|
if (apiKeyPrefix != null) {
|
||||||
value = apiKeyPrefix + " " + apiKey;
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
@ -2,7 +2,7 @@ package io.swagger.client.auth;
|
|||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
|
||||||
import com.migcomponents.migbase64.Base64;
|
import com.squareup.okhttp.Credentials;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,11 +31,11 @@ public class HttpBasicAuth implements Authentication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
if (username == null && password == null) {
|
||||||
try {
|
return;
|
||||||
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
headerParams.put("Authorization", Credentials.basic(
|
||||||
|
username == null ? "" : username,
|
||||||
|
password == null ? "" : password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,20 @@ public class ApiKeyAuthTest {
|
|||||||
assertEquals(0, headerParams.size());
|
assertEquals(0, headerParams.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApplyToParamsInQueryWithNullValue() {
|
||||||
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||||
|
auth.setApiKey(null);
|
||||||
|
auth.applyToParams(queryParams, headerParams);
|
||||||
|
|
||||||
|
// no changes to parameters
|
||||||
|
assertEquals(0, queryParams.size());
|
||||||
|
assertEquals(0, headerParams.size());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApplyToParamsInHeaderWithPrefix() {
|
public void testApplyToParamsInHeaderWithPrefix() {
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
@ -44,4 +58,19 @@ public class ApiKeyAuthTest {
|
|||||||
assertEquals(1, headerParams.size());
|
assertEquals(1, headerParams.size());
|
||||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
|
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApplyToParamsInHeaderWithNullValue() {
|
||||||
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||||
|
auth.setApiKey(null);
|
||||||
|
auth.setApiKeyPrefix("Token");
|
||||||
|
auth.applyToParams(queryParams, headerParams);
|
||||||
|
|
||||||
|
// no changes to parameters
|
||||||
|
assertEquals(0, queryParams.size());
|
||||||
|
assertEquals(0, headerParams.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,5 +48,15 @@ public class HttpBasicAuthTest {
|
|||||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||||
expected = "Basic bXktdXNlcm5hbWU6";
|
expected = "Basic bXktdXNlcm5hbWU6";
|
||||||
assertEquals(expected, headerParams.get("Authorization"));
|
assertEquals(expected, headerParams.get("Authorization"));
|
||||||
|
|
||||||
|
// null username and password should be ignored
|
||||||
|
queryParams = new ArrayList<Pair>();
|
||||||
|
headerParams = new HashMap<String, String>();
|
||||||
|
auth.setUsername(null);
|
||||||
|
auth.setPassword(null);
|
||||||
|
auth.applyToParams(queryParams, headerParams);
|
||||||
|
// no changes to parameters
|
||||||
|
assertEquals(0, queryParams.size());
|
||||||
|
assertEquals(0, headerParams.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,15 +317,21 @@ sub update_params_for_auth {
|
|||||||
foreach my $auth (@$auth_settings) {
|
foreach my $auth (@$auth_settings) {
|
||||||
# determine which one to use
|
# determine which one to use
|
||||||
if (!defined($auth)) {
|
if (!defined($auth)) {
|
||||||
|
# TODO show warning about auth setting not defined
|
||||||
}
|
}
|
||||||
elsif ($auth eq 'api_key') {
|
elsif ($auth eq 'api_key') {
|
||||||
$header_params->{'api_key'} = $self->get_api_key_with_prefix('api_key');
|
|
||||||
|
|
||||||
|
my $api_key = $self->get_api_key_with_prefix('api_key');
|
||||||
|
if ($api_key) {
|
||||||
|
$header_params->{'api_key'} = $api_key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ($auth eq 'petstore_auth') {
|
elsif ($auth eq 'petstore_auth') {
|
||||||
|
|
||||||
|
if ($WWW::SwaggerClient::Configuration::access_token) {
|
||||||
$header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token;
|
$header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
# TODO show warning about security definition not found
|
# TODO show warning about security definition not found
|
||||||
|
@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
|
|||||||
default => sub { {
|
default => sub { {
|
||||||
app_name => 'Swagger Petstore',
|
app_name => 'Swagger Petstore',
|
||||||
app_version => '1.0.0',
|
app_version => '1.0.0',
|
||||||
generated_date => '2015-11-13T20:46:43.271Z',
|
generated_date => '2015-11-20T17:35:18.902+08:00',
|
||||||
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
|
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
|
||||||
} },
|
} },
|
||||||
documentation => 'Information about the application version and the codegen codebase version'
|
documentation => 'Information about the application version and the codegen codebase version'
|
||||||
@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
|
|||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item Build date: 2015-11-13T20:46:43.271Z
|
=item Build date: 2015-11-20T17:35:18.902+08:00
|
||||||
|
|
||||||
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
||||||
|
|
||||||
|
@ -135,8 +135,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -200,8 +202,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -264,8 +268,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -340,8 +346,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -424,13 +432,13 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires API key authentication
|
||||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||||
if (isset($apiKey)) {
|
if ($apiKey !== null) {
|
||||||
$headerParams['api_key'] = $apiKey;
|
$headerParams['api_key'] = $apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -526,8 +534,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -602,8 +612,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
@ -694,8 +706,10 @@ class PetApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires OAuth (access token)
|
||||||
|
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
|
||||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
|
@ -130,13 +130,13 @@ class StoreApi
|
|||||||
$httpBody = $formParams; // for HTTP post (form)
|
$httpBody = $formParams; // for HTTP post (form)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this endpoint requires API key authentication
|
||||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||||
if (isset($apiKey)) {
|
if ($apiKey !== null) {
|
||||||
$headerParams['api_key'] = $apiKey;
|
$headerParams['api_key'] = $apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// make the API Call
|
// make the API Call
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ class ApiClient
|
|||||||
* Constructor of the class
|
* Constructor of the class
|
||||||
* @param Configuration $config config for this ApiClient
|
* @param Configuration $config config for this ApiClient
|
||||||
*/
|
*/
|
||||||
function __construct(Configuration $config = null)
|
public function __construct(Configuration $config = null)
|
||||||
{
|
{
|
||||||
if ($config == null) {
|
if ($config == null) {
|
||||||
$config = Configuration::getDefaultConfiguration();
|
$config = Configuration::getDefaultConfiguration();
|
||||||
|
@ -193,7 +193,7 @@ class ObjectSerializer
|
|||||||
$deserialized = $values;
|
$deserialized = $values;
|
||||||
} elseif ($class === '\DateTime') {
|
} elseif ($class === '\DateTime') {
|
||||||
$deserialized = new \DateTime($data);
|
$deserialized = new \DateTime($data);
|
||||||
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
|
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||||
settype($data, $class);
|
settype($data, $class);
|
||||||
$deserialized = $data;
|
$deserialized = $data;
|
||||||
} elseif ($class === '\SplFileObject') {
|
} elseif ($class === '\SplFileObject') {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -20,3 +20,17 @@ Requirement already satisfied (use --upgrade to upgrade): randomize in ./.venv/l
|
|||||||
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
|
||||||
|
@ -453,7 +453,9 @@ class ApiClient(object):
|
|||||||
for auth in auth_settings:
|
for auth in auth_settings:
|
||||||
auth_setting = config.auth_settings().get(auth)
|
auth_setting = config.auth_settings().get(auth)
|
||||||
if auth_setting:
|
if auth_setting:
|
||||||
if auth_setting['in'] == 'header':
|
if not auth_setting['value']:
|
||||||
|
continue
|
||||||
|
elif auth_setting['in'] == 'header':
|
||||||
headers[auth_setting['key']] = auth_setting['value']
|
headers[auth_setting['key']] = auth_setting['value']
|
||||||
elif auth_setting['in'] == 'query':
|
elif auth_setting['in'] == 'query':
|
||||||
querys[auth_setting['key']] = auth_setting['value']
|
querys[auth_setting['key']] = auth_setting['value']
|
||||||
|
@ -79,6 +79,7 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/pet'.replace('{format}', 'json')
|
resource_path = '/pet'.replace('{format}', 'json')
|
||||||
method = 'PUT'
|
method = 'PUT'
|
||||||
|
|
||||||
@ -154,6 +155,7 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/pet'.replace('{format}', 'json')
|
resource_path = '/pet'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -229,6 +231,7 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
|
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -304,6 +307,7 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/pet/findByTags'.replace('{format}', 'json')
|
resource_path = '/pet/findByTags'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -365,9 +369,6 @@ class PetApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'pet_id' is set
|
|
||||||
if pet_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
|
|
||||||
|
|
||||||
all_params = ['pet_id']
|
all_params = ['pet_id']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -382,6 +383,10 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'pet_id' is set
|
||||||
|
if ('pet_id' not in params) or (params['pet_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
|
||||||
|
|
||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -445,9 +450,6 @@ class PetApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'pet_id' is set
|
|
||||||
if pet_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
|
|
||||||
|
|
||||||
all_params = ['pet_id', 'name', 'status']
|
all_params = ['pet_id', 'name', 'status']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -462,6 +464,10 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'pet_id' is set
|
||||||
|
if ('pet_id' not in params) or (params['pet_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
|
||||||
|
|
||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -528,9 +534,6 @@ class PetApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'pet_id' is set
|
|
||||||
if pet_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
|
|
||||||
|
|
||||||
all_params = ['pet_id', 'api_key']
|
all_params = ['pet_id', 'api_key']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -545,6 +548,10 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'pet_id' is set
|
||||||
|
if ('pet_id' not in params) or (params['pet_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
|
||||||
|
|
||||||
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
@ -610,9 +617,6 @@ class PetApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'pet_id' is set
|
|
||||||
if pet_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
|
|
||||||
|
|
||||||
all_params = ['pet_id', 'additional_metadata', 'file']
|
all_params = ['pet_id', 'additional_metadata', 'file']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -627,6 +631,10 @@ class PetApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'pet_id' is set
|
||||||
|
if ('pet_id' not in params) or (params['pet_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
|
||||||
|
|
||||||
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
|
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ class StoreApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/store/inventory'.replace('{format}', 'json')
|
resource_path = '/store/inventory'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ class StoreApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/store/order'.replace('{format}', 'json')
|
resource_path = '/store/order'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -212,9 +214,6 @@ class StoreApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'order_id' is set
|
|
||||||
if order_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
|
|
||||||
|
|
||||||
all_params = ['order_id']
|
all_params = ['order_id']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -229,6 +228,10 @@ class StoreApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'order_id' is set
|
||||||
|
if ('order_id' not in params) or (params['order_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
|
||||||
|
|
||||||
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -290,9 +293,6 @@ class StoreApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'order_id' is set
|
|
||||||
if order_id is None:
|
|
||||||
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
|
|
||||||
|
|
||||||
all_params = ['order_id']
|
all_params = ['order_id']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -307,6 +307,10 @@ class StoreApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'order_id' is set
|
||||||
|
if ('order_id' not in params) or (params['order_id'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
|
||||||
|
|
||||||
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/user'.replace('{format}', 'json')
|
resource_path = '/user'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -154,6 +155,7 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/user/createWithArray'.replace('{format}', 'json')
|
resource_path = '/user/createWithArray'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -229,6 +231,7 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/user/createWithList'.replace('{format}', 'json')
|
resource_path = '/user/createWithList'.replace('{format}', 'json')
|
||||||
method = 'POST'
|
method = 'POST'
|
||||||
|
|
||||||
@ -305,6 +308,7 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/user/login'.replace('{format}', 'json')
|
resource_path = '/user/login'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -381,6 +385,7 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
|
||||||
resource_path = '/user/logout'.replace('{format}', 'json')
|
resource_path = '/user/logout'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -440,9 +445,6 @@ class UserApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'username' is set
|
|
||||||
if username is None:
|
|
||||||
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
|
|
||||||
|
|
||||||
all_params = ['username']
|
all_params = ['username']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -457,6 +459,10 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'username' is set
|
||||||
|
if ('username' not in params) or (params['username'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
|
||||||
|
|
||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
|
|
||||||
@ -519,9 +525,6 @@ class UserApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'username' is set
|
|
||||||
if username is None:
|
|
||||||
raise ValueError("Missing the required parameter `username` when calling `update_user`")
|
|
||||||
|
|
||||||
all_params = ['username', 'body']
|
all_params = ['username', 'body']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -536,6 +539,10 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'username' is set
|
||||||
|
if ('username' not in params) or (params['username'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `username` when calling `update_user`")
|
||||||
|
|
||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'PUT'
|
method = 'PUT'
|
||||||
|
|
||||||
@ -599,9 +606,6 @@ class UserApi(object):
|
|||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
# verify the required parameter 'username' is set
|
|
||||||
if username is None:
|
|
||||||
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
|
|
||||||
|
|
||||||
all_params = ['username']
|
all_params = ['username']
|
||||||
all_params.append('callback')
|
all_params.append('callback')
|
||||||
@ -616,6 +620,10 @@ class UserApi(object):
|
|||||||
params[key] = val
|
params[key] = val
|
||||||
del params['kwargs']
|
del params['kwargs']
|
||||||
|
|
||||||
|
# verify the required parameter 'username' is set
|
||||||
|
if ('username' not in params) or (params['username'] is None):
|
||||||
|
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
|
||||||
|
|
||||||
resource_path = '/user/{username}'.replace('{format}', 'json')
|
resource_path = '/user/{username}'.replace('{format}', 'json')
|
||||||
method = 'DELETE'
|
method = 'DELETE'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user