forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
23
README.md
23
README.md
@@ -28,6 +28,7 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit
|
||||
- [Run docker in Vagrant](#run-docker-in-vagrant)
|
||||
- [Public Docker image](#public-docker-image)
|
||||
- [Homebrew](#homebrew)
|
||||
- [Getting Started](#getting-started)
|
||||
- Generators
|
||||
- [To generate a sample client library](#to-generate-a-sample-client-library)
|
||||
- [Generating libraries from your server](#generating-libraries-from-your-server)
|
||||
@@ -141,7 +142,27 @@ Here is an example usage:
|
||||
```
|
||||
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/
|
||||
```
|
||||
## Getting Started
|
||||
|
||||
To generate a PHP client for http://petstore.swagger.io/v2/swagger.json, please run the following
|
||||
```sh
|
||||
git clone https://github.com/swagger-api/swagger-codegen
|
||||
cd swagger-codegen
|
||||
mvn clean package
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l php \
|
||||
-o /var/tmp/php_api_client
|
||||
```
|
||||
(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`)
|
||||
|
||||
You can also download the JAR (latest relesae) directly from [maven.org]( http://central.maven.org/maven2/io/swagger/swagger-codegen/2.1.6/swagger-codegen-2.1.6.jar)
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate`
|
||||
|
||||
To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l php`
|
||||
|
||||
## Generators
|
||||
|
||||
### To generate a sample client library
|
||||
You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows:
|
||||
@@ -150,7 +171,7 @@ You can build a client against the swagger sample [petstore](http://petstore.swa
|
||||
./bin/java-petstore.sh
|
||||
```
|
||||
|
||||
(On Windows, run `./bin/windows/java-petstore.bat` instead)
|
||||
(On Windows, run `.\bin\windows\java-petstore.bat` instead)
|
||||
|
||||
This will run the generator with this command:
|
||||
|
||||
|
||||
@@ -50,3 +50,4 @@ cd $APP_DIR
|
||||
./bin/typescript-angular-petstore.sh
|
||||
./bin/typescript-angular2-petstore.sh
|
||||
./bin/typescript-node-petstore.sh
|
||||
./bin/lumen-petstore-server.sh
|
||||
@@ -7,3 +7,4 @@
|
||||
./bin/java-petstore-okhttp-gson.sh
|
||||
./bin/java-petstore-retrofit.sh
|
||||
./bin/java-petstore-retrofit2.sh
|
||||
./bin/java-petstore-retrofit2rx.sh
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
31
bin/lumen-petstore-server.sh
Executable file
31
bin/lumen-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/lumen -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l lumen -o samples/server/petstore/lumen"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"title": "SDK Unit Testing - File Downloading"
|
||||
},
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"host": "localhost:3000",
|
||||
"basePath": "/unittesting",
|
||||
"paths": {
|
||||
"/request/file_uploading": {
|
||||
"get": {
|
||||
"operationId": "file_uploading",
|
||||
"tags": [
|
||||
"Request"
|
||||
],
|
||||
"parameters": [
|
||||
{"name": "f1",
|
||||
"in": "formData",
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"required": true
|
||||
},
|
||||
{"name": "f2",
|
||||
"in": "formData",
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"required": false
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/response/file_downloading": {
|
||||
"get": {
|
||||
"operationId": "file_downloading",
|
||||
"tags": [
|
||||
"Response"
|
||||
],
|
||||
"produces": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"title": "SDK Unit Testing - File Downloading"
|
||||
},
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"host": "localhost:3000",
|
||||
"basePath": "/unittesting",
|
||||
"paths": {
|
||||
"/response/file_downloading": {
|
||||
"get": {
|
||||
"operationId": "file_downloading",
|
||||
"tags": [
|
||||
"Response"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected boolean serializeBigDecimalAsString = false;
|
||||
protected boolean useRxJava = false;
|
||||
protected boolean hideGenerationTimestamp = false;
|
||||
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
public JavaClientCodegen() {
|
||||
super();
|
||||
@@ -60,6 +61,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
"localVarPath", "localVarQueryParams", "localVarHeaderParams", "localVarFormParams",
|
||||
"localVarPostBody", "localVarAccepts", "localVarAccept", "localVarContentTypes",
|
||||
"localVarContentType", "localVarAuthNames", "localReturnType",
|
||||
"ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil",
|
||||
|
||||
// language reserved words
|
||||
"abstract", "continue", "for", "new", "switch", "assert",
|
||||
@@ -208,6 +210,10 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
additionalProperties.put(FULL_JAVA_UTIL, fullJavaUtil);
|
||||
additionalProperties.put("javaUtilPrefix", javaUtilPrefix);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
importMapping.put("List", "java.util.List");
|
||||
|
||||
if (fullJavaUtil) {
|
||||
@@ -269,7 +275,14 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// library-specific files
|
||||
if ("okhttp-gson".equals(getLibrary())) {
|
||||
if (StringUtils.isEmpty(getLibrary())) {
|
||||
// generate markdown docs
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
} else if ("okhttp-gson".equals(getLibrary())) {
|
||||
// generate markdown docs
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
|
||||
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
|
||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
||||
@@ -282,6 +295,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java"));
|
||||
supportingFiles.add(new SupportingFile("CollectionFormats.mustache", invokerFolder, "CollectionFormats.java"));
|
||||
} else if("jersey2".equals(getLibrary())) {
|
||||
// generate markdown docs
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||
}
|
||||
|
||||
@@ -353,6 +369,26 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', '/');
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
// sanitize name
|
||||
@@ -497,6 +533,70 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return super.toDefaultValue(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("String".equals(type)) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if ("Integer".equals(type) || "Short".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
} else if ("Long".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
example = example + "L";
|
||||
} else if ("Float".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
example = example + "F";
|
||||
} else if ("Double".equals(type)) {
|
||||
example = "3.4";
|
||||
example = example + "D";
|
||||
} else if ("Boolean".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "true";
|
||||
}
|
||||
} else if ("File".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "new File(\"" + escapeText(example) + "\")";
|
||||
} else if ("Date".equals(type)) {
|
||||
example = "new Date()";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + type + "()";
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
example = "null";
|
||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||
example = "Arrays.asList(" + example + ")";
|
||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||
example = "new HashMap()";
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
|
||||
@@ -524,26 +524,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
typeMapping.put("array", "Array");
|
||||
typeMapping.put("List", "Array");
|
||||
typeMapping.put("map", "Object");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("boolean", "Boolean");
|
||||
typeMapping.put("char", "String");
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("short", "Integer");
|
||||
typeMapping.put("int", "Integer");
|
||||
typeMapping.put("integer", "Integer");
|
||||
typeMapping.put("long", "Integer");
|
||||
typeMapping.put("float", "Number");
|
||||
typeMapping.put("double", "Number");
|
||||
typeMapping.put("number", "Number");
|
||||
typeMapping.put("DateTime", "Date");
|
||||
typeMapping.put("Date", "Date");
|
||||
typeMapping.put("file", "File");
|
||||
// binary not supported in JavaScript client right now, using String as a workaround
|
||||
typeMapping.put("binary", "String");
|
||||
|
||||
if ("String".equals(type)) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.models.properties.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
public class LumenServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// source folder where to write the files
|
||||
protected String sourceFolder = "src";
|
||||
protected String apiVersion = "1.0.0";
|
||||
|
||||
/**
|
||||
* Configures the type of generator.
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
* @see io.swagger.codegen.CodegenType
|
||||
*/
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a friendly name for the generator. This will be used by the generator
|
||||
* to select the library with the -l flag.
|
||||
*
|
||||
* @return the friendly name for the generator
|
||||
*/
|
||||
public String getName() {
|
||||
return "lumen";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns human-friendly help for the generator. Provide the consumer with help
|
||||
* tips, parameters here
|
||||
*
|
||||
* @return A string value for the help message
|
||||
*/
|
||||
public String getHelp() {
|
||||
return "Generates a LumenServerCodegen client library.";
|
||||
}
|
||||
|
||||
public LumenServerCodegen() {
|
||||
super();
|
||||
|
||||
// set the output folder here
|
||||
outputFolder = "generated-code/lumen";
|
||||
String packagePath = "lumen";
|
||||
|
||||
// modelPackage = packagePath + "\\lib\\Models";
|
||||
// apiPackage = packagePath + "\\lib";
|
||||
// // outputFolder = "generated-code" + File.separator + "slim";
|
||||
// modelTemplateFiles.put("model.mustache", ".php");
|
||||
|
||||
/**
|
||||
* Models. You can write model files using the modelTemplateFiles map.
|
||||
* if you want to create one template for file, you can do so here.
|
||||
* for multiple files for model, just put another entry in the `modelTemplateFiles` with
|
||||
* a different extension
|
||||
*/
|
||||
// modelTemplateFiles.put(
|
||||
// "model.mustache", // the template to use
|
||||
// ".sample"); // the extension for each file to write
|
||||
|
||||
/**
|
||||
* Api classes. You can write classes for each Api file with the apiTemplateFiles map.
|
||||
* as with models, add multiple entries with different extensions for multiple files per
|
||||
* class
|
||||
*/
|
||||
// apiTemplateFiles.put(
|
||||
// "api.mustache", // the template to use
|
||||
// ".sample"); // the extension for each file to write
|
||||
|
||||
|
||||
// no api files
|
||||
apiTemplateFiles.clear();
|
||||
|
||||
// embeddedTemplateDir = templateDir = "slim";
|
||||
|
||||
/**
|
||||
* Template Location. This is the location which templates will be read from. The generator
|
||||
* will use the resource stream to attempt to read the templates.
|
||||
*/
|
||||
templateDir = "lumen";
|
||||
|
||||
/**
|
||||
* Api Package. Optional, if needed, this can be used in templates
|
||||
*/
|
||||
apiPackage = "io.swagger.client.api";
|
||||
|
||||
/**
|
||||
* Model Package. Optional, if needed, this can be used in templates
|
||||
*/
|
||||
modelPackage = "io.swagger.client.model";
|
||||
|
||||
/**
|
||||
* Reserved words. Override this with reserved words specific to your language
|
||||
*/
|
||||
reservedWords = new HashSet<String> (
|
||||
Arrays.asList(
|
||||
"sample1", // replace with static values
|
||||
"sample2")
|
||||
);
|
||||
|
||||
/**
|
||||
* Additional Properties. These values can be passed to the templates and
|
||||
* are available in models, apis, and supporting files
|
||||
*/
|
||||
additionalProperties.put("apiVersion", apiVersion);
|
||||
|
||||
/**
|
||||
* Supporting Files. You can write single files for the generator with the
|
||||
* entire object tree available. If the input file has a suffix of `.mustache
|
||||
* it will be processed by the template engine. Otherwise, it will be copied
|
||||
*/
|
||||
// supportingFiles.add(new SupportingFile("index.mustache", packagePath, "index.php"));
|
||||
// supportingFiles.add(new SupportingFile("routes.mustache", packagePath, "routes.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("composer.json", packagePath, "composer.json"));
|
||||
supportingFiles.add(new SupportingFile("readme.md", packagePath, "readme.md"));
|
||||
supportingFiles.add(new SupportingFile("artisan", packagePath, "artisan"));
|
||||
// supportingFiles.add(new SupportingFile("server.php", packagePath, "server.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("bootstrap" + File.separator + "app.php", packagePath + File.separator + "bootstrap", "app.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("public" + File.separator + "index.php", packagePath + File.separator + "public", "index.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "User.php", packagePath + File.separator + "app", "User.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Console" + File.separator + "Kernel.php", packagePath + File.separator + "app" + File.separator + "Console", "Kernel.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Exceptions" + File.separator + "Handler.php", packagePath + File.separator + "app" + File.separator + "Exceptions", "Handler.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Kernel.php", packagePath + File.separator + "app" + File.separator + "Http", "Kernel.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "routes.mustache", packagePath + File.separator + "app" + File.separator + "Http", "routes.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Controller.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "Controller.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "ExampleController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "ExampleController.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator + "AuthController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator, "AuthController.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator + "PasswordController.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator + "Auth" + File.separator, "PasswordController.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "Authenticate.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "Authenticate.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "ExampleMiddleware.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "ExampleMiddleware.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "RedirectIfAuthenticated.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "RedirectIfAuthenticated.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Middleware" + File.separator + "VerifyCsrfToken.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "VerifyCsrfToken.php"));
|
||||
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Http" + File.separator + "Requests" + File.separator + "Request.php", packagePath + File.separator + "app" + File.separator + "Http" + File.separator + "Requests" + File.separator, "Request.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "AppServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "AppServiceProvider.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "AuthServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "AuthServiceProvider.php"));
|
||||
supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "EventServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "EventServiceProvider.php"));
|
||||
// supportingFiles.add(new SupportingFile("app" + File.separator + "Providers" + File.separator + "RouteServiceProvider.php", packagePath + File.separator + "app" + File.separator + "Providers", "RouteServiceProvider.php"));
|
||||
|
||||
// supportingFiles.add(new SupportingFile("config" + File.separator + "app.php", packagePath + File.separator + "config" + File.separator, "app.php"));
|
||||
|
||||
/**
|
||||
* Language Specific Primitives. These types will not trigger imports by
|
||||
* the client generator
|
||||
*/
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"Type1", // replace these with your types
|
||||
"Type2")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
|
||||
* those terms here. This logic is only called if a variable matches the reseved words
|
||||
*
|
||||
* @return the escaped term
|
||||
*/
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
return "_" + name; // add an underscore to the name
|
||||
}
|
||||
|
||||
/**
|
||||
* Location to write model files. You can use the modelPackage() as defined when the class is
|
||||
* instantiated
|
||||
*/
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Location to write api files. You can use the apiPackage() as defined when the class is
|
||||
* instantiated
|
||||
*/
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional - type declaration. This is a String which is used by the templates to instantiate your
|
||||
* types. There is typically special handling for different property types
|
||||
*
|
||||
* @return a string value used as the `dataType` field for model templates, `returnType` for api templates
|
||||
*/
|
||||
@Override
|
||||
public String getTypeDeclaration(Property p) {
|
||||
if(p instanceof ArrayProperty) {
|
||||
ArrayProperty ap = (ArrayProperty) p;
|
||||
Property inner = ap.getItems();
|
||||
return getSwaggerType(p) + "[" + getTypeDeclaration(inner) + "]";
|
||||
}
|
||||
else if (p instanceof MapProperty) {
|
||||
MapProperty mp = (MapProperty) p;
|
||||
Property inner = mp.getAdditionalProperties();
|
||||
return getSwaggerType(p) + "[String, " + getTypeDeclaration(inner) + "]";
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional - swagger type conversion. This is used to map swagger types in a `Property` into
|
||||
* either language specific types via `typeMapping` or into complex models if there is not a mapping.
|
||||
*
|
||||
* @return a string value of the type or complex model for this property
|
||||
* @see io.swagger.models.properties.Property
|
||||
*/
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
String type = null;
|
||||
if(typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if(languageSpecificPrimitives.contains(type))
|
||||
return toModelName(type);
|
||||
}
|
||||
else
|
||||
type = swaggerType;
|
||||
return toModelName(type);
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
// local variable name used in API methods (endpoints)
|
||||
"all_params", "resource_path", "path_params", "query_params",
|
||||
"header_params", "form_params", "local_var_files", "body_params", "auth_settings",
|
||||
// @property
|
||||
"property",
|
||||
// python reserved words
|
||||
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
|
||||
"assert", "else", "if", "pass", "yield", "break", "except", "import",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation & Usage
|
||||
## Installation
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
@@ -20,18 +20,124 @@ mvn deploy
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||
### Maven users
|
||||
|
||||
Add this dependency to your project's POM:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<groupId>{{{groupId}}}</groupId>
|
||||
<artifactId>{{{artifactId}}}</artifactId>
|
||||
<version>{{{artifactVersion}}}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
|
||||
### Gradle users
|
||||
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
mvn package
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
* target/{{{artifactId}}}-{{{artifactVersion}}}.jar
|
||||
* target/lib/*.jar
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||
import {{{invokerPackage}}}.*;
|
||||
import {{{invokerPackage}}}.auth.*;
|
||||
import {{{invokerPackage}}}.model.*;
|
||||
import {{{package}}}.{{{classname}}};
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class {{{classname}}}Example {
|
||||
|
||||
public static void main(String[] args) {
|
||||
{{#hasAuthMethods}}ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setUsername("YOUR USERNAME");
|
||||
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setApiKey("YOUR API KEY");
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{{classname}}} apiInstance = new {{{classname}}}();
|
||||
{{#allParams}}
|
||||
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
try {
|
||||
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
System.out.println(result);{{/returnType}}
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}}All endpoints do not require authorization.
|
||||
{{/authMethods}}Authentication schemes defined for the API:
|
||||
{{#authMethods}}### {{name}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
- **Authorizatoin URL**: {{authorizationUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
||||
@@ -40,4 +146,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
# {{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
<a name="{{operationId}}"></a>
|
||||
# **{{operationId}}**
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
|
||||
{{summary}}{{#notes}}
|
||||
|
||||
{{notes}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:{{#hasAuthMethods}}
|
||||
//import {{{invokerPackage}}}.ApiClient;{{/hasAuthMethods}}
|
||||
//import {{{invokerPackage}}}.ApiException;{{#hasAuthMethods}}
|
||||
//import {{{invokerPackage}}}.Configuration;
|
||||
//import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
|
||||
//import {{{package}}}.{{{classname}}};
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setUsername("YOUR USERNAME");
|
||||
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setApiKey("YOUR API KEY");
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{{classname}}} apiInstance = new {{{classname}}}();
|
||||
{{#allParams}}
|
||||
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
try {
|
||||
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
System.out.println(result);{{/returnType}}
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
@@ -0,0 +1,7 @@
|
||||
# {{classname}}
|
||||
|
||||
## Enum
|
||||
|
||||
{{#allowableValues}}
|
||||
* `{{.}}`
|
||||
{{/allowableValues}}
|
||||
@@ -0,0 +1,43 @@
|
||||
# {{artifactId}}
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# {{classname}}
|
||||
|
||||
## Enum
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
* `{{name}}` (value: `{{value}}`)
|
||||
{{#enumVars}}{{/allowableValues}}
|
||||
@@ -0,0 +1,3 @@
|
||||
{{#models}}{{#model}}
|
||||
{{#isEnum}}{{>libraries/okhttp-gson/enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}}
|
||||
{{/model}}{{/models}}
|
||||
@@ -0,0 +1,43 @@
|
||||
# {{artifactId}}
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# {{artifactId}}
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{{#models}}{{#model}}
|
||||
{{#isEnum}}{{>enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}}
|
||||
{{/model}}{{/models}}
|
||||
@@ -0,0 +1,15 @@
|
||||
# {{classname}}
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#readOnly}} [readonly]{{/readOnly}}
|
||||
{{/vars}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
<a name="{{{datatypeWithEnum}}}"></a>
|
||||
## Enum: {{datatypeWithEnum}}
|
||||
Name | Value
|
||||
---- | -----{{#allowableValues}}{{#enumVars}}
|
||||
{{name}} | {{value}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/isEnum}}{{/vars}}
|
||||
@@ -12,7 +12,7 @@ Method | HTTP request | Description
|
||||
{{#operation}}
|
||||
<a name="{{operationId}}"></a>
|
||||
# **{{operationId}}**
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}})
|
||||
|
||||
{{summary}}{{#notes}}
|
||||
|
||||
@@ -26,25 +26,25 @@ var defaultClient = {{{moduleName}}}.ApiClient.default;
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.username = 'YOUR USERNAME'
|
||||
{{{name}}}.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
{{{name}}}.username = 'YOUR USERNAME';
|
||||
{{{name}}}.password = 'YOUR PASSWORD';{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.apiKey = "YOUR API KEY"
|
||||
{{{name}}}.apiKey = 'YOUR API KEY';
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.apiKeyPrefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}}
|
||||
//{{{name}}}.apiKeyPrefix = 'Token';{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.accessToken = "YOUR ACCESS TOKEN"{{/isOAuth}}
|
||||
{{{name}}}.accessToken = 'YOUR ACCESS TOKEN';{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
var apiInstance = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
|
||||
var apiInstance = new {{{moduleName}}}.{{{classname}}}();{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}
|
||||
var {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
var opts = { {{#allParams}}{{^required}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
};{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{#usePromises}}
|
||||
apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
|
||||
@@ -61,7 +61,7 @@ var callback = function(error, data, response) {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}
|
||||
};
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
|
||||
apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
|
||||
{{/usePromises}}
|
||||
```
|
||||
|
||||
|
||||
@@ -41,3 +41,4 @@ io.swagger.codegen.languages.AkkaScalaClientCodegen
|
||||
io.swagger.codegen.languages.CsharpDotNet2ClientCodegen
|
||||
io.swagger.codegen.languages.ClojureClientCodegen
|
||||
io.swagger.codegen.languages.HaskellServantCodegen
|
||||
io.swagger.codegen.languages.LumenServerCodegen
|
||||
@@ -38,6 +38,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
|
||||
{{/vars}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
|
||||
return {{#vars}}({{name}} == null ? {{classVarName}}.{{name}} == null : {{name}}.equals({{classVarName}}.{{name}})){{#hasMore}} &&
|
||||
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
{{#vars}}
|
||||
result = 31 * result + ({{name}} == null ? 0: {{name}}.hashCode());{{#hasMore}}{{/hasMore}}
|
||||
{{/vars}}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -38,6 +38,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
|
||||
{{/vars}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
|
||||
return {{#vars}}({{name}} == null ? {{classVarName}}.{{name}} == null : {{name}}.equals({{classVarName}}.{{name}})){{#hasMore}} &&
|
||||
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
{{#vars}}
|
||||
result = 31 * result + ({{name}} == null ? 0: {{name}}.hashCode());{{#hasMore}}{{/hasMore}}
|
||||
{{/vars}}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -17,7 +17,7 @@ Method | HTTP request | Description
|
||||
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace {{packageName}}.Model
|
||||
/// </summary>
|
||||
{{#vars}}{{^isReadOnly}} /// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param>
|
||||
{{/isReadOnly}}{{/vars}}
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/isReadOnly}}{{/vars}})
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}})
|
||||
{
|
||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
||||
if ({{name}} == null)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
AuthorizationException::class,
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
ValidationException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Factory as Auth;
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* The authentication guard factory instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Factory
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new middleware instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Factory $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Auth $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if ($this->auth->guard($guard)->guest()) {
|
||||
return response('Unauthorized.', 401);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class ExampleMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
{{#apiInfo}}/**
|
||||
* {{appName}}
|
||||
* @version {{appVersion}}
|
||||
*/
|
||||
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app->version();
|
||||
});
|
||||
|
||||
{{#apis}}{{#operations}}{{#operation}}
|
||||
/**
|
||||
* {{httpMethod}} {{nickname}}
|
||||
* Summary: {{summary}}
|
||||
* Notes: {{notes}}
|
||||
{{#hasProduces}} * Output-Formats: [{{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}}
|
||||
*/
|
||||
$app->{{httpMethod}}('{{path}}', function({{#pathParams}}${{paramName}}, {{/pathParams}}$null = null) use ($app) {
|
||||
{{#hasHeaderParams}}$headers = Request::header();{{/hasHeaderParams}}
|
||||
{{#hasQueryParams}}{{#queryParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}}
|
||||
{{/queryParams}}{{/hasQueryParams}}
|
||||
{{#hasFormParams}}{{#formParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} {{/formParams}}{{/hasFormParams}}
|
||||
|
||||
return response('How about implementing {{nickname}} as a {{httpMethod}} method ?');
|
||||
});
|
||||
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the authentication services for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Here you may define how you wish users to be authenticated for your Lumen
|
||||
// application. The callback which receives the incoming request instance
|
||||
// should return either a User instance or null. You're free to obtain
|
||||
// the User instance via an API token or any other method necessary.
|
||||
|
||||
Auth::viaRequest('api', function ($request) {
|
||||
if ($request->input('api_token')) {
|
||||
return User::where('api_token', $request->input('api_token'))->first();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\SomeEvent' => [
|
||||
'App\Listeners\EventListener',
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Laravel\Lumen\Auth\Authorizable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
|
||||
|
||||
class User extends Model implements
|
||||
AuthenticatableContract,
|
||||
AuthorizableContract
|
||||
{
|
||||
use Authenticatable, Authorizable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
];
|
||||
}
|
||||
35
modules/swagger-codegen/src/main/resources/lumen/artisan
Normal file
35
modules/swagger-codegen/src/main/resources/lumen/artisan
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| First we need to get an application instance. This creates an instance
|
||||
| of the application / container and bootstraps the application so it
|
||||
| is ready to receive HTTP / Console requests from the environment.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(
|
||||
'Illuminate\Contracts\Console\Kernel'
|
||||
);
|
||||
|
||||
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
try {
|
||||
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
|
||||
} catch (Dotenv\Exception\InvalidPathException $e) {
|
||||
//
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we will load the environment and create the application instance
|
||||
| that serves as the central piece of this framework. We'll use this
|
||||
| application as an "IoC" container and router for this framework.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Laravel\Lumen\Application(
|
||||
realpath(__DIR__.'/../')
|
||||
);
|
||||
|
||||
// $app->withFacades();
|
||||
|
||||
// $app->withEloquent();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Container Bindings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Now we will register a few bindings in the service container. We will
|
||||
| register the exception handler and the console kernel. You may add
|
||||
| your own bindings here if you like or you can make another file.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
class_alias('Illuminate\Support\Facades\Request', 'Request'); //to use the Reqesut facade
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we will register the middleware with the application. These can
|
||||
| be global middleware that run before and after each request into a
|
||||
| route or middleware that'll be assigned to some specific routes.
|
||||
|
|
||||
*/
|
||||
|
||||
// $app->middleware([
|
||||
// App\Http\Middleware\ExampleMiddleware::class
|
||||
// ]);
|
||||
|
||||
// $app->routeMiddleware([
|
||||
// 'auth' => App\Http\Middleware\Authenticate::class,
|
||||
// ]);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we will register all of the application's service providers which
|
||||
| are used to bind services into the container. Service providers are
|
||||
| totally optional, so you are not required to uncomment this line.
|
||||
|
|
||||
*/
|
||||
|
||||
// $app->register(App\Providers\AppServiceProvider::class);
|
||||
// $app->register(App\Providers\AuthServiceProvider::class);
|
||||
// $app->register(App\Providers\EventServiceProvider::class);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Load The Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next we will include the routes file so that they can all be added to
|
||||
| the application. This will provide all of the URLs the application
|
||||
| can respond to, as well as the controllers that may handle them.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
||||
require __DIR__.'/../app/Http/routes.php';
|
||||
});
|
||||
|
||||
return $app;
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "laravel/lumen",
|
||||
"description": "The Laravel Lumen Framework.",
|
||||
"keywords": ["framework", "laravel", "lumen"],
|
||||
"license": "MIT",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"laravel/lumen-framework": "5.2.*",
|
||||
"vlucas/phpdotenv": "~2.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)/$ /$1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| First we need to get an application instance. This creates an instance
|
||||
| of the application / container and bootstraps the application so it
|
||||
| is ready to receive HTTP / Console requests from the environment.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request
|
||||
| through the kernel, and send the associated response back to
|
||||
| the client's browser allowing them to enjoy the creative
|
||||
| and wonderful application we have prepared for them.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->run();
|
||||
21
modules/swagger-codegen/src/main/resources/lumen/readme.md
Normal file
21
modules/swagger-codegen/src/main/resources/lumen/readme.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## Lumen PHP Framework
|
||||
|
||||
[](https://travis-ci.org/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
|
||||
Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for the framework can be found on the [Lumen website](http://lumen.laravel.com/docs).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
|
||||
|
||||
### License
|
||||
|
||||
The Lumen framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
{{#apiInfo}}/**
|
||||
* {{appName}}
|
||||
* @version {{appVersion}}
|
||||
*/
|
||||
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app->version();
|
||||
});
|
||||
|
||||
{{#apis}}{{#operations}}{{#operation}}
|
||||
/**
|
||||
* {{httpMethod}} {{nickname}}
|
||||
* Summary: {{summary}}
|
||||
* Notes: {{notes}}
|
||||
{{#hasProduces}} * Output-Formats: [{{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}}
|
||||
*/
|
||||
Route::{{httpMethod}}('{{path}}', function({{#pathParams}}${{paramName}}, {{/pathParams}}null) use ($app) {
|
||||
{{#hasHeaderParams}}$headers = Request::header();{{/hasHeaderParams}}
|
||||
{{#hasQueryParams}}{{#queryParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}}
|
||||
{{/queryParams}}{{/hasQueryParams}}
|
||||
{{#hasFormParams}}{{#formParams}}${{paramName}} = Request::input('{{paramName}}');{{newline}} {{/formParams}}{{/hasFormParams}}
|
||||
|
||||
return response('How about implementing {{nickname}} as a {{httpMethod}} method ?');
|
||||
});
|
||||
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
2
modules/swagger-codegen/src/main/resources/lumen/storage/app/.gitignore
vendored
Normal file
2
modules/swagger-codegen/src/main/resources/lumen/storage/app/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
modules/swagger-codegen/src/main/resources/lumen/storage/framework/views/.gitignore
vendored
Normal file
2
modules/swagger-codegen/src/main/resources/lumen/storage/framework/views/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
modules/swagger-codegen/src/main/resources/lumen/storage/logs/.gitignore
vendored
Normal file
2
modules/swagger-codegen/src/main/resources/lumen/storage/logs/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$this->get('/');
|
||||
|
||||
$this->assertEquals(
|
||||
$this->response->getContent(), $this->app->version()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class TestCase extends Laravel\Lumen\Testing\TestCase
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Laravel\Lumen\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
return require __DIR__.'/../bootstrap/app.php';
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ $:.push File.expand_path("../lib", __FILE__)
|
||||
require "{{gemName}}/version"
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "{{gemName}}"
|
||||
s.name = "{{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}"
|
||||
s.version = {{moduleName}}::VERSION
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["{{gemAuthor}}"]
|
||||
s.email = ["{{gemAuthorEmail}}"]
|
||||
s.homepage = "{{gemHomepage}}"
|
||||
s.summary = "{{gemSummary}}"
|
||||
s.description = "{{gemDescription}}"
|
||||
s.license = "{{gemLicense}}"
|
||||
s.authors = ["{{gemAuthor}}{{^gemAuthor}}Swagger-Codegen{{/gemAuthor}}"]
|
||||
s.email = ["{{gemAuthorEmail}}{{^gemAuthorEmail}}{{infoEmail}}{{/gemAuthorEmail}}"]
|
||||
s.homepage = "{{gemHomepage}}{{^gemHomepage}}https://github.com/swagger-api/swagger-codegen{{/gemHomepage}}"
|
||||
s.summary = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}"
|
||||
s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}"
|
||||
s.license = "{{gemLicense}}{{^gemLicense}}{{{licenseInfo}}}{{^licenseInfo}}Apache 2.0{{/licenseInfo}}{{/gemLicense}}"
|
||||
|
||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
||||
s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.swagger.codegen.slim;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.LumenServerCodegen;
|
||||
import io.swagger.codegen.options.LumenServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class LumenServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private LumenServerCodegen clientCodegen;
|
||||
|
||||
public LumenServerOptionsTest() {
|
||||
super(new LumenServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(LumenServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class LumenServerOptionsProvider implements OptionsProvider {
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "lumen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -717,6 +717,8 @@ definitions:
|
||||
readOnly: true
|
||||
type: integer
|
||||
format: int32
|
||||
property:
|
||||
type: string
|
||||
xml:
|
||||
name: Name
|
||||
200_response:
|
||||
|
||||
@@ -56,7 +56,7 @@ public class OnlineGeneratorOptionsTest {
|
||||
{new StaticHtmlOptionsProvider()}, {new SwaggerOptionsProvider()},
|
||||
{new SwaggerYamlOptionsProvider()}, {new SwiftOptionsProvider()},
|
||||
{new TizenClientOptionsProvider()}, {new TypeScriptAngularClientOptionsProvider()},
|
||||
{new TypeScriptNodeClientOptionsProvider()}
|
||||
{new TypeScriptNodeClientOptionsProvider()}, {new LumenServerOptionsProvider()}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Hello world!
|
||||
@@ -35,38 +35,10 @@ public class JsonUtil {
|
||||
public static Type getListTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Animal>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Cat>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Category>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Dog>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<InlineResponse200>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Model200Response".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Model200Response>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ModelReturn".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<ModelReturn>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Name".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Name>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Order>>(){}.getType();
|
||||
}
|
||||
@@ -75,10 +47,6 @@ public class JsonUtil {
|
||||
return new TypeToken<List<Pet>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("SpecialModelName".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<SpecialModelName>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Tag>>(){}.getType();
|
||||
}
|
||||
@@ -93,38 +61,10 @@ public class JsonUtil {
|
||||
public static Type getTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Animal>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Cat>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Category>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Dog>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<InlineResponse200>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Model200Response".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Model200Response>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ModelReturn".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<ModelReturn>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Name".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Name>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Order>(){}.getType();
|
||||
}
|
||||
@@ -133,10 +73,6 @@ public class JsonUtil {
|
||||
return new TypeToken<Pet>(){}.getType();
|
||||
}
|
||||
|
||||
if ("SpecialModelName".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<SpecialModelName>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Tag>(){}.getType();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.swagger.client.model.*;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.client.model.Pet;
|
||||
import io.swagger.client.model.InlineResponse200;
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
@@ -38,7 +37,6 @@ public class PetApi {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
@@ -59,9 +57,7 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
"application/json","application/xml"
|
||||
@@ -76,8 +72,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -91,60 +86,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param body Pet object in the form of byte array
|
||||
* @return void
|
||||
*/
|
||||
public void addPetUsingByteArray (byte[] body) throws ApiException {
|
||||
Object localVarPostBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
"application/json","application/xml"
|
||||
};
|
||||
String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json";
|
||||
|
||||
if (localVarContentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
if(localVarResponse != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
@@ -171,11 +112,8 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
localVarHeaderParams.put("api_key", ApiInvoker.parameterToString(apiKey));
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -190,8 +128,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -205,11 +142,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for query
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return List<Pet>
|
||||
*/
|
||||
public List<Pet> findPetsByStatus (List<String> status) throws ApiException {
|
||||
@@ -226,11 +162,8 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
localVarQueryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -245,8 +178,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -260,7 +192,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
@@ -281,11 +212,8 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
localVarQueryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -300,8 +228,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -315,7 +242,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
@@ -341,9 +267,7 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -358,8 +282,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -373,123 +296,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return InlineResponse200
|
||||
*/
|
||||
public InlineResponse200 getPetByIdInObject (Long petId) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
};
|
||||
String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json";
|
||||
|
||||
if (localVarContentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
if(localVarResponse != null){
|
||||
return (InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return byte[]
|
||||
*/
|
||||
public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet");
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
};
|
||||
String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json";
|
||||
|
||||
if (localVarContentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
if(localVarResponse != null){
|
||||
return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
@@ -510,9 +316,7 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
"application/json","application/xml"
|
||||
@@ -527,8 +331,7 @@ public class PetApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -542,7 +345,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
@@ -570,9 +372,7 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
"application/x-www-form-urlencoded"
|
||||
@@ -596,8 +396,7 @@ public class PetApi {
|
||||
} else {
|
||||
// normal form params
|
||||
localVarFormParams.put("name", ApiInvoker.parameterToString(name));
|
||||
localVarFormParams.put("status", ApiInvoker.parameterToString(status));
|
||||
|
||||
localVarFormParams.put("status", ApiInvoker.parameterToString(status));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -612,7 +411,6 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
@@ -640,9 +438,7 @@ public class PetApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
@@ -666,8 +462,7 @@ public class PetApi {
|
||||
} else {
|
||||
// normal form params
|
||||
localVarFormParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -682,5 +477,4 @@ public class PetApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import io.swagger.client.model.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.client.model.Order;
|
||||
import java.util.Map;
|
||||
import io.swagger.client.model.Order;
|
||||
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
|
||||
@@ -37,7 +37,6 @@ public class StoreApi {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
@@ -63,9 +62,7 @@ public class StoreApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -80,8 +77,7 @@ public class StoreApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -95,62 +91,6 @@ public class StoreApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param status Status value that needs to be considered for query
|
||||
* @return List<Order>
|
||||
*/
|
||||
public List<Order> findOrdersByStatus (String status) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "status", status));
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
};
|
||||
String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json";
|
||||
|
||||
if (localVarContentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
if(localVarResponse != null){
|
||||
return (List<Order>) ApiInvoker.deserialize(localVarResponse, "array", Order.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
@@ -170,9 +110,7 @@ public class StoreApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -187,8 +125,7 @@ public class StoreApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -202,62 +139,9 @@ public class StoreApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
* @return Object
|
||||
*/
|
||||
public Object getInventoryInObject () throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
};
|
||||
String localVarContentType = localVarContentTypes.length > 0 ? localVarContentTypes[0] : "application/json";
|
||||
|
||||
if (localVarContentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
if(localVarResponse != null){
|
||||
return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return Order
|
||||
*/
|
||||
@@ -280,9 +164,7 @@ public class StoreApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -297,8 +179,7 @@ public class StoreApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -312,7 +193,6 @@ public class StoreApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
@@ -333,9 +213,7 @@ public class StoreApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -350,8 +228,7 @@ public class StoreApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -365,5 +242,4 @@ public class StoreApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class UserApi {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -58,9 +57,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -75,8 +72,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -90,7 +86,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@@ -111,9 +106,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -128,8 +121,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -143,7 +135,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@@ -164,9 +155,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -181,8 +170,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -196,7 +184,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -222,9 +209,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -239,8 +224,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -254,7 +238,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
@@ -280,9 +263,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -297,8 +278,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -312,7 +292,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
@@ -334,13 +313,9 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "username", username));
|
||||
|
||||
localVarQueryParams.addAll(ApiInvoker.parameterToPairs("", "password", password));
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -355,8 +330,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -370,7 +344,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
@@ -390,9 +363,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -407,8 +378,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -422,7 +392,6 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -449,9 +418,7 @@ public class UserApi {
|
||||
// form params
|
||||
Map<String, String> localVarFormParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] localVarContentTypes = {
|
||||
|
||||
@@ -466,8 +433,7 @@ public class UserApi {
|
||||
localVarPostBody = localVarBuilder.build();
|
||||
} else {
|
||||
// normal form params
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI(basePath, localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarContentType);
|
||||
@@ -481,5 +447,4 @@ public class UserApi {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Animal {\n");
|
||||
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Cat extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("declawed")
|
||||
private Boolean declawed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
public void setDeclawed(Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" declawed: ").append(declawed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ public class Category {
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -24,7 +23,6 @@ public class Category {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -35,7 +33,27 @@ public class Category {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return (id == null ? category.id == null : id.equals(category.id)) &&
|
||||
(name == null ? category.name == null : name.equals(category.name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (name == null ? 0: name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Dog extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("breed")
|
||||
private String breed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getBreed() {
|
||||
return breed;
|
||||
}
|
||||
public void setBreed(String breed) {
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" breed: ").append(breed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class InlineResponse200 {
|
||||
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("id")
|
||||
private Long id = null;
|
||||
@SerializedName("category")
|
||||
private Object category = null;
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
public enum StatusEnum {
|
||||
available, pending, sold,
|
||||
};
|
||||
@SerializedName("status")
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Object getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Object category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ApiModelProperty(value = "pet status in the store")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineResponse200 {\n");
|
||||
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" category: ").append(category).append("\n");
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" status: ").append(status).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name starting with number")
|
||||
public class Model200Response {
|
||||
|
||||
@SerializedName("name")
|
||||
private Integer name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(Integer name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Model200Response {\n");
|
||||
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
**/
|
||||
@ApiModel(description = "Model for testing reserved words")
|
||||
public class ModelReturn {
|
||||
|
||||
@SerializedName("return")
|
||||
private Integer _return = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getReturn() {
|
||||
return _return;
|
||||
}
|
||||
public void setReturn(Integer _return) {
|
||||
this._return = _return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelReturn {\n");
|
||||
|
||||
sb.append(" _return: ").append(_return).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name same as property name")
|
||||
public class Name {
|
||||
|
||||
@SerializedName("name")
|
||||
private Integer name = null;
|
||||
@SerializedName("snake_case")
|
||||
private Integer snakeCase = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(Integer name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getSnakeCase() {
|
||||
return snakeCase;
|
||||
}
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Name {\n");
|
||||
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" snakeCase: ").append(snakeCase).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ public class Order {
|
||||
@SerializedName("complete")
|
||||
private Boolean complete = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -36,7 +35,6 @@ public class Order {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -47,7 +45,6 @@ public class Order {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -58,7 +55,6 @@ public class Order {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -69,7 +65,6 @@ public class Order {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
@@ -81,7 +76,6 @@ public class Order {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -92,7 +86,35 @@ public class Order {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return (id == null ? order.id == null : id.equals(order.id)) &&
|
||||
(petId == null ? order.petId == null : petId.equals(order.petId)) &&
|
||||
(quantity == null ? order.quantity == null : quantity.equals(order.quantity)) &&
|
||||
(shipDate == null ? order.shipDate == null : shipDate.equals(order.shipDate)) &&
|
||||
(status == null ? order.status == null : status.equals(order.status)) &&
|
||||
(complete == null ? order.complete == null : complete.equals(order.complete));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (petId == null ? 0: petId.hashCode());
|
||||
result = 31 * result + (quantity == null ? 0: quantity.hashCode());
|
||||
result = 31 * result + (shipDate == null ? 0: shipDate.hashCode());
|
||||
result = 31 * result + (status == null ? 0: status.hashCode());
|
||||
result = 31 * result + (complete == null ? 0: complete.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -27,7 +27,6 @@ public class Pet {
|
||||
@SerializedName("status")
|
||||
private StatusEnum status = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -38,7 +37,6 @@ public class Pet {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -49,7 +47,6 @@ public class Pet {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@@ -60,7 +57,6 @@ public class Pet {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@@ -71,7 +67,6 @@ public class Pet {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -82,7 +77,6 @@ public class Pet {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@@ -94,7 +88,35 @@ public class Pet {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return (id == null ? pet.id == null : id.equals(pet.id)) &&
|
||||
(category == null ? pet.category == null : category.equals(pet.category)) &&
|
||||
(name == null ? pet.name == null : name.equals(pet.name)) &&
|
||||
(photoUrls == null ? pet.photoUrls == null : photoUrls.equals(pet.photoUrls)) &&
|
||||
(tags == null ? pet.tags == null : tags.equals(pet.tags)) &&
|
||||
(status == null ? pet.status == null : status.equals(pet.status));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (category == null ? 0: category.hashCode());
|
||||
result = 31 * result + (name == null ? 0: name.hashCode());
|
||||
result = 31 * result + (photoUrls == null ? 0: photoUrls.hashCode());
|
||||
result = 31 * result + (tags == null ? 0: tags.hashCode());
|
||||
result = 31 * result + (status == null ? 0: status.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class SpecialModelName {
|
||||
|
||||
@SerializedName("$special[property.name]")
|
||||
private Long specialPropertyName = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Long getSpecialPropertyName() {
|
||||
return specialPropertyName;
|
||||
}
|
||||
public void setSpecialPropertyName(Long specialPropertyName) {
|
||||
this.specialPropertyName = specialPropertyName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class SpecialModelName {\n");
|
||||
|
||||
sb.append(" specialPropertyName: ").append(specialPropertyName).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ public class Tag {
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -24,7 +23,6 @@ public class Tag {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -35,7 +33,27 @@ public class Tag {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return (id == null ? tag.id == null : id.equals(tag.id)) &&
|
||||
(name == null ? tag.name == null : name.equals(tag.name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (name == null ? 0: name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -25,7 +25,6 @@ public class User {
|
||||
@SerializedName("userStatus")
|
||||
private Integer userStatus = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -36,7 +35,6 @@ public class User {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -47,7 +45,6 @@ public class User {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -58,7 +55,6 @@ public class User {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -69,7 +65,6 @@ public class User {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -80,7 +75,6 @@ public class User {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -91,7 +85,6 @@ public class User {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
@@ -102,7 +95,6 @@ public class User {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
@@ -114,7 +106,39 @@ public class User {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return (id == null ? user.id == null : id.equals(user.id)) &&
|
||||
(username == null ? user.username == null : username.equals(user.username)) &&
|
||||
(firstName == null ? user.firstName == null : firstName.equals(user.firstName)) &&
|
||||
(lastName == null ? user.lastName == null : lastName.equals(user.lastName)) &&
|
||||
(email == null ? user.email == null : email.equals(user.email)) &&
|
||||
(password == null ? user.password == null : password.equals(user.password)) &&
|
||||
(phone == null ? user.phone == null : phone.equals(user.phone)) &&
|
||||
(userStatus == null ? user.userStatus == null : userStatus.equals(user.userStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (username == null ? 0: username.hashCode());
|
||||
result = 31 * result + (firstName == null ? 0: firstName.hashCode());
|
||||
result = 31 * result + (lastName == null ? 0: lastName.hashCode());
|
||||
result = 31 * result + (email == null ? 0: email.hashCode());
|
||||
result = 31 * result + (password == null ? 0: password.hashCode());
|
||||
result = 31 * result + (phone == null ? 0: phone.hashCode());
|
||||
result = 31 * result + (userStatus == null ? 0: userStatus.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ApiInvokerTest {
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
|
||||
List<Pair> pairs_a = ApiInvoker.parameterToPairs("csv", null, new Integer(1));
|
||||
List<Pair> pairs_b = ApiInvoker.parameterToPairs("csv", "", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = ApiInvoker.parameterToPairs("csv", "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
|
||||
|
||||
// single empty string
|
||||
List<Pair> pairs = ApiInvoker.parameterToPairs("csv", "param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
List<Pair> concatStrings = ApiInvoker.parameterToPairs("csv", "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.size());
|
||||
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
List<Pair> pairs = ApiInvoker.parameterToPairs("csv", name, value);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsCollection() throws Exception {
|
||||
Map<String, String> collectionFormatMap = new HashMap<String, String>();
|
||||
collectionFormatMap.put("csv", ",");
|
||||
collectionFormatMap.put("tsv", "\t");
|
||||
collectionFormatMap.put("ssv", " ");
|
||||
collectionFormatMap.put("pipes", "\\|");
|
||||
collectionFormatMap.put("", ","); // no format, must default to csv
|
||||
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
List<Pair> multiPairs = ApiInvoker.parameterToPairs("multi", name, values);
|
||||
assertEquals(values.size(), multiPairs.size());
|
||||
|
||||
// all other formats
|
||||
for (String collectionFormat : collectionFormatMap.keySet()) {
|
||||
List<Pair> pairs = ApiInvoker.parameterToPairs(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
|
||||
|
||||
// must equal input values
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
package io.swagger.petstore.test;
|
||||
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import io.swagger.client.ApiException;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PetApiTest {
|
||||
PetApi api = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new PetApi();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdatePet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("programmer");
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPetsByStatus() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("programmer");
|
||||
pet.setStatus(Pet.StatusEnum.available);
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
List<Pet> pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"}));
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(found);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
/* ignoring the findPetByTags test below as it's very similar to
|
||||
* testFindPetsByStatus and testFindPetsByTags sometimes got 500
|
||||
* due to server issue, which makes the test unstable.
|
||||
*/
|
||||
public void testFindPetsByTags() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("monster");
|
||||
pet.setStatus(Pet.StatusEnum.available);
|
||||
|
||||
List<Tag> tags = new ArrayList<Tag>();
|
||||
Tag tag1 = new Tag();
|
||||
tag1.setName("friendly");
|
||||
tags.add(tag1);
|
||||
pet.setTags(tags);
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
List<Pet> pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"}));
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdatePetWithForm() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("frank");
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertEquals("frank", fetched.getName());
|
||||
|
||||
api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null);
|
||||
Pet updated = api.getPetById(fetched.getId());
|
||||
assertEquals("furt", updated.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
api.deletePet(fetched.getId(), null);
|
||||
|
||||
try {
|
||||
fetched = api.getPetById(fetched.getId());
|
||||
fail("expected an error");
|
||||
} catch (ApiException e) {
|
||||
assertEquals(404, e.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploadFile() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet);
|
||||
|
||||
File file = new File("hello.txt");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.write("Hello world!");
|
||||
writer.close();
|
||||
|
||||
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
|
||||
}
|
||||
|
||||
private Pet createRandomPet() {
|
||||
Pet pet = new Pet();
|
||||
pet.setId(System.currentTimeMillis());
|
||||
pet.setName("gorilla");
|
||||
|
||||
Category category = new Category();
|
||||
category.setName("really-happy");
|
||||
|
||||
pet.setCategory(category);
|
||||
pet.setStatus(Pet.StatusEnum.available);
|
||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"});
|
||||
pet.setPhotoUrls(photos);
|
||||
|
||||
return pet;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package io.swagger.petstore.test;
|
||||
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import io.swagger.client.ApiException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class StoreApiTest {
|
||||
StoreApi api = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new StoreApi();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInventory() throws Exception {
|
||||
Map<String, Integer> inventory = api.getInventory();
|
||||
assertTrue(inventory.keySet().size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaceOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order);
|
||||
|
||||
Order fetched = api.getOrderById(String.valueOf(order.getId()));
|
||||
assertEquals(order.getId(), fetched.getId());
|
||||
assertEquals(order.getPetId(), fetched.getPetId());
|
||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order);
|
||||
|
||||
Order fetched = api.getOrderById(String.valueOf(order.getId()));
|
||||
assertEquals(fetched.getId(), order.getId());
|
||||
|
||||
api.deleteOrder(String.valueOf(order.getId()));
|
||||
|
||||
try {
|
||||
api.getOrderById(String.valueOf(order.getId()));
|
||||
// fail("expected an error");
|
||||
} catch (ApiException e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
private Order createOrder() {
|
||||
Order order = new Order();
|
||||
order.setId(new Long(System.currentTimeMillis()));
|
||||
order.setPetId(new Long(200));
|
||||
order.setQuantity(new Integer(13));
|
||||
order.setShipDate(new java.util.Date());
|
||||
order.setStatus(Order.StatusEnum.placed);
|
||||
order.setComplete(true);
|
||||
|
||||
return order;
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package io.swagger.petstore.test;
|
||||
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class UserApiTest {
|
||||
UserApi api = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new UserApi();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateUser() throws Exception {
|
||||
User user = createUser();
|
||||
|
||||
api.createUser(user);
|
||||
|
||||
User fetched = api.getUserByName(user.getUsername());
|
||||
assertEquals(user.getId(), fetched.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateUsersWithArray() throws Exception {
|
||||
User user1 = createUser();
|
||||
user1.setUsername("abc123");
|
||||
User user2 = createUser();
|
||||
user2.setUsername("123abc");
|
||||
|
||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
||||
|
||||
User fetched = api.getUserByName(user1.getUsername());
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateUsersWithList() throws Exception {
|
||||
User user1 = createUser();
|
||||
user1.setUsername("abc123");
|
||||
User user2 = createUser();
|
||||
user2.setUsername("123abc");
|
||||
|
||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
||||
|
||||
User fetched = api.getUserByName(user1.getUsername());
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginUser() throws Exception {
|
||||
User user = createUser();
|
||||
api.createUser(user);
|
||||
|
||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
||||
assertTrue(token.startsWith("logged in user session:"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logoutUser() throws Exception {
|
||||
api.logoutUser();
|
||||
}
|
||||
|
||||
private User createUser() {
|
||||
User user = new User();
|
||||
user.setId(System.currentTimeMillis());
|
||||
user.setUsername("fred");
|
||||
user.setFirstName("Fred");
|
||||
user.setLastName("Meyer");
|
||||
user.setEmail("fred@fredmeyer.com");
|
||||
user.setPassword("xxXXxx");
|
||||
user.setPhone("408-867-5309");
|
||||
user.setUserStatus(123);
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -189,14 +189,9 @@ public class ApiInvoker {
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
INSTANCE.authentications = new HashMap<String, Authentication>();
|
||||
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
// TODO: comment out below as OAuth does not exist
|
||||
//INSTANCE.authentications.put("petstore_auth", new OAuth());
|
||||
INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
|
||||
INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
|
||||
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth());
|
||||
INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
|
||||
INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
|
||||
// Prevent the authentications from being modified.
|
||||
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
|
||||
}
|
||||
|
||||
@@ -35,42 +35,10 @@ public class JsonUtil {
|
||||
public static Type getListTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Animal>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Cat>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Category>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Dog>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("FormatTest".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<FormatTest>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<InlineResponse200>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Model200Response".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Model200Response>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ModelReturn".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<ModelReturn>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Name".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Name>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Order>>(){}.getType();
|
||||
}
|
||||
@@ -79,10 +47,6 @@ public class JsonUtil {
|
||||
return new TypeToken<List<Pet>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("SpecialModelName".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<SpecialModelName>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Tag>>(){}.getType();
|
||||
}
|
||||
@@ -97,42 +61,10 @@ public class JsonUtil {
|
||||
public static Type getTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Animal>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Cat>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Category>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Dog>(){}.getType();
|
||||
}
|
||||
|
||||
if ("FormatTest".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<FormatTest>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<InlineResponse200>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Model200Response".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Model200Response>(){}.getType();
|
||||
}
|
||||
|
||||
if ("ModelReturn".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<ModelReturn>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Name".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Name>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Order".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Order>(){}.getType();
|
||||
}
|
||||
@@ -141,10 +73,6 @@ public class JsonUtil {
|
||||
return new TypeToken<Pet>(){}.getType();
|
||||
}
|
||||
|
||||
if ("SpecialModelName".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<SpecialModelName>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Tag".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Tag>(){}.getType();
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
public class Responses {
|
||||
|
||||
|
||||
public static interface UserResponse {
|
||||
public void onResponse(User user);
|
||||
}
|
||||
public static interface UserListResponse {
|
||||
public void onResponse(List<User> userList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static interface CategoryResponse {
|
||||
public void onResponse(Category category);
|
||||
}
|
||||
public static interface CategoryListResponse {
|
||||
public void onResponse(List<Category> categoryList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static interface PetResponse {
|
||||
public void onResponse(Pet pet);
|
||||
}
|
||||
public static interface PetListResponse {
|
||||
public void onResponse(List<Pet> petList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static interface TagResponse {
|
||||
public void onResponse(Tag tag);
|
||||
}
|
||||
public static interface TagListResponse {
|
||||
public void onResponse(List<Tag> tagList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static interface OrderResponse {
|
||||
public void onResponse(Order order);
|
||||
}
|
||||
public static interface OrderListResponse {
|
||||
public void onResponse(List<Order> orderList);
|
||||
}
|
||||
|
||||
|
||||
public static interface StringResponse {
|
||||
public void onResponse(String response);
|
||||
}
|
||||
|
||||
public static interface StringListResponse {
|
||||
public void onResponse(List<String> stringList);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
import io.swagger.client.model.Pet;
|
||||
import io.swagger.client.model.InlineResponse200;
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
@@ -131,127 +130,6 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
"application/json","application/xml"
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String localVarResponse) {
|
||||
responseListener.onResponse(localVarResponse);
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorListener.onErrorResponse(error);
|
||||
}
|
||||
});
|
||||
} catch (ApiException ex) {
|
||||
errorListener.onErrorResponse(new VolleyError(ex));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param body Pet object in the form of byte array
|
||||
* @return void
|
||||
*/
|
||||
public void addPetUsingByteArray (byte[] body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
"application/json","application/xml"
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
if(localVarResponse != null){
|
||||
return ;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param body Pet object in the form of byte array
|
||||
*/
|
||||
public void addPetUsingByteArray (byte[] body, final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
"application/json","application/xml"
|
||||
};
|
||||
@@ -425,8 +303,8 @@ public class PetApi {
|
||||
}
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for query
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return List<Pet>
|
||||
*/
|
||||
public List<Pet> findPetsByStatus (List<String> status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
@@ -490,8 +368,8 @@ public class PetApi {
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for query
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
*/
|
||||
public void findPetsByStatus (List<String> status, final Response.Listener<List<Pet>> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
@@ -721,7 +599,7 @@ public class PetApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@@ -791,7 +669,7 @@ public class PetApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@@ -815,280 +693,6 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return InlineResponse200
|
||||
*/
|
||||
public InlineResponse200 getPetByIdInObject (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject",
|
||||
new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"));
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
if(localVarResponse != null){
|
||||
return (InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
*/
|
||||
public void getPetByIdInObject (Long petId, final Response.Listener<InlineResponse200> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetByIdInObject",
|
||||
new ApiException(400, "Missing the required parameter 'petId' when calling getPetByIdInObject"));
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String localVarResponse) {
|
||||
try {
|
||||
responseListener.onResponse((InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class));
|
||||
} catch (ApiException exception) {
|
||||
errorListener.onErrorResponse(new VolleyError(exception));
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorListener.onErrorResponse(error);
|
||||
}
|
||||
});
|
||||
} catch (ApiException ex) {
|
||||
errorListener.onErrorResponse(new VolleyError(ex));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return byte[]
|
||||
*/
|
||||
public byte[] petPetIdtestingByteArraytrueGet (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet",
|
||||
new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"));
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
if(localVarResponse != null){
|
||||
return (byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
*/
|
||||
public void petPetIdtestingByteArraytrueGet (Long petId, final Response.Listener<byte[]> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet",
|
||||
new ApiException(400, "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"));
|
||||
}
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String localVarResponse) {
|
||||
try {
|
||||
responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class));
|
||||
} catch (ApiException exception) {
|
||||
errorListener.onErrorResponse(new VolleyError(exception));
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorListener.onErrorResponse(error);
|
||||
}
|
||||
});
|
||||
} catch (ApiException ex) {
|
||||
errorListener.onErrorResponse(new VolleyError(ex));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
|
||||
@@ -11,8 +11,8 @@ import java.util.*;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
import io.swagger.client.model.Order;
|
||||
import java.util.Map;
|
||||
import io.swagger.client.model.Order;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
@@ -178,133 +178,6 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param status Status value that needs to be considered for query
|
||||
* @return List<Order>
|
||||
*/
|
||||
public List<Order> findOrdersByStatus (String status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status));
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
if(localVarResponse != null){
|
||||
return (List<Order>) ApiInvoker.deserialize(localVarResponse, "array", Order.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param status Status value that needs to be considered for query
|
||||
*/
|
||||
public void findOrdersByStatus (String status, final Response.Listener<List<Order>> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status));
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String localVarResponse) {
|
||||
try {
|
||||
responseListener.onResponse((List<Order>) ApiInvoker.deserialize(localVarResponse, "array", Order.class));
|
||||
} catch (ApiException exception) {
|
||||
errorListener.onErrorResponse(new VolleyError(exception));
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorListener.onErrorResponse(error);
|
||||
}
|
||||
});
|
||||
} catch (ApiException ex) {
|
||||
errorListener.onErrorResponse(new VolleyError(ex));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @return Map<String, Integer>
|
||||
@@ -429,130 +302,6 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
* @return Object
|
||||
*/
|
||||
public Object getInventoryInObject () throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
if(localVarResponse != null){
|
||||
return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
throw ex;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
|
||||
*/
|
||||
public void getInventoryInObject (final Response.Listener<Object> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
// header params
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
// form params
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
|
||||
};
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if (contentType.startsWith("multipart/form-data")) {
|
||||
// file uploading
|
||||
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
|
||||
|
||||
|
||||
HttpEntity httpEntity = localVarBuilder.build();
|
||||
postBody = httpEntity;
|
||||
} else {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String localVarResponse) {
|
||||
try {
|
||||
responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class));
|
||||
} catch (ApiException exception) {
|
||||
errorListener.onErrorResponse(new VolleyError(exception));
|
||||
}
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorListener.onErrorResponse(error);
|
||||
}
|
||||
});
|
||||
} catch (ApiException ex) {
|
||||
errorListener.onErrorResponse(new VolleyError(ex));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
@@ -596,7 +345,7 @@ public class StoreApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@@ -666,7 +415,7 @@ public class StoreApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@@ -727,7 +476,7 @@ public class StoreApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@@ -791,7 +540,7 @@ public class StoreApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
|
||||
@@ -451,7 +451,7 @@ public class UserApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_http_basic" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@@ -521,7 +521,7 @@ public class UserApi {
|
||||
// normal form params
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_http_basic" };
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Animal {\n");
|
||||
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Cat extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("declawed")
|
||||
private Boolean declawed = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
public void setDeclawed(Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" declawed: ").append(declawed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,27 @@ public class Category {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return (id == null ? category.id == null : id.equals(category.id)) &&
|
||||
(name == null ? category.name == null : name.equals(category.name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (id == null ? 0: id.hashCode());
|
||||
result = 31 * result + (name == null ? 0: name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Dog extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("breed")
|
||||
private String breed = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getBreed() {
|
||||
return breed;
|
||||
}
|
||||
public void setBreed(String breed) {
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" breed: ").append(breed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class FormatTest {
|
||||
|
||||
@SerializedName("integer")
|
||||
private Integer integer = null;
|
||||
@SerializedName("int32")
|
||||
private Integer int32 = null;
|
||||
@SerializedName("int64")
|
||||
private Long int64 = null;
|
||||
@SerializedName("number")
|
||||
private BigDecimal number = null;
|
||||
@SerializedName("float")
|
||||
private Float _float = null;
|
||||
@SerializedName("double")
|
||||
private Double _double = null;
|
||||
@SerializedName("string")
|
||||
private String string = null;
|
||||
@SerializedName("byte")
|
||||
private byte[] _byte = null;
|
||||
@SerializedName("binary")
|
||||
private byte[] binary = null;
|
||||
@SerializedName("date")
|
||||
private Date date = null;
|
||||
@SerializedName("dateTime")
|
||||
private Date dateTime = null;
|
||||
@SerializedName("password")
|
||||
private String password = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getInteger() {
|
||||
return integer;
|
||||
}
|
||||
public void setInteger(Integer integer) {
|
||||
this.integer = integer;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getInt32() {
|
||||
return int32;
|
||||
}
|
||||
public void setInt32(Integer int32) {
|
||||
this.int32 = int32;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Long getInt64() {
|
||||
return int64;
|
||||
}
|
||||
public void setInt64(Long int64) {
|
||||
this.int64 = int64;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
public void setNumber(BigDecimal number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Float getFloat() {
|
||||
return _float;
|
||||
}
|
||||
public void setFloat(Float _float) {
|
||||
this._float = _float;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Double getDouble() {
|
||||
return _double;
|
||||
}
|
||||
public void setDouble(Double _double) {
|
||||
this._double = _double;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getString() {
|
||||
return string;
|
||||
}
|
||||
public void setString(String string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public byte[] getByte() {
|
||||
return _byte;
|
||||
}
|
||||
public void setByte(byte[] _byte) {
|
||||
this._byte = _byte;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public byte[] getBinary() {
|
||||
return binary;
|
||||
}
|
||||
public void setBinary(byte[] binary) {
|
||||
this.binary = binary;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Date getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
public void setDateTime(Date dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class FormatTest {\n");
|
||||
|
||||
sb.append(" integer: ").append(integer).append("\n");
|
||||
sb.append(" int32: ").append(int32).append("\n");
|
||||
sb.append(" int64: ").append(int64).append("\n");
|
||||
sb.append(" number: ").append(number).append("\n");
|
||||
sb.append(" _float: ").append(_float).append("\n");
|
||||
sb.append(" _double: ").append(_double).append("\n");
|
||||
sb.append(" string: ").append(string).append("\n");
|
||||
sb.append(" _byte: ").append(_byte).append("\n");
|
||||
sb.append(" binary: ").append(binary).append("\n");
|
||||
sb.append(" date: ").append(date).append("\n");
|
||||
sb.append(" dateTime: ").append(dateTime).append("\n");
|
||||
sb.append(" password: ").append(password).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class InlineResponse200 {
|
||||
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("id")
|
||||
private Long id = null;
|
||||
@SerializedName("category")
|
||||
private Object category = null;
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
public enum StatusEnum {
|
||||
available, pending, sold,
|
||||
};
|
||||
@SerializedName("status")
|
||||
private StatusEnum status = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Object getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Object category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ApiModelProperty(value = "pet status in the store")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineResponse200 {\n");
|
||||
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" category: ").append(category).append("\n");
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" status: ").append(status).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name starting with number")
|
||||
public class Model200Response {
|
||||
|
||||
@SerializedName("name")
|
||||
private Integer name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(Integer name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Model200Response {\n");
|
||||
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
**/
|
||||
@ApiModel(description = "Model for testing reserved words")
|
||||
public class ModelReturn {
|
||||
|
||||
@SerializedName("return")
|
||||
private Integer _return = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getReturn() {
|
||||
return _return;
|
||||
}
|
||||
public void setReturn(Integer _return) {
|
||||
this._return = _return;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelReturn {\n");
|
||||
|
||||
sb.append(" _return: ").append(_return).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name same as property name")
|
||||
public class Name {
|
||||
|
||||
@SerializedName("name")
|
||||
private Integer name = null;
|
||||
@SerializedName("snake_case")
|
||||
private Integer snakeCase = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public Integer getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(Integer name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer getSnakeCase() {
|
||||
return snakeCase;
|
||||
}
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Name {\n");
|
||||
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" snakeCase: ").append(snakeCase).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user